summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/auth/pampass.c9
-rw-r--r--source3/auth/pass_check.c9
-rw-r--r--source3/include/proto.h3
3 files changed, 12 insertions, 9 deletions
diff --git a/source3/auth/pampass.c b/source3/auth/pampass.c
index 2f8c4cc416..7c09c1630a 100644
--- a/source3/auth/pampass.c
+++ b/source3/auth/pampass.c
@@ -806,13 +806,12 @@ NTSTATUS smb_pam_accountcheck(const char *user, const char *rhost)
* PAM Password Validation Suite
*/
-NTSTATUS smb_pam_passcheck(const char * user, const char * password)
+NTSTATUS smb_pam_passcheck(const char * user, const char * password,
+ const char * rhost)
{
pam_handle_t *pamh = NULL;
NTSTATUS nt_status = NT_STATUS_LOGON_FAILURE;
struct pam_conv *pconv = NULL;
- const char *rhost;
- char addr[INET6_ADDRSTRLEN];
/*
* Note we can't ignore PAM here as this is the only
@@ -823,10 +822,6 @@ NTSTATUS smb_pam_passcheck(const char * user, const char * password)
if ((pconv = smb_setup_pam_conv(smb_pam_conv, user, password, NULL)) == NULL)
return NT_STATUS_LOGON_FAILURE;
- rhost = client_name(smbd_server_fd());
- if (strequal(rhost,"UNKNOWN"))
- rhost = client_addr(smbd_server_fd(), addr, sizeof(addr));
-
if (!smb_pam_start(&pamh, user, rhost, pconv))
return NT_STATUS_LOGON_FAILURE;
diff --git a/source3/auth/pass_check.c b/source3/auth/pass_check.c
index 5943761277..a4bc6b509c 100644
--- a/source3/auth/pass_check.c
+++ b/source3/auth/pass_check.c
@@ -553,7 +553,14 @@ core of password checking routine
static NTSTATUS password_check(const char *password, void *private_data)
{
#ifdef WITH_PAM
- return smb_pam_passcheck(get_this_user(), password);
+ const char *rhost;
+ char addr[INET6_ADDRSTRLEN];
+
+ rhost = client_name(smbd_server_fd());
+ if (strequal(rhost,"UNKNOWN"))
+ rhost = client_addr(smbd_server_fd(), addr, sizeof(addr));
+
+ return smb_pam_passcheck(get_this_user(), rhost, password);
#else
bool ret;
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 1cafe9babc..7d1655916b 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -222,7 +222,8 @@ NTSTATUS auth_wbc_init(void);
bool smb_pam_claim_session(char *user, char *tty, char *rhost);
bool smb_pam_close_session(char *user, char *tty, char *rhost);
NTSTATUS smb_pam_accountcheck(const char *user, const char *rhost);
-NTSTATUS smb_pam_passcheck(const char * user, const char * password);
+NTSTATUS smb_pam_passcheck(const char * user, const char * password,
+ const char * rhost);
bool smb_pam_passchange(const char *user, const char *rhost,
const char *oldpassword, const char *newpassword);
bool smb_pam_claim_session(char *user, char *tty, char *rhost);