From efd31890b5ed496a5a00c08a262da240e66a4ddc Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Thu, 3 Jan 2019 12:44:11 -0800 Subject: New upstream version 0.76 --- Linux-PAM/modules/pam_debug/pam_debug.c | 175 ++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 Linux-PAM/modules/pam_debug/pam_debug.c (limited to 'Linux-PAM/modules/pam_debug/pam_debug.c') diff --git a/Linux-PAM/modules/pam_debug/pam_debug.c b/Linux-PAM/modules/pam_debug/pam_debug.c new file mode 100644 index 00000000..6226c829 --- /dev/null +++ b/Linux-PAM/modules/pam_debug/pam_debug.c @@ -0,0 +1,175 @@ +/* pam_permit module */ + +/* + * $Id: pam_debug.c,v 1.1.1.1 2002/09/15 20:08:45 hartmans Exp $ + * + * Written by Andrew Morgan 2001/02/04 + * + */ + +#define DEFAULT_USER "nobody" + +#include + +/* + * This module is intended as a debugging aide for determining how + * the PAM stack is operating. + * + * here, we make definitions for the externally accessible functions + * in this file (these definitions are required for static modules + * but strongly encouraged generally) they are used to instruct the + * modules include file to define their prototypes. + */ + +#define PAM_SM_AUTH +#define PAM_SM_ACCOUNT +#define PAM_SM_SESSION +#define PAM_SM_PASSWORD + +#include +#include + +#define _PAM_ACTION_UNDEF (-10) +#include "../../libpam/pam_tokens.h" + +/* --- authentication management functions --- */ + +static int state(pam_handle_t *pamh, const char *text) +{ + int retval; + struct pam_conv *conv; + struct pam_message msg[1], *mesg[1]; + struct pam_response *response; + + retval = pam_get_item(pamh, PAM_CONV, (const void **)&conv); + if ((retval != PAM_SUCCESS) || (conv == NULL)) { + D(("failed to obtain conversation function")); + return PAM_ABORT; + } + + msg[0].msg_style = PAM_TEXT_INFO; + msg[0].msg = text; + mesg[0] = &msg[0]; + + retval = conv->conv(1, (const struct pam_message **) mesg, + &response, conv->appdata_ptr); + if (retval != PAM_SUCCESS) { + D(("conversation failed")); + } + + return retval; +} + +static int parse_args(int retval, const char *event, + pam_handle_t *pamh, int argc, const char **argv) +{ + int i; + + for (i=0; i