| Summary: | NIS passwd and group maps do not clean out comments (2nd part) | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Andre Albsmeier <Andre.Albsmeier> | ||||
| Component: | misc | Assignee: | Brian Somers <brian> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 3.4-STABLE | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
Responsible Changed From-To: freebsd-bugs->brian I did the first bit, I'll do this too (soon) State Changed From-To: open->closed Fixed in -current. Will mfc soon. |
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 Fix: This patch combines the two above for easy commiting. 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).