mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-13 18:12:03 +08:00
Ask the password twice to avoid mistakes.
This commit is contained in:
@@ -310,11 +310,25 @@ int main(int argc, char **argv)
|
|||||||
else if (HAVE_OPT(UNLOCK))
|
else if (HAVE_OPT(UNLOCK))
|
||||||
unlock_user(fpasswd, username);
|
unlock_user(fpasswd, username);
|
||||||
else { /* set password */
|
else { /* set password */
|
||||||
|
char* p2;
|
||||||
|
|
||||||
passwd = getpass("Enter password: ");
|
passwd = getpass("Enter password: ");
|
||||||
if (passwd == NULL) {
|
if (passwd == NULL) {
|
||||||
fprintf(stderr, "Please specify a password\n");
|
fprintf(stderr, "Please specify a password\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
p2 = strdup(passwd);
|
||||||
|
passwd = getpass("Re-enter password: ");
|
||||||
|
if (passwd == NULL) {
|
||||||
|
fprintf(stderr, "Please specify a password\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p2 == NULL || strcmp(passwd, p2) != 0) {
|
||||||
|
fprintf(stderr, "Passwords do not match\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
free(p2);
|
||||||
|
|
||||||
crypt_int(fpasswd, username, groupname, passwd);
|
crypt_int(fpasswd, username, groupname, passwd);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user