--- embedaddon/sudo/plugins/sudoers/auth/securid5.c 2012/02/21 16:23:02 1.1 +++ embedaddon/sudo/plugins/sudoers/auth/securid5.c 2013/07/22 10:46:12 1.1.1.3 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2005, 2007, 2010-2011 + * Copyright (c) 1999-2005, 2007, 2010-2012 * Todd C. Miller * Copyright (c) 2002 Michael Stroucken * @@ -26,7 +26,6 @@ #include #include -#include #include #ifdef STDC_HEADERS # include @@ -67,18 +66,19 @@ * success. */ int -securid_init(struct passwd *pw, sudo_auth *auth) +sudo_securid_init(struct passwd *pw, sudo_auth *auth) { static SDI_HANDLE sd_dat; /* SecurID handle */ + debug_decl(sudo_securid_init, SUDO_DEBUG_AUTH) auth->data = (void *) &sd_dat; /* For method-specific data */ /* Start communications */ if (AceInitialize() != SD_FALSE) - return AUTH_SUCCESS; + debug_return_int(AUTH_SUCCESS); warningx(_("failed to initialise the ACE API library")); - return AUTH_FATAL; + debug_return_int(AUTH_FATAL); } /* @@ -95,15 +95,16 @@ securid_init(struct passwd *pw, sudo_auth *auth) * otherwise */ int -securid_setup(struct passwd *pw, char **promptp, sudo_auth *auth) +sudo_securid_setup(struct passwd *pw, char **promptp, sudo_auth *auth) { SDI_HANDLE *sd = (SDI_HANDLE *) auth->data; int retval; + debug_decl(sudo_securid_setup, SUDO_DEBUG_AUTH) /* Re-initialize SecurID every time. */ if (SD_Init(sd) != ACM_OK) { warningx(_("unable to contact the SecurID server")); - return AUTH_FATAL; + debug_return_int(AUTH_FATAL); } /* Lock new PIN code */ @@ -112,23 +113,23 @@ securid_setup(struct passwd *pw, char **promptp, sudo_ switch (retval) { case ACM_OK: warningx(_("User ID locked for SecurID Authentication")); - return AUTH_SUCCESS; + debug_return_int(AUTH_SUCCESS); case ACE_UNDEFINED_USERNAME: warningx(_("invalid username length for SecurID")); - return AUTH_FATAL; + debug_return_int(AUTH_FATAL); case ACE_ERR_INVALID_HANDLE: warningx(_("invalid Authentication Handle for SecurID")); - return AUTH_FATAL; + debug_return_int(AUTH_FATAL); case ACM_ACCESS_DENIED: warningx(_("SecurID communication failed")); - return AUTH_FATAL; + debug_return_int(AUTH_FATAL); default: warningx(_("unknown SecurID error")); - return AUTH_FATAL; + debug_return_int(AUTH_FATAL); } } @@ -145,10 +146,11 @@ securid_setup(struct passwd *pw, char **promptp, sudo_ * incorrect authentication, fatal on errors */ int -securid_verify(struct passwd *pw, char *pass, sudo_auth *auth) +sudo_securid_verify(struct passwd *pw, char *pass, sudo_auth *auth) { SDI_HANDLE *sd = (SDI_HANDLE *) auth->data; int rval; + debug_decl(sudo_securid_verify, SUDO_DEBUG_AUTH) pass = auth_getpass("Enter your PASSCODE: ", def_passwd_timeout * 60, SUDO_CONV_PROMPT_ECHO_OFF); @@ -218,5 +220,5 @@ then enter the new token code.\n", \ SD_Close(*sd); /* Return stored state to calling process */ - return rval; + debug_return_int(rval); }