summaryrefslogtreecommitdiffstats
path: root/usr.sbin/vipw
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
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')
-rw-r--r--usr.sbin/vipw/pw_util.c10
-rw-r--r--usr.sbin/vipw/pw_util.h2
-rw-r--r--usr.sbin/vipw/vipw.c2
3 files changed, 10 insertions, 4 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);
diff --git a/usr.sbin/vipw/pw_util.h b/usr.sbin/vipw/pw_util.h
index 9ea3672..c6aab8e 100644
--- a/usr.sbin/vipw/pw_util.h
+++ b/usr.sbin/vipw/pw_util.h
@@ -37,6 +37,6 @@ void pw_edit __P((int));
void pw_error __P((char *, int, int));
void pw_init __P((void));
int pw_lock __P((void));
-int pw_mkdb __P((void));
+int pw_mkdb __P((char *));
void pw_prompt __P((void));
int pw_tmp __P((void));
diff --git a/usr.sbin/vipw/vipw.c b/usr.sbin/vipw/vipw.c
index d69111f..08d7833 100644
--- a/usr.sbin/vipw/vipw.c
+++ b/usr.sbin/vipw/vipw.c
@@ -96,7 +96,7 @@ main(argc, argv)
warnx("no changes made");
pw_error((char *)NULL, 0, 0);
}
- if (pw_mkdb())
+ if (pw_mkdb((char *)NULL))
break;
pw_prompt();
}
OpenPOWER on IntegriCloud