#ifndef LINUX
#if defined(HAVE_SECURITY_PAM_APPL_H)
#include <security/pam_appl.h>
#elif defined(HAVE_PAM_PAM_APPL_H)
#include <pam/pam_appl.h>
#endif
#endif
#if defined(HAVE_SECURITY_PAM_MODULES_H)
#include <security/pam_modules.h>
#elif defined(HAVE_PAM_PAM_MODULES_H)
#include <pam/pam_modules.h>
#endif
#ifndef PAM_AUTHTOK_RECOVER_ERR
#define PAM_AUTHTOK_RECOVER_ERR PAM_AUTHTOK_RECOVERY_ERR
#endif
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#define MISTYPED_PASS "Sorry, passwords do not match"
typedef struct {
const char *token;
unsigned int mask;
unsigned int flag;
} SMB_Ctrls;
#ifndef False
#define False (0)
#endif
#ifndef True
#define True (1)
#endif
#define on(x,ctrl) (smb_args[x].flag & ctrl)
#define off(x,ctrl) (!on(x,ctrl))
#define set(x,ctrl) (ctrl = ((ctrl)&smb_args[x].mask)|smb_args[x].flag)
#define unset(x,ctrl) (ctrl &= ~(smb_args[x].flag))
#ifndef __linux__
#define strncasecmp(s1,s2,n) StrnCaseCmp(s1,s2,n)
#endif
#define _ALL_ON_ (~0U)
#define SMB__OLD_PASSWD 0
#define SMB__VERIFY_PASSWD 1
#define SMB_AUDIT 2
#define SMB_USE_FIRST_PASS 3
#define SMB_TRY_FIRST_PASS 4
#define SMB_NOT_SET_PASS 5
#define SMB__NONULL 6
#define SMB__QUIET 7
#define SMB_USE_AUTHTOK 8
#define SMB__NULLOK 9
#define SMB_DEBUG 10
#define SMB_NODELAY 11
#define SMB_MIGRATE 12
#define SMB_CONF_FILE 13
#define SMB_CTRLS_ 14
static const SMB_Ctrls smb_args[SMB_CTRLS_] = {
{ NULL, _ALL_ON_, 01 },
{ NULL, _ALL_ON_, 02 },
{ "audit", _ALL_ON_, 04 },
{ "use_first_pass", _ALL_ON_^(030), 010 },
{ "try_first_pass", _ALL_ON_^(030), 020 },
{ "not_set_pass", _ALL_ON_, 040 },
{ "nonull", _ALL_ON_, 0100 },
{ NULL, _ALL_ON_, 0200 },
{ "use_authtok", _ALL_ON_, 0400 },
{ "nullok", _ALL_ON_^(0100), 0 },
{ "debug", _ALL_ON_, 01000 },
{ "nodelay", _ALL_ON_, 02000 },
{ "migrate", _ALL_ON_^(0100), 04000 },
{ "smbconf=", _ALL_ON_, 0 },
};
#define SMB_DEFAULTS (smb_args[SMB__NONULL].flag)
#define FAIL_PREFIX "-SMB-FAIL-"
#define SMB_MAX_RETRIES 3
struct _pam_failed_auth {
char *user;
int id;
char *agent;
int count;
};
int make_remark(pam_handle_t *, unsigned int, int, const char *);