#define PAM_SM_AUTH
#include "includes.h"
-#include "debug.h"
+#include "lib/util/debug.h"
#ifndef LINUX
#include "support.h"
+static void ret_data_cleanup(pam_handle_t *pamh, void *data, int error_status)
+{
+ free(data);
+}
+
#define AUTH_RETURN \
do { \
/* Restore application signal handler */ \
CatchSignal(SIGPIPE, oldsig_handler); \
if(ret_data) { \
*ret_data = retval; \
- pam_set_data( pamh, "smb_setcred_return" \
- , (void *) ret_data, NULL ); \
+ pam_set_data(pamh, \
+ "smb_setcred_return", \
+ (void *)ret_data, \
+ ret_data_cleanup); \
} \
+ TALLOC_FREE(frame); \
return retval; \
} while (0)
const char *name;
void (*oldsig_handler)(int) = NULL;
bool found;
+ TALLOC_CTX *frame = talloc_stackframe();
/* Points to memory managed by the PAM library. Do not free. */
char *p = NULL;
/* Samba initialization. */
- load_case_tables();
- lp_set_in_client(True);
ctrl = set_ctrl(pamh, flags, argc, argv);
char *msg_str = NULL;
const char *pass = NULL;
int retval;
+ TALLOC_CTX *frame = talloc_stackframe();
/* Get the authtok; if we don't have one, silently fail. */
retval = _pam_get_item( pamh, PAM_AUTHTOK, &pass );
if (retval != PAM_SUCCESS) {
_log_err(pamh, LOG_ALERT
, "pam_get_item returned error to pam_sm_authenticate" );
- return PAM_AUTHTOK_RECOVER_ERR;
- } else if (pass == NULL) {
+ TALLOC_FREE(frame);
return PAM_AUTHTOK_RECOVER_ERR;
}
SAFE_FREE(err_str);
SAFE_FREE(msg_str);
+ TALLOC_FREE(frame);
return PAM_IGNORE;
} else {
/* mimick 'update encrypted' as long as the 'no pw req' flag is not set */
SAFE_FREE(err_str);
SAFE_FREE(msg_str);
pass = NULL;
+ TALLOC_FREE(frame);
return PAM_IGNORE;
}