version 1.27, 2004/03/12 22:59:28 |
version 1.28, 2004/07/13 21:09:48 |
|
|
#define _PASSWORD_LEN PASS_MAX |
#define _PASSWORD_LEN PASS_MAX |
#endif |
#endif |
|
|
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 *); |
extern void kbintr(int); |
extern void kbintr(int); |
|
|
char *ypgetnewpasswd(struct passwd *, login_cap_t *, char **); |
char *ypgetnewpasswd(struct passwd *, login_cap_t *, char **); |
|
|
pw_error(NULL, 1, 1); |
pw_error(NULL, 1, 1); |
} |
} |
|
|
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:"); |
|
|
continue; |
continue; |
} |
} |
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, 'y')) { |
if (!pwd_gensalt(salt, _PASSWORD_LEN, lc, 'y')) { |
(void)printf("Couldn't generate salt.\n"); |
(void)printf("Couldn't generate salt.\n"); |
pw_error(NULL, 0, 0); |
pw_error(NULL, 0, 0); |
} |
} |