From andre.albsmeier@mchp.siemens.de Mon Jul 3 03:20:54 2000 Return-Path: Received: from goliath.siemens.de (goliath.siemens.de [194.138.37.131]) by hub.freebsd.org (Postfix) with ESMTP id 8768437BF2C for ; Mon, 3 Jul 2000 03:20:52 -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 e63AKoB17497 for ; Mon, 3 Jul 2000 12:20:50 +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 e63AKoM25400 for ; Mon, 3 Jul 2000 12:20:50 +0200 (MET DST) Received: (from localhost) by curry.mchp.siemens.de (8.10.2/8.10.2) id e63AKnv24998 for FreeBSD-gnats-submit@freebsd.org; Mon, 3 Jul 2000 12:20:49 +0200 (CEST) Message-Id: <200007031020.e63AKn596976@curry.mchp.siemens.de> Date: Mon, 3 Jul 2000 12:20:49 +0200 (CEST) From: Andre Albsmeier To: FreeBSD-gnats-submit@freebsd.org Subject: rpc.yppasswdd can't deal with comments in master.passwd X-Send-Pr-Version: 3.2 >Number: 19664 >Category: bin >Synopsis: rpc.yppasswdd can't deal with comments in master.passwd >Confidential: no >Severity: serious >Priority: medium >Responsible: davidn >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jul 03 03:30:00 PDT 2000 >Closed-Date: Wed Jul 12 21:02:03 EST 2000 >Last-Modified: Wed Jul 12 21:03:25 EST 2000 >Originator: Andre Albsmeier >Release: FreeBSD 3.4-STABLE i386 >Organization: >Environment: 3.5-STABLE, but I assume alle versions. >Description: When using yppasswd, rpc.yppasswdd can't deal with comments in the $(YPDIR)/master.passwd file. Instead it logs to syslog: rpc.yppasswdd[2623]: /var/yp/src/master.passwd: corrupted entry rpc.yppasswdd[2623]: /var/yp/src/master.passwd: unchanged rpc.yppasswdd[2623]: /var/yp/src/master.passwd: unchanged rpc.yppasswdd[2623]: failed to created updated password file -- cleaning up and bailing out >How-To-Repeat: Enter a comment in $(YPDIR)/master.passwd. Run yppasswd to produce the error. >Fix: >Release-Note: >Audit-Trail: Responsible-Changed-From-To: freebsd-bugs->davidn Responsible-Changed-By: sheldonh Responsible-Changed-When: Mon Jul 3 04:28:33 PDT 2000 Responsible-Changed-Why: David likes passwd-related problems. :-) http://www.freebsd.org/cgi/query-pr.cgi?pr=19664 State-Changed-From-To: open->feedback State-Changed-By: davidn State-Changed-When: Tue Jul 11 12:09:15 EST 2000 State-Changed-Why: Patch submitted to user for testing. http://www.freebsd.org/cgi/query-pr.cgi?pr=19664 From: David Nugent To: andre.albsmeier@mchp.siemens.de Cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: bin/19664: rpc.yppasswdd can't deal with comments in master.passwd Date: Tue, 11 Jul 2000 12:06:42 +1000 (EST) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --0-737356478-963281202=:639 Content-Type: TEXT/PLAIN; charset=US-ASCII Please try the enclosed patch and test to ensure that it resolves your problem. --0-737356478-963281202=:639 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="pw_copy.c.diff" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: pw_copy.c.diff Content-Disposition: attachment; filename="pw_copy.c.diff" RXhlY3V0aW5nOiBjdnMgZGlmZiAtYyBwd19jb3B5LmMNCkluZGV4OiBwd19j b3B5LmMNCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0NClJDUyBmaWxlOiAvaG9t ZS9uY3ZzL3NyYy91c3Iuc2Jpbi9ycGMueXBwYXNzd2RkL3B3X2NvcHkuYyx2 DQpyZXRyaWV2aW5nIHJldmlzaW9uIDEuNA0KZGlmZiAtYyAtcjEuNCBwd19j b3B5LmMNCioqKiBwd19jb3B5LmMJMTk5OS8wOC8yOCAwMToxOTo0MAkxLjQN Ci0tLSBwd19jb3B5LmMJMjAwMC8wNy8xMSAwMTo1OTozMg0KKioqKioqKioq KioqKioqDQoqKiogOTAsOTUgKioqKg0KLS0tIDkwLDEwNSAtLS0tDQogIAkJ CQlnb3RvIGVycjsNCiAgCQkJY29udGludWU7DQogIAkJfQ0KKyAJCS8qDQor IAkJICogSnVzdCBjb3B5IGNvbW1lbnRzIGFuZCBibGFuayBsaW5lcw0KKyAJ CSAqLw0KKyAJCXAgPSBidWYgKyBzdHJjc3BuKGJ1ZiwgIiBcdFxuIik7DQor IAkJaWYgKCpwID09ICdcMCcgfHwgKnAgPT0gJyMnKSB7DQorIAkJICAgICAg ICAodm9pZClmcHJpbnRmKHRvLCAiJXMiLCBidWYpOw0KKyAJCQlpZiAoZmVy cm9yKHRvKSkNCisgCQkJCWdvdG8gZXJyOw0KKyAJCQljb250aW51ZTsNCisg CQl9DQogIAkJaWYgKCEocCA9IHN0cmNocihidWYsICc6JykpKSB7DQogIAkJ CXlwX2Vycm9yKCIlczogY29ycnVwdGVkIGVudHJ5IiwgcGFzc2ZpbGUpOw0K ICAJCQlwd19lcnJvcihOVUxMLCAwLCAxKTsNCg== --0-737356478-963281202=:639-- From: Andre Albsmeier To: David Nugent Cc: andre.albsmeier@mchp.siemens.de, FreeBSD-gnats-submit@freebsd.org Subject: Re: bin/19664: rpc.yppasswdd can't deal with comments in master.passwd Date: Tue, 11 Jul 2000 13:42:55 +0200 On Tue, 11-Jul-2000 at 12:06:42 +1000, David Nugent wrote: > Please try the enclosed patch and test to ensure that it resolves your > problem. > Content-Description: pw_copy.c.diff > Executing: cvs diff -c pw_copy.c > Index: pw_copy.c > =================================================================== > RCS file: /home/ncvs/src/usr.sbin/rpc.yppasswdd/pw_copy.c,v > retrieving revision 1.4 > diff -c -r1.4 pw_copy.c > *** pw_copy.c 1999/08/28 01:19:40 1.4 > --- pw_copy.c 2000/07/11 01:59:32 > *************** > *** 90,95 **** > --- 90,105 ---- > goto err; > continue; > } > + /* > + * Just copy comments and blank lines > + */ > + p = buf + strcspn(buf, " \t\n"); > + if (*p == '\0' || *p == '#') { > + (void)fprintf(to, "%s", buf); > + if (ferror(to)) > + goto err; > + continue; > + } > if (!(p = strchr(buf, ':'))) { > yp_error("%s: corrupted entry", passfile); > pw_error(NULL, 0, 1); Adding the '#' char to " \t\n" made it work. So the line reads p = buf + strcspn(buf, "# \t\n"); -Andre From: David Nugent To: Andre Albsmeier , freebsd-gnats-submit@freebsd.org Cc: Subject: Re: bin/19664: rpc.yppasswdd can't deal with comments in master.passwd Date: Tue, 11 Jul 2000 23:23:24 +1000 Andre Albsmeier wrote: > > + p = buf + strcspn(buf, " \t\n"); > > + if (*p == '\0' || *p == '#') { > > + (void)fprintf(to, "%s", buf); > > + if (ferror(to)) > > + goto err; > > + continue; > > + } > > if (!(p = strchr(buf, ':'))) { > > yp_error("%s: corrupted entry", passfile); > > pw_error(NULL, 0, 1); > > Adding the '#' char to " \t\n" made it work. So the line reads > > p = buf + strcspn(buf, "# \t\n"); Hmm. But this would mean # blah this is supposed to be a comment have variable 'p' pointing at 'b' on the first 'if' statement above. It would not be detected as a comment and it would get junked by the next 'if'. ACK! I see the bug. Change strcspn() to strspn() in my original patch and try it again. Sorry about that - I've *always* confused those two. :-) That statement is intended to skip leading whitespace and test the next char for end of string (empty line) or the start of a comment. If either, copy and continue, otherwise fall through to the sanity check that caused the hiccup before. David From: Andre Albsmeier To: David Nugent Cc: Andre Albsmeier , freebsd-gnats-submit@freebsd.org Subject: Re: bin/19664: rpc.yppasswdd can't deal with comments in master.passwd Date: Wed, 12 Jul 2000 11:46:05 +0200 On Tue, 11-Jul-2000 at 23:23:24 +1000, David Nugent wrote: > Andre Albsmeier wrote: > > > + p = buf + strcspn(buf, " \t\n"); > > > + if (*p == '\0' || *p == '#') { > > > + (void)fprintf(to, "%s", buf); > > > + if (ferror(to)) > > > + goto err; > > > + continue; > > > + } > > > if (!(p = strchr(buf, ':'))) { > > > yp_error("%s: corrupted entry", passfile); > > > pw_error(NULL, 0, 1); > > > > Adding the '#' char to " \t\n" made it work. So the line reads > > > > p = buf + strcspn(buf, "# \t\n"); > > Hmm. But this would mean > > # blah this is supposed to be a comment > > have variable 'p' pointing at 'b' on the first 'if' statement above. > It would not be detected as a comment and it would get junked by > the next 'if'. Oops, of course... > > ACK! I see the bug. Change strcspn() to strspn() in my original > patch and try it again. Sorry about that - I've *always* confused > those two. :-) That statement is intended to skip leading whitespace > and test the next char for end of string (empty line) or the start > of a comment. If either, copy and continue, otherwise fall through > to the sanity check that caused the hiccup before. Works! Thanks a lot. -Andre > > > David -- Your mouse has moved. Windows NT must be restarted for the change to take effect! Reboot now? [OK] State-Changed-From-To: feedback->closed State-Changed-By: davidn State-Changed-When: Wed Jul 12 21:02:03 EST 2000 State-Changed-Why: Fix committed in: Checking in pw_copy.c; /home/ncvs/src/usr.sbin/rpc.yppasswdd/pw_copy.c,v <-- pw_copy.c new revision: 1.5; previous revision: 1.4 http://www.freebsd.org/cgi/query-pr.cgi?pr=19664 >Unformatted: