From: Todd C. Miller Date: Sat, 22 Nov 2008 18:17:44 +0000 (+0000) Subject: MacOS pam will retry conversation function if it fails so just treat X-Git-Tag: SUDO_1_7_0~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c3d3db62f428d924c42bbaaa98d819eb70feb784;p=sudo MacOS pam will retry conversation function if it fails so just treat ^C as an empty password. --- diff --git a/auth/pam.c b/auth/pam.c index 1f421a372..d6ba2df54 100644 --- a/auth/pam.c +++ b/auth/pam.c @@ -45,6 +45,7 @@ # include #endif /* HAVE_UNISTD_H */ #include +#include #ifdef HAVE_PAM_PAM_APPL_H # include @@ -286,12 +287,17 @@ sudo_conv(num_msg, msg, response, appdata_ptr) && (pm->msg[9] != ' ' || pm->msg[10] != '\0')))) prompt = pm->msg; #endif - /* Read the password. */ + /* Read the password unless interrupted. */ pass = tgetpass(prompt, def_passwd_timeout * 60, flags); if (pass == NULL) { /* We got ^C instead of a password; abort quickly. */ - gotintr = 1; + if (errno == EINTR) + gotintr = 1; +#if defined(__darwin__) || defined(__APPLE__) + pass = ""; +#else goto err; +#endif } pr->resp = estrdup(pass); zero_bytes(pass, strlen(pass));