summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rpc.yppasswdd
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/rpc.yppasswdd
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/rpc.yppasswdd')
-rw-r--r--usr.sbin/rpc.yppasswdd/pw_util.c10
-rw-r--r--usr.sbin/rpc.yppasswdd/yppasswdd_extern.h4
-rw-r--r--usr.sbin/rpc.yppasswdd/yppasswdd_server.c8
3 files changed, 14 insertions, 8 deletions
diff --git a/usr.sbin/rpc.yppasswdd/pw_util.c b/usr.sbin/rpc.yppasswdd/pw_util.c
index bfd5c5b..a4912d0 100644
--- a/usr.sbin/rpc.yppasswdd/pw_util.c
+++ b/usr.sbin/rpc.yppasswdd/pw_util.c
@@ -138,7 +138,8 @@ pw_tmp()
}
int
-pw_mkdb()
+pw_mkdb(username)
+char *username;
{
yp_error("rebuilding the database...");
@@ -146,7 +147,12 @@ pw_mkdb()
/* Temporarily turn off SIGCHLD catching */
install_reaper(0);
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);
return(-1);
}
diff --git a/usr.sbin/rpc.yppasswdd/yppasswdd_extern.h b/usr.sbin/rpc.yppasswdd/yppasswdd_extern.h
index b67d039..405bb5c 100644
--- a/usr.sbin/rpc.yppasswdd/yppasswdd_extern.h
+++ b/usr.sbin/rpc.yppasswdd/yppasswdd_extern.h
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: yppasswdd_extern.h,v 1.7 1996/06/23 22:20:43 wpaul Exp $
+ * $Id: yppasswdd_extern.h,v 1.4 1996/06/23 22:44:03 wpaul Exp $
*/
#include <sys/types.h>
@@ -62,7 +62,7 @@ extern void reaper __P(( int ));
extern void install_reaper __P(( int ));
extern int pw_copy __P(( int, int, struct passwd * ));
extern int pw_lock __P(( void ));
-extern int pw_mkdb __P(( void ));
+extern int pw_mkdb __P(( char * ));
extern int pw_tmp __P(( void ));
extern void pw_init __P(( void ));
extern char *ok_shell __P (( char * ));
diff --git a/usr.sbin/rpc.yppasswdd/yppasswdd_server.c b/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
index f7df723..814025b 100644
--- a/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
+++ b/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: yppasswdd_server.c,v 1.17 1996/06/23 22:20:43 wpaul Exp $
+ * $Id: yppasswdd_server.c,v 1.5 1996/06/23 22:44:06 wpaul Exp $
*/
#include <stdio.h>
@@ -61,7 +61,7 @@ struct dom_binding {};
#include "yppasswd_comm.h"
#ifndef lint
-static const char rcsid[] = "$Id: yppasswdd_server.c,v 1.17 1996/06/23 22:20:43 wpaul Exp $";
+static const char rcsid[] = "$Id: yppasswdd_server.c,v 1.5 1996/06/23 22:44:06 wpaul Exp $";
#endif /* not lint */
char *tempname;
@@ -567,7 +567,7 @@ cleaning up and bailing out");
if (strcmp(passfile, _PATH_MASTERPASSWD)) {
rename(tempname, passfile);
} else {
- if (pw_mkdb() < 0) {
+ if (pw_mkdb(argp->newpw.pw_name) < 0) {
yp_error("pwd_mkdb failed");
return(&result);
}
@@ -718,7 +718,7 @@ cleaning up and bailing out");
if (strcmp(passfile, _PATH_MASTERPASSWD)) {
rename(tempname, passfile);
} else {
- if (pw_mkdb() < 0) {
+ if (pw_mkdb(argp->newpw.pw_name) < 0) {
yp_error("pwd_mkdb failed");
return(result);
}
OpenPOWER on IntegriCloud