mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 16:57:00 +08:00
only ask to verify password in interactive mode
This commit is contained in:
@@ -309,25 +309,29 @@ int main(int argc, char **argv)
|
||||
else if (HAVE_OPT(UNLOCK))
|
||||
unlock_user(fpasswd, username);
|
||||
else { /* set password */
|
||||
char* p2;
|
||||
|
||||
passwd = getpass("Enter password: ");
|
||||
if (passwd == NULL) {
|
||||
fprintf(stderr, "Please specify a password\n");
|
||||
exit(1);
|
||||
}
|
||||
p2 = strdup(passwd);
|
||||
passwd = getpass("Re-enter password: ");
|
||||
if (passwd == NULL) {
|
||||
fprintf(stderr, "Please specify a password\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (p2 == NULL || strcmp(passwd, p2) != 0) {
|
||||
fprintf(stderr, "Passwords do not match\n");
|
||||
exit(1);
|
||||
if (isatty(STDIN_FILENO)) {
|
||||
char* p2;
|
||||
|
||||
p2 = strdup(passwd);
|
||||
passwd = getpass("Re-enter password: ");
|
||||
if (passwd == NULL) {
|
||||
fprintf(stderr, "Please specify a password\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (p2 == NULL || strcmp(passwd, p2) != 0) {
|
||||
fprintf(stderr, "Passwords do not match\n");
|
||||
exit(1);
|
||||
}
|
||||
free(p2);
|
||||
}
|
||||
free(p2);
|
||||
|
||||
crypt_int(fpasswd, username, groupname, passwd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user