Skip site navigation (1)Skip section navigation (2)
Date:      24 Aug 1999 08:48:10 -0000
From:      nbm@rucus.ru.ac.za
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/13346: Allow pw to use pwd_mkdb's -u option
Message-ID:  <19990824084810.82714.qmail@rucus.ru.ac.za>

next in thread | raw e-mail | index | archive | help

>Number:         13346
>Category:       bin
>Synopsis:       Allow pw to use pwd_mkdb's -u option
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 24 01:50:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Neil Blakey-Milner
>Release:        FreeBSD 3.0-STABLE i386
>Organization:
Rhodes University Computer Users' Society
>Environment:

FreeBSD rucus.ru.ac.za 3.0-STABLE FreeBSD 3.0-STABLE #0: Tue Feb  9 22:52:23 GMT 1999     grahams@rucus.ru.ac.za:/usr/src/sys/compile/RUCUS-SMP  i386

>Description:

pw issues a full pwd_mkdb for each pw useradd or usermod operation,
which was complained about on the ISP mailing list.  This patch teaches
pw to use -u user if the operation is not deletion.

>How-To-Repeat:

Have a few thousand pwd entries
Do a hundred pw usermods to achieve something
Realize you're late for supper.

>Fix:

cvs diff: Diffing .
Index: pwupd.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pw/pwupd.c,v
retrieving revision 1.8
diff -u -r1.8 pwupd.c
--- pwupd.c	1999/02/23 07:15:11	1.8
+++ pwupd.c	1999/08/20 07:08:02
@@ -168,8 +168,12 @@
 			 */
 			if (pwd != NULL)
 				fmtpwentry(pwbuf, pwd, PWF_MASTER);
-			if ((rc = fileupdate(getpwpath(_MASTERPASSWD), 0644, pwbuf, pfx, l, mode)) != 0)
-				rc = pwdb(NULL) == 0;
+			if ((rc = fileupdate(getpwpath(_MASTERPASSWD), 0644, pwbuf, pfx, l, mode)) != 0) {
+				if (mode == UPD_DELETE)
+					rc = pwdb(NULL) == 0;
+				else
+					rc = pwdb("-u", user, NULL) == 0;
+			}
 		}
 	}
 	return rc;

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990824084810.82714.qmail>