version 1.18, 2001/08/16 18:29:27 |
version 1.19, 2001/08/18 19:58:46 |
|
|
sigset_t fullset; |
sigset_t fullset; |
time_t period; |
time_t period; |
int pfd, tfd = -1; |
int pfd, tfd = -1; |
|
int secureonly = 0; |
char *s = NULL; |
char *s = NULL; |
|
|
if (!(pw = getpwnam(uname))) { |
if (!(pw = getpwnam(uname))) { |
|
|
|
|
/* Reset password change time based on login.conf. */ |
/* Reset password change time based on login.conf. */ |
period = login_getcaptime(lc, "passwordtime", 0, 0); |
period = login_getcaptime(lc, "passwordtime", 0, 0); |
if (period > 0) |
if (period > 0) { |
pw->pw_change = time(NULL) + period; |
pw->pw_change = time(NULL) + period; |
else |
} else { |
pw->pw_change = 0; |
/* |
|
* If the pw change time is the same we only need |
|
* to update the spwd.db file. |
|
*/ |
|
if (pw->pw_change != 0) |
|
pw->pw_change = 0; |
|
else |
|
secureonly = 1; |
|
} |
|
|
/* Drop user's real uid and block all signals to avoid a DoS. */ |
/* Drop user's real uid and block all signals to avoid a DoS. */ |
setuid(0); |
setuid(0); |
|
|
|
|
/* Update master.passwd file and rebuild spwd.db. */ |
/* Update master.passwd file and rebuild spwd.db. */ |
pw_copy(pfd, tfd, pw); |
pw_copy(pfd, tfd, pw); |
if (pw_mkdb(uname, 1) < 0) |
if (pw_mkdb(uname, secureonly) < 0) |
pw_error((char *)NULL, 0, 1); |
pw_error(NULL, 0, 1); |
|
|
return(0); |
return(0); |
} |
} |