From owner-freebsd-bugs Mon Jun 26 23: 0:14 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 677E937BE3C for ; Mon, 26 Jun 2000 23:00:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id XAA85924; Mon, 26 Jun 2000 23:00:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from goliath.siemens.de (goliath.siemens.de [194.138.37.131]) by hub.freebsd.org (Postfix) with ESMTP id 061F537BE31 for ; Mon, 26 Jun 2000 22:52:39 -0700 (PDT) (envelope-from andre.albsmeier@mchp.siemens.de) Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by goliath.siemens.de (8.10.1/8.10.1) with ESMTP id e5R5qaB27876 for ; Tue, 27 Jun 2000 07:52:36 +0200 (MET DST) Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.42.7]) by mail1.siemens.de (8.10.1/8.10.1) with ESMTP id e5R5qZC21833 for ; Tue, 27 Jun 2000 07:52:35 +0200 (MET DST) Received: (from localhost) by curry.mchp.siemens.de (8.10.2/8.10.2) id e5R5qZV80092 for FreeBSD-gnats-submit@freebsd.org; Tue, 27 Jun 2000 07:52:35 +0200 (CEST) Message-Id: <200006270552.e5R5qZ429053@curry.mchp.siemens.de> Date: Tue, 27 Jun 2000 07:52:35 +0200 (CEST) From: Andre Albsmeier To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: misc/19538: NIS passwd and group maps do not clean out comments (2nd part) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 19538 >Category: misc >Synopsis: NIS passwd and group maps do not clean out comments (2nd part) >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jun 26 23:00:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Andre Albsmeier >Release: FreeBSD 3.4-STABLE i386 >Organization: >Environment: All FreeBSD versions after June 21st. >Description: PR misc/14269 contained a fix for usr.sbin/ypserv/Makefile.yp to allow comments in passwd and group files. However, even with the patch in there we still get errors when putting comments in master.passwd. We can get rid of these by changing the master.passwd.byname: and the master.passwd.byuid: rules in the same way as Walt Howard did it in PR misc/14269 with the passwd and group rules: --- Makefile.yp.ORI Wed Jun 21 16:39:04 2000 +++ Makefile.yp Wed Jun 21 16:39:32 2000 @@ -541,7 +541,8 @@ @echo "Master.passwd source file not found -- skipping" .else $(CAT) $(MASTER) | \ - $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ + $(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ + print $$1"\t"$$0 }' $^ \ | $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \ $(RMV) $(TMP) $@ @$(DBLOAD) -c @@ -556,7 +557,8 @@ @echo "Master.passwd source file not found -- skipping" .else $(CAT) $(MASTER) | \ - $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ + $(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ + print $$3"\t"$$0 }' $^ \ | $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \ $(RMV) $(TMP) $@ @$(DBLOAD) -c In case that $(PASSWD) is being generated from $(MASTER) by the $(PASSWD): $(MASTER) rule, we will find things like #:::::: # Blah blah:::::: #:::::: in the resulting $(PASSWD). Although these are being ignored properly when bulding the maps, we can strip them out with the following, additional patch: --- Makefile.yp Wed Jun 21 16:52:01 2000 +++ Makefile.yp.new Wed Jun 21 16:52:37 2000 @@ -466,11 +466,11 @@ @echo "Creating new $@ file from $(MASTER)..." @if [ ! $(UNSECURE) ]; then \ $(RCAT) $(MASTER) | \ - $(AWK) -F: '{if ($$1 != "+") \ + $(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ > $(PASSWD) ; \ else $(RCAT) $(MASTER) | \ - $(AWK) -F: '{if ($$1 != "+") \ + $(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ > $(PASSWD) ; fi >How-To-Repeat: Insert comments into master.passwd and let passwd get built from it. Watch the error messages (1st patch) and examine the resulting passwd (2. patch). >Fix: This patch combines the two above for easy commiting. --- Makefile.yp.ORI Tue Jun 27 07:47:54 2000 +++ Makefile.yp Tue Jun 27 07:47:57 2000 @@ -466,11 +466,11 @@ @echo "Creating new $@ file from $(MASTER)..." @if [ ! $(UNSECURE) ]; then \ $(RCAT) $(MASTER) | \ - $(AWK) -F: '{if ($$1 != "+") \ + $(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ > $(PASSWD) ; \ else $(RCAT) $(MASTER) | \ - $(AWK) -F: '{if ($$1 != "+") \ + $(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ > $(PASSWD) ; fi @@ -541,7 +541,8 @@ @echo "Master.passwd source file not found -- skipping" .else $(CAT) $(MASTER) | \ - $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ + $(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ + print $$1"\t"$$0 }' $^ \ | $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \ $(RMV) $(TMP) $@ @$(DBLOAD) -c @@ -556,7 +557,8 @@ @echo "Master.passwd source file not found -- skipping" .else $(CAT) $(MASTER) | \ - $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ + $(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ + print $$3"\t"$$0 }' $^ \ | $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \ $(RMV) $(TMP) $@ @$(DBLOAD) -c >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message