From 70bae2bee199f1171426e884d9dd14bcf0c85eb7 Mon Sep 17 00:00:00 2001 From: guido Date: Mon, 1 Jul 1996 19:38:50 +0000 Subject: 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. --- lib/libutil/pw_util.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/libutil/pw_util.c b/lib/libutil/pw_util.c index 60b4f77..7ebe86e 100644 --- a/lib/libutil/pw_util.c +++ b/lib/libutil/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); -- cgit v1.1