]> granicus.if.org Git - sudo/commitdiff
If the user enters ^C at the password prompt, abort instead of
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 29 Sep 2006 14:53:42 +0000 (14:53 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 29 Sep 2006 14:53:42 +0000 (14:53 +0000)
trying to authenticate with an empty password (which causes an
annoying delay).

auth/pam.c

index bace4891aded38ac1b7db4740873e5dcd0b09d06..f97341af2a66488cbf3c097a64668d48ba607c7b 100644 (file)
@@ -249,7 +249,12 @@ sudo_conv(num_msg, msg, response, appdata_ptr)
                    p = pm->msg;
                /* Read the password. */
                pass = tgetpass(p, def_passwd_timeout * 60, flags);
-               pr->resp = estrdup(pass ? pass : "");
+               if (pass == NULL) {
+                   /* We got ^C instead of a password; abort quickly. */
+                   nil_pw = 1;
+                   return(PAM_CONV_ERR);
+               }
+               pr->resp = estrdup(pass);
                if (*pr->resp == '\0')
                    nil_pw = 1;         /* empty password */
                else