Imported Upstream version 1.8.7
[debian/sudo] / plugins / sudoers / auth / sia.c
index 20d0c14aa70008f245fe5e9ca63003ec5bde5706..c6050ca0ba8b2e5b8a0f116e0fa7ca2390f77f51 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999-2005, 2007, 2010-2011
+ * Copyright (c) 1999-2005, 2007, 2010-2013
  *     Todd C. Miller <Todd.Miller@courtesan.com>
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -24,7 +24,6 @@
 #include <config.h>
 
 #include <sys/types.h>
-#include <sys/param.h>
 #include <stdio.h>
 #ifdef STDC_HEADERS
 # include <stdlib.h>
@@ -63,6 +62,8 @@ static int
 sudo_collect(int timeout, int rendition, uchar_t *title, int nprompts,
     prompt_t *prompts)
 {
+    debug_decl(sudo_collect, SUDO_DEBUG_AUTH)
+
     switch (rendition) {
        case SIAFORM:
        case SIAONELINER:
@@ -81,16 +82,17 @@ sudo_collect(int timeout, int rendition, uchar_t *title, int nprompts,
            break;
     }
 
-    return sia_collect_trm(timeout, rendition, title, nprompts, prompts);
+    debug_return_int(sia_collect_trm(timeout, rendition, title, nprompts, prompts));
 }
 
 int
-sia_setup(struct passwd *pw, char **promptp, sudo_auth *auth)
+sudo_sia_setup(struct passwd *pw, char **promptp, sudo_auth *auth)
 {
     SIAENTITY *siah = NULL;
     int i;
     extern int NewArgc;
     extern char **NewArgv;
+    debug_decl(sudo_sia_setup, SUDO_DEBUG_AUTH)
 
     /* Rebuild argv for sia_ses_init() */
     sudo_argc = NewArgc + 1;
@@ -102,35 +104,37 @@ sia_setup(struct passwd *pw, char **promptp, sudo_auth *auth)
 
     if (sia_ses_init(&siah, sudo_argc, sudo_argv, NULL, pw->pw_name, user_ttypath, 1, NULL) != SIASUCCESS) {
 
-       log_error(USE_ERRNO|NO_EXIT|NO_MAIL,
-           _("unable to initialize SIA session"));
-       return AUTH_FATAL;
+       log_warning(USE_ERRNO|NO_MAIL,
+           N_("unable to initialize SIA session"));
+       debug_return_int(AUTH_FATAL);
     }
 
     auth->data = (void *) siah;
-    return AUTH_SUCCESS;
+    debug_return_int(AUTH_SUCCESS);
 }
 
 int
-sia_verify(struct passwd *pw, char *prompt, sudo_auth *auth)
+sudo_sia_verify(struct passwd *pw, char *prompt, sudo_auth *auth)
 {
     SIAENTITY *siah = (SIAENTITY *) auth->data;
+    debug_decl(sudo_sia_verify, SUDO_DEBUG_AUTH)
 
     def_prompt = prompt;               /* for sudo_collect */
 
     /* XXX - need a way to detect user hitting return or EOF at prompt */
     if (sia_ses_reauthent(sudo_collect, siah) == SIASUCCESS)
-       return AUTH_SUCCESS;
+       debug_return_int(AUTH_SUCCESS);
     else
-       return AUTH_FAILURE;
+       debug_return_int(AUTH_FAILURE);
 }
 
 int
-sia_cleanup(struct passwd *pw, sudo_auth *auth)
+sudo_sia_cleanup(struct passwd *pw, sudo_auth *auth)
 {
     SIAENTITY *siah = (SIAENTITY *) auth->data;
+    debug_decl(sudo_sia_cleanup, SUDO_DEBUG_AUTH)
 
     (void) sia_ses_release(&siah);
     efree(sudo_argv);
-    return AUTH_SUCCESS;
+    debug_return_int(AUTH_SUCCESS);
 }