diff options
Diffstat (limited to 'Linux-PAM/libpam/pam_item.c')
-rw-r--r-- | Linux-PAM/libpam/pam_item.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Linux-PAM/libpam/pam_item.c b/Linux-PAM/libpam/pam_item.c index 3dcbf616..1425c600 100644 --- a/Linux-PAM/libpam/pam_item.c +++ b/Linux-PAM/libpam/pam_item.c @@ -1,16 +1,16 @@ /* pam_item.c */ /* - * $Id: pam_item.c,v 1.1.1.1 2001/04/29 04:17:06 hartmans Exp $ + * $Id: pam_item.c,v 1.5 2004/09/22 09:37:47 kukuk Exp $ */ +#include "pam_private.h" + #include <ctype.h> #include <stdlib.h> #include <string.h> #include <syslog.h> -#include "pam_private.h" - #define RESET(X, Y) \ { \ char *_TMP_ = (X); \ @@ -158,6 +158,8 @@ int pam_get_item (const pam_handle_t *pamh, int item_type, const void **item) "pam_get_item: nowhere to place requested item"); return PAM_PERM_DENIED; } + else + *item = NULL; switch (item_type) { case PAM_SERVICE: @@ -238,6 +240,12 @@ int pam_get_user(pam_handle_t *pamh, const char **user, const char *prompt) struct pam_response *resp; D(("called.")); + if (user == NULL) { /* ensure that the module has supplied a destination */ + _pam_system_log(LOG_ERR, "pam_get_user: nowhere to record username"); + return PAM_PERM_DENIED; + } else + *user = NULL; + IF_NO_PAMH("pam_get_user", pamh, PAM_SYSTEM_ERR); if (pamh->pam_conversation == NULL) { @@ -245,12 +253,6 @@ int pam_get_user(pam_handle_t *pamh, const char **user, const char *prompt) return PAM_SERVICE_ERR; } - if (user == NULL) { /* ensure the the module has suplied a destination */ - _pam_system_log(LOG_ERR, "pam_get_user: nowhere to record username"); - return PAM_PERM_DENIED; - } else - *user = NULL; - if (pamh->user) { /* have one so return it */ *user = pamh->user; return PAM_SUCCESS; |