version 1.32, 2004/04/20 23:21:23 |
version 1.33, 2004/07/13 21:09:48 |
|
|
#define UNCHANGED_MSG "Password unchanged.\n" |
#define UNCHANGED_MSG "Password unchanged.\n" |
|
|
static uid_t uid; |
static uid_t uid; |
extern int pwd_gensalt(char *, int, struct passwd *, login_cap_t *, char); |
extern int pwd_gensalt(char *, int, login_cap_t *, char); |
extern int pwd_check(struct passwd *, login_cap_t *, char *); |
extern int pwd_check(login_cap_t *, char *); |
extern int pwd_gettries(struct passwd *, login_cap_t *); |
extern int pwd_gettries(login_cap_t *); |
|
|
char *getnewpasswd(struct passwd *, login_cap_t *, int); |
char *getnewpasswd(struct passwd *, login_cap_t *, int); |
void kbintr(int); |
void kbintr(int); |
|
|
} |
} |
} |
} |
|
|
pwd_tries = pwd_gettries(pw, lc); |
pwd_tries = pwd_gettries(lc); |
|
|
for (buf[0] = '\0', tries = 0;;) { |
for (buf[0] = '\0', tries = 0;;) { |
p = getpass("New password:"); |
p = getpass("New password:"); |
|
|
} |
} |
|
|
if ((tries++ < pwd_tries || pwd_tries == 0) |
if ((tries++ < pwd_tries || pwd_tries == 0) |
&& pwd_check(pw, lc, p) == 0) |
&& pwd_check(lc, p) == 0) |
continue; |
continue; |
strlcpy(buf, p, sizeof(buf)); |
strlcpy(buf, p, sizeof(buf)); |
p = getpass("Retype new password:"); |
p = getpass("Retype new password:"); |
|
|
break; |
break; |
(void)printf("Mismatch; try again, EOF to quit.\n"); |
(void)printf("Mismatch; try again, EOF to quit.\n"); |
} |
} |
if (!pwd_gensalt(salt, _PASSWORD_LEN, pw, lc, 'l')) { |
if (!pwd_gensalt(salt, _PASSWORD_LEN, lc, 'l')) { |
(void)printf("Couldn't generate salt.\n"); |
(void)printf("Couldn't generate salt.\n"); |
pw_error(NULL, 0, 0); |
pw_error(NULL, 0, 0); |
} |
} |