diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-11-01 17:40:38 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-11-01 17:40:38 +0000 |
commit | 66e65e13d60443077f12a35777f4fb1641bb3ad7 (patch) | |
tree | 5eeb280bfb775879c365650cff783a12d5353f59 /libexec/rpc.yppasswdd/yppasswdd_mkpw.c | |
parent | 34ad72d2df218ebc618d3b321656804f58599720 (diff) |
+ from moj
Diffstat (limited to 'libexec/rpc.yppasswdd/yppasswdd_mkpw.c')
-rw-r--r-- | libexec/rpc.yppasswdd/yppasswdd_mkpw.c | 74 |
1 files changed, 23 insertions, 51 deletions
diff --git a/libexec/rpc.yppasswdd/yppasswdd_mkpw.c b/libexec/rpc.yppasswdd/yppasswdd_mkpw.c index 19f603d52e1..331d5db5842 100644 --- a/libexec/rpc.yppasswdd/yppasswdd_mkpw.c +++ b/libexec/rpc.yppasswdd/yppasswdd_mkpw.c @@ -28,7 +28,7 @@ */ #ifndef LINT -static char rcsid[] = "$Id: yppasswdd_mkpw.c,v 1.1 1995/10/23 07:44:42 deraadt Exp $"; +static char rcsid[] = "$Id: yppasswdd_mkpw.c,v 1.2 1995/11/01 17:40:35 deraadt Exp $"; #endif #include <sys/types.h> @@ -39,7 +39,9 @@ static char rcsid[] = "$Id: yppasswdd_mkpw.c,v 1.1 1995/10/23 07:44:42 deraadt E #include <pwd.h> #include <stdlib.h> #include <unistd.h> -#include "yplog.h" + +#include "pw_util.h" +#include "pw_copy.h" extern int noshell; extern int nogecos; @@ -52,25 +54,14 @@ make_passwd(argp) yppasswd *argp; { struct passwd *pw; - int pfd, tfd; - - yplog_line("enter make_passwd"); + int pfd, tfd; - if (!(pw = getpwnam(argp->newpw.pw_name))) { - yplog_date("yppasswdd: unknown user"); - yplog_line(argp->newpw.pw_name); - return(TRUE); - } - - yplog_line("get user done"); + pw = getpwnam(argp->newpw.pw_name); + if (!pw) + return (1); - if (strcmp(crypt(argp->oldpass, pw->pw_passwd), pw->pw_passwd) != 0) { - yplog_date("yppasswdd: incorrect password"); - yplog_line(argp->newpw.pw_name); - return(TRUE); - } - - yplog_line("password ok"); + if (strcmp(crypt(argp->oldpass, pw->pw_passwd), pw->pw_passwd) != 0) + return (1); pw_init(); pfd = pw_lock(); @@ -81,45 +72,26 @@ make_passwd(argp) * classes are implemented, go and get the "offset" value for this * class and reset the timer. */ - if (!(nopw)) { - pw->pw_passwd = argp->newpw.pw_passwd; - pw->pw_change = 0; - } - - if (!(nogecos)) { - pw->pw_gecos = argp->newpw.pw_gecos; - } - - if (!(noshell)) { - pw->pw_shell = argp->newpw.pw_shell; + if (!nopw) { + pw->pw_passwd = argp->newpw.pw_passwd; + pw->pw_change = 0; } - - yplog_line("before pw_copy"); + if (!nogecos) + pw->pw_gecos = argp->newpw.pw_gecos; + if (!noshell) + pw->pw_shell = argp->newpw.pw_shell; pw_copy(pfd, tfd, pw); - - yplog_line("before pw_mkdb"); - -/* - if (!pw_mkdb()) - pw_error((char *)NULL, 0, 0); -*/ pw_mkdb(); - yplog_line("before fork"); - if (fork() == 0) { - chdir("/var/yp"); - (void) umask(022); - system(make_arg); - exit(0); + chdir("/var/yp"); + (void) umask(022); + system(make_arg); + exit(0); } - - yplog_line("exit make_passwd"); - - return(FALSE); - -}; + return (0); +} /* int |