summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chpass/chpass.c6
-rw-r--r--libutil/pw_util.c10
2 files changed, 12 insertions, 4 deletions
diff --git a/chpass/chpass.c b/chpass/chpass.c
index f353b33..83d5498 100644
--- a/chpass/chpass.c
+++ b/chpass/chpass.c
@@ -40,7 +40,7 @@ static char copyright[] =
#ifndef lint
static char sccsid[] = "From: @(#)chpass.c 8.4 (Berkeley) 4/2/94";
static char rcsid[] =
- "$Id: chpass.c,v 1.7 1996/02/23 16:08:56 wpaul Exp $";
+ "$Id: chpass.c,v 1.8 1996/05/25 01:05:17 wpaul Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -84,6 +84,7 @@ main(argc, argv)
{
enum { NEWSH, LOADENTRY, EDITENTRY, NEWPW } op;
struct passwd *pw, lpw;
+ char *username;
int ch, pfd, tfd;
char *arg;
#ifdef YP
@@ -180,6 +181,7 @@ main(argc, argv)
default:
usage();
}
+ username = pw->pw_name;
if (op == NEWSH) {
/* protect p_shell -- it thinks NULL is /bin/sh */
if (!arg[0])
@@ -250,7 +252,7 @@ main(argc, argv)
#endif /* YP */
pw_copy(pfd, tfd, pw);
- if (!pw_mkdb())
+ if (!pw_mkdb(username))
pw_error((char *)NULL, 0, 1);
#ifdef YP
}
diff --git a/libutil/pw_util.c b/libutil/pw_util.c
index 60b4f77..7ebe86e 100644
--- a/libutil/pw_util.c
+++ b/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);