🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd
Article #101

'Bug' and fix/improvement to vipw

#101
From: Steve Simmons
Date: Mon, 25 Sep 1989 16:11
42 lines
2033 bytes
We recently had some odd performance on a BSD4.3 VAX.  We've fixed
the performance, but don't think we fixed the bug.  :-(.  Along the
way we improved some error messages in vipw, and include them here.

We wanted to change the 'root' home from / to /etc/root.  When doing
this with vipw, we got messages about having corrupted the passwd file.
It turns out that our passwd file was corrupted all along, and vipw
was not noticing!

Circumstances: one operator was changing /etc/passwd with another
editor, then not running mkpasswd.  She introduced a format error in
the file.  Running vipw to add, delete or disable users gave no complaint.
But modifying the root entry did.

Once we figured out what was going on, we fixed /etc/passwd, then ran
mkpasswd to force the updates.  This had the bizarre side-effect of
changing the root password!  If anyone can tell me what we did wrong,
I'd sure appreciate it.

Along the way, we improved the vipw error message so it tells you just
what entry is corrupted.  The patch (to tahoe vipw) follows.

*** vipw.c	Mon Sep 25 12:09:02 1989
--- vipw.c.orig	Mon Sep 25 12:07:29 1989
***************
*** 193,199 ****
  				else if (!strcmp(cp, sh))
  					break;
  		if (token(CHN)) {			/* too many fields */
! bad:			fprintf(stderr, "vipw: too many fields for user %s, %s unchanged.\n", buf, passwd);
  			return(0);
  		}
  	}
--- 193,199 ----
  				else if (!strcmp(cp, sh))
  					break;
  		if (token(CHN)) {			/* too many fields */
! bad:			fprintf(stderr, "vipw: corrupted entry; %s unchanged.\n", passwd);
  			return(0);
  		}
  	}
Technical Details
Message-ID: <3950@itivax.iti.org>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!sharkey!itivax!itivax.iti.org!scs

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!sharkey!itivax!itivax.iti.org!scs
From: scs@itivax.iti.org (Steve Simmons)
Newsgroups: comp.bugs.4bsd
Subject: 'Bug' and fix/improvement to vipw
Message-ID: <3950@itivax.iti.org>
Date: 25 Sep 89 16:11:46 GMT
Sender: scs@itivax.iti.org
Reply-To: scs@itivax.iti.org (Steve Simmons)
Organization: Industrial Technology Institute
Lines: 42