From jonny@jonny.eng.br  Wed Dec 15 08:39:58 1999
Return-Path: <jonny@jonny.eng.br>
Received: from roma.coe.ufrj.br (roma.coe.ufrj.br [146.164.53.65])
	by hub.freebsd.org (Postfix) with ESMTP id 1C06015241
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 15 Dec 1999 08:39:56 -0800 (PST)
	(envelope-from jonny@jonny.eng.br)
Received: (from root@localhost)
	by roma.coe.ufrj.br (8.9.3/8.9.3) id OAA04736;
	Wed, 15 Dec 1999 14:39:53 -0200 (EDT)
	(envelope-from jonny)
Message-Id: <199912151639.OAA04736@roma.coe.ufrj.br>
Date: Wed, 15 Dec 1999 14:39:53 -0200 (EDT)
From: Joao Carlos Mendes Luis <jonny@jonny.eng.br>
Reply-To: jonny@jonny.eng.br
To: FreeBSD-gnats-submit@freebsd.org
Subject: NIS and comments in /etc/passwd, /etc/group
X-Send-Pr-Version: 3.2

>Number:         15497
>Category:       bin
>Synopsis:       NIS does not deal well with comments
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 15 08:40:02 PST 1999
>Closed-Date:    Sat Dec 27 08:30:06 PST 2003
>Last-Modified:  Sat Dec 27 08:30:06 PST 2003
>Originator:     Joao Carlos Mendes Luis
>Release:        FreeBSD 3.4-RC i386
>Organization:
COPPE/UFRJ
>Environment:

   FreeBSD NIS server, using /etc/group and /etc/master.passwd as source

>Description:

  If you use comments (#) in those files, NIS tries to create tables
with them, instead of ignoring them.

>How-To-Repeat:

	Put a # comment in /etc/group, cd /var/yp, make

>Fix:
	
This patch removes lines with comments before making NIS databases.

--- Makefile.antes	Wed Dec 15 14:15:41 1999
+++ Makefile	Wed Dec 15 14:37:56 1999
@@ -479,7 +479,7 @@
 passwd.byname: $(PASSWD)
 	@echo "Updating $@..."
 	$(CAT) $(PASSWD) | \
-	$(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
+	$(AWK) -F: '{ if ($$1 != "+" && $$1 !~ "^#.*") print $$1"\t"$$0 }' $^ \
 		| $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
 		$(RMV) $(TMP) $@
 	@$(DBLOAD) -c
@@ -490,7 +490,7 @@
 passwd.byuid: $(PASSWD)
 	@echo "Updating $@..."
 	$(CAT) $(PASSWD) | \
-	$(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
+	$(AWK) -F: '{ if ($$1 != "+" && $$1 !~ "^#.*") print $$3"\t"$$0 }' $^ \
 		| $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
 		$(RMV) $(TMP) $@
 	@$(DBLOAD) -c
@@ -502,7 +502,7 @@
 group.byname: $(GROUP)
 	@echo "Updating $@..."
 	$(CAT) $(GROUP) | \
-	$(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
+	$(AWK) -F: '{ if ($$1 != "+" && $$1 !~ "^#.*") print $$1"\t"$$0 }' $^ \
 		| $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \
 		$(RMV) $(TMP) $@
 	@$(DBLOAD) -c
@@ -513,7 +513,7 @@
 group.bygid: $(GROUP)
 	@echo "Updating $@..."
 	$(CAT) $(GROUP) | \
-	$(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
+	$(AWK) -F: '{ if ($$1 != "+" && $$1 !~ "^#.*") print $$3"\t"$$0 }' $^ \
 		| $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \
 		$(RMV) $(TMP) $@
 	@$(DBLOAD) -c
@@ -538,7 +538,7 @@
 	@echo "Master.passwd source file not found -- skipping"
 .else
 	$(CAT) $(MASTER) | \
-	$(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
+	$(AWK) -F: '{ if ($$1 != "+" && $$1 !~ "^#.*") print $$1"\t"$$0 }' $^ \
 		| $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \
 		$(RMV) $(TMP) $@
 	@$(DBLOAD) -c
@@ -553,7 +553,7 @@
 	@echo "Master.passwd source file not found -- skipping"
 .else
 	$(CAT) $(MASTER) | \
-	$(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
+	$(AWK) -F: '{ if ($$1 != "+" && $$1 !~ "^#.*") print $$3"\t"$$0 }' $^ \
 		| $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \
 		$(RMV) $(TMP) $@
 	@$(DBLOAD) -c

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: ceri 
State-Changed-When: Sat Dec 27 08:29:46 PST 2003 
State-Changed-Why:  
Makefile.yp now ignores comments, as you requested. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=15497 
>Unformatted:
