Imported Upstream version 1.7.0
[debian/sudo] / auth / bsdauth.c
index a881bf93795e12093713a57cc0a269fb34bf2b27..aae7fd6899141861b9eadfef1b81c897ae571a09 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2005 Todd C. Miller <Todd.Miller@courtesan.com>
+ * Copyright (c) 2000-2005, 2007-2008 Todd C. Miller <Todd.Miller@courtesan.com>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -52,7 +52,7 @@
 #include "sudo_auth.h"
 
 #ifndef lint
-__unused static const char rcsid[] = "$Sudo: bsdauth.c,v 1.16.2.2 2007/06/12 01:28:42 millert Exp $";
+__unused static const char rcsid[] = "$Sudo: bsdauth.c,v 1.23 2008/11/09 14:13:13 millert Exp $";
 #endif /* lint */
 
 extern char *login_style;              /* from sudo.c */
@@ -88,7 +88,7 @@ bsdauth_init(pw, promptp, auth)
        return(AUTH_FATAL);
     }
 
-    auth->data = (VOID *) as;
+    auth->data = (void *) as;
     return(AUTH_SUCCESS);
 }
 
@@ -104,7 +104,6 @@ bsdauth_verify(pw, prompt, auth)
     int authok = 0;
     sigaction_t sa, osa;
     auth_session_t *as = (auth_session_t *) auth->data;
-    extern int nil_pw;
 
     /* save old signal handler */
     sigemptyset(&sa.sa_mask);
@@ -142,11 +141,8 @@ bsdauth_verify(pw, prompt, auth)
        }
     }
 
-    if (!pass || *pass == '\0')                /* ^C or empty password */
-       nil_pw = 1;
-
     if (pass) {
-       authok = auth_userresponse(as, (char *)pass, 1);
+       authok = auth_userresponse(as, pass, 1);
        zero_bytes(pass, strlen(pass));
     }
 
@@ -156,6 +152,9 @@ bsdauth_verify(pw, prompt, auth)
     if (authok)
        return(AUTH_SUCCESS);
 
+    if (!pass)
+       return(AUTH_INTR);
+
     if ((s = auth_getvalue(as, "errormsg")) != NULL)
        log_error(NO_EXIT|NO_MAIL, "%s", s);
     return(AUTH_FAILURE);