1
0
mirror of https://github.com/Yubico/yubico-pam.git synced 2025-02-27 06:54:15 +01:00

Support debugging even on non-Linux.

This commit is contained in:
Simon Josefsson 2009-01-13 11:10:16 +00:00
parent 4711cf7c12
commit fc87a76136

View File

@ -56,11 +56,17 @@
#include <security/pam_modules.h> #include <security/pam_modules.h>
#endif #endif
#if defined(DEBUG_PAM) && defined(HAVE_SECURITY__PAM_MACROS_H) #if defined(DEBUG_PAM)
#define DEBUG # if defined(HAVE_SECURITY__PAM_MACROS_H)
#include <security/_pam_macros.h> # define DEBUG
#else # include <security/_pam_macros.h>
#define D(x) /* nothing */ # else
# define D(x) do { \
printf ("debug: %s:%d (%s): ", __FILE__, __LINE__, __FUNCTION__); \
printf x; \
printf ("\n"); \
} while (0)
# endif
#endif #endif
#include <libykclient.h> #include <libykclient.h>
@ -224,7 +230,7 @@ pam_sm_authenticate (pam_handle_t * pamh,
D (("id=%d", id)); D (("id=%d", id));
D (("debug=%d", debug)); D (("debug=%d", debug));
D (("alwaysok=%d", alwaysok)); D (("alwaysok=%d", alwaysok));
D (("authfile=%s", auth_file)); D (("authfile=%s", auth_file ? auth_file : "(null)"));
} }
retval = pam_get_user (pamh, &user, NULL); retval = pam_get_user (pamh, &user, NULL);
@ -395,9 +401,9 @@ done:
D (("alwaysok needed (otherwise return with %d)", retval)); D (("alwaysok needed (otherwise return with %d)", retval));
retval = PAM_SUCCESS; retval = PAM_SUCCESS;
} }
pam_set_data (pamh, "yubico_setcred_return", (void *) retval, NULL);
if (debug) if (debug)
D (("done. [%s]", pam_strerror (pamh, retval))); D (("done. [%s]", pam_strerror (pamh, retval)));
pam_set_data (pamh, "yubico_setcred_return", (void *) retval, NULL);
return retval; return retval;
} }