version 1.59, 2021/07/12 15:09:20 |
version 1.60, 2021/08/28 06:46:49 |
|
|
savequit = signal(SIGQUIT, kbintr); |
savequit = signal(SIGQUIT, kbintr); |
|
|
if (!authenticated) { |
if (!authenticated) { |
(void)printf("Changing password for %s.\n", pw->pw_name); |
fprintf(stderr, "Changing password for %s.\n", pw->pw_name); |
if (uid != 0 && pw->pw_passwd[0] != '\0') { |
if (uid != 0 && pw->pw_passwd[0] != '\0') { |
char oldpass[1024]; |
char oldpass[1024]; |
|
|
p = readpassphrase("Old password:", oldpass, |
p = readpassphrase("Old password:", oldpass, |
sizeof(oldpass), RPP_ECHO_OFF); |
sizeof(oldpass), RPP_ECHO_OFF); |
if (p == NULL || *p == '\0') { |
if (p == NULL || *p == '\0') { |
(void)printf("%s\n", UNCHANGED_MSG); |
fprintf(stderr, "%s\n", UNCHANGED_MSG); |
pw_abort(); |
pw_abort(); |
exit(p == NULL ? 1 : 0); |
exit(p == NULL ? 1 : 0); |
} |
} |
|
|
p = readpassphrase("New password:", newpass, sizeof(newpass), |
p = readpassphrase("New password:", newpass, sizeof(newpass), |
RPP_ECHO_OFF); |
RPP_ECHO_OFF); |
if (p == NULL || *p == '\0') { |
if (p == NULL || *p == '\0') { |
(void)printf("%s\n", UNCHANGED_MSG); |
fprintf(stderr, "%s\n", UNCHANGED_MSG); |
pw_abort(); |
pw_abort(); |
exit(p == NULL ? 1 : 0); |
exit(p == NULL ? 1 : 0); |
} |
} |
if (strcmp(p, "s/key") == 0) { |
if (strcmp(p, "s/key") == 0) { |
printf("That password collides with a system feature. Choose another.\n"); |
fprintf(stderr, "That password collides with a system feature. Choose another.\n"); |
continue; |
continue; |
} |
} |
|
|
|
|
explicit_bzero(repeat, sizeof(repeat)); |
explicit_bzero(repeat, sizeof(repeat)); |
break; |
break; |
} |
} |
(void)printf("Mismatch; try again, EOF to quit.\n"); |
fprintf(stderr, "Mismatch; try again, EOF to quit.\n"); |
explicit_bzero(repeat, sizeof(repeat)); |
explicit_bzero(repeat, sizeof(repeat)); |
explicit_bzero(newpass, sizeof(newpass)); |
explicit_bzero(newpass, sizeof(newpass)); |
} |
} |
|
|
|
|
pref = login_getcapstr(lc, "localcipher", NULL, NULL); |
pref = login_getcapstr(lc, "localcipher", NULL, NULL); |
if (crypt_newhash(newpass, pref, hash, sizeof(hash)) != 0) { |
if (crypt_newhash(newpass, pref, hash, sizeof(hash)) != 0) { |
(void)printf("Couldn't generate hash.\n"); |
fprintf(stderr, "Couldn't generate hash.\n"); |
explicit_bzero(newpass, sizeof(newpass)); |
explicit_bzero(newpass, sizeof(newpass)); |
pw_error(NULL, 0, 0); |
pw_error(NULL, 0, 0); |
} |
} |