For non-standalone auth methods, stop reading the password if the

user enters ^C at the prompt.
This commit is contained in:
Todd C. Miller
2010-08-06 17:16:57 -04:00
parent 96cb890d53
commit d2cc4740c1

View File

@@ -180,13 +180,17 @@ verify_user(struct passwd *pw, char *prompt)
} }
/* Get the password unless the auth function will do it for us */ /* Get the password unless the auth function will do it for us */
if (standalone) if (standalone) {
p = prompt; p = prompt;
else } else {
p = auth_getpass(prompt, def_passwd_timeout * 60, SUDO_CONV_PROMPT_ECHO_OFF); p = auth_getpass(prompt, def_passwd_timeout * 60,
SUDO_CONV_PROMPT_ECHO_OFF);
if (p == NULL)
break;
}
/* Call authentication functions. */ /* Call authentication functions. */
for (auth = auth_switch; p && auth->name; auth++) { for (auth = auth_switch; auth->name; auth++) {
if (IS_DISABLED(auth)) if (IS_DISABLED(auth))
continue; continue;
@@ -201,7 +205,7 @@ verify_user(struct passwd *pw, char *prompt)
if (auth->status != AUTH_FAILURE) if (auth->status != AUTH_FAILURE)
goto cleanup; goto cleanup;
} }
if (!standalone && p != NULL) if (!standalone)
zero_bytes(p, strlen(p)); zero_bytes(p, strlen(p));
pass_warn(); pass_warn();
} }