summaryrefslogtreecommitdiffstats
path: root/usr.sbin/vipw/pw_util.c
diff options
context:
space:
mode:
authorguido <guido@FreeBSD.org>1996-07-01 19:38:50 +0000
committerguido <guido@FreeBSD.org>1996-07-01 19:38:50 +0000
commit70bae2bee199f1171426e884d9dd14bcf0c85eb7 (patch)
tree4bfb5d9e29eba41cf2d104fc69a77e860b476e6b /usr.sbin/vipw/pw_util.c
parent9f2f4504f0af05668863538cc309552906b0a9da (diff)
downloadFreeBSD-src-70bae2bee199f1171426e884d9dd14bcf0c85eb7.zip
FreeBSD-src-70bae2bee199f1171426e884d9dd14bcf0c85eb7.tar.gz
Implement incremental passwd database updates. This is done by ading a '-u'
option to pwd_mkdb and adding this option to utilities invoking it. Further, the filling of both the secure and insecure databases has been merged into one loop giving also a performance improvemnet. Note that I did *not* change the adduser command. I don't read perl (it is a write only language anyway). The change will drastically improve performance for passwd and friends with large passwd files. Vipw's performance won't change. In order to do that some kind of diff should be made between the old and new master.passwd and depending the amount of changes, an incremental or complete update of the databases should be agreed upon.
Diffstat (limited to 'usr.sbin/vipw/pw_util.c')
-rw-r--r--usr.sbin/vipw/pw_util.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/vipw/pw_util.c b/usr.sbin/vipw/pw_util.c
index 60b4f77..7ebe86e 100644
--- a/usr.sbin/vipw/pw_util.c
+++ b/usr.sbin/vipw/pw_util.c
@@ -138,7 +138,8 @@ pw_tmp()
}
int
-pw_mkdb()
+pw_mkdb(username)
+char *username;
{
int pstat;
pid_t pid;
@@ -146,7 +147,12 @@ pw_mkdb()
warnx("rebuilding the database...");
(void)fflush(stderr);
if (!(pid = vfork())) {
- execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", tempname, NULL);
+ if(!username) {
+ execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", tempname, NULL);
+ } else {
+ execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", "-u",
+ username, tempname, NULL);
+ }
pw_error(_PATH_PWD_MKDB, 1, 1);
}
pid = waitpid(pid, &pstat, 0);
OpenPOWER on IntegriCloud