summaryrefslogtreecommitdiffstats
path: root/source3/auth/pass_check.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-08-21 14:52:16 +0200
committerVolker Lendecke <vl@samba.org>2010-08-28 11:12:13 +0200
commita3995ef31cfbd798921bf5fd34721b4251e173be (patch)
tree6006b9379280018503966dd573f3bd63542c1041 /source3/auth/pass_check.c
parent2257a0cd86cf9bf187b08066b21db948709dd95d (diff)
downloadsamba-a3995ef31cfbd798921bf5fd34721b4251e173be.tar.gz
samba-a3995ef31cfbd798921bf5fd34721b4251e173be.tar.xz
samba-a3995ef31cfbd798921bf5fd34721b4251e173be.zip
s3: Lift smbd_server_fd() from password_check()
Diffstat (limited to 'source3/auth/pass_check.c')
-rw-r--r--source3/auth/pass_check.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/source3/auth/pass_check.c b/source3/auth/pass_check.c
index 4153cfed95e..80e7da91df4 100644
--- a/source3/auth/pass_check.c
+++ b/source3/auth/pass_check.c
@@ -553,13 +553,7 @@ core of password checking routine
static NTSTATUS password_check(const char *password, void *private_data)
{
#ifdef WITH_PAM
- 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));
-
+ const char *rhost = (const char *)private_data;
return smb_pam_passcheck(get_this_user(), rhost, password);
#else
@@ -674,6 +668,13 @@ NTSTATUS pass_check(const struct passwd *pass,
NTSTATUS nt_status;
+ 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));
+
#ifdef DEBUG_PASSWORD
DEBUG(100, ("checking user=[%s] pass=[%s]\n", user, password));
#endif
@@ -837,7 +838,7 @@ NTSTATUS pass_check(const struct passwd *pass,
#endif /* defined(WITH_PAM) */
/* try it as it came to us */
- nt_status = password_check(password, NULL);
+ nt_status = password_check(password, (void *)rhost);
if NT_STATUS_IS_OK(nt_status) {
return (nt_status);
} else if (!NT_STATUS_EQUAL(nt_status, NT_STATUS_WRONG_PASSWORD)) {
@@ -865,8 +866,8 @@ NTSTATUS pass_check(const struct passwd *pass,
/* try all lowercase if it's currently all uppercase */
if (strhasupper(pass2)) {
strlower_m(pass2);
- nt_status = password_check(pass2, NULL);
- if NT_STATUS_IS_OK(nt_status) {
+ nt_status = password_check(pass2, (void *)rhost);
+ if (NT_STATUS_IS_OK(nt_status)) {
return (nt_status);
}
}
@@ -879,7 +880,8 @@ NTSTATUS pass_check(const struct passwd *pass,
/* last chance - all combinations of up to level chars upper! */
strlower_m(pass2);
- nt_status = string_combinations(pass2, password_check, level, NULL);
+ nt_status = string_combinations(pass2, password_check, level,
+ (void *)rhost);
if (NT_STATUS_IS_OK(nt_status)) {
return nt_status;
}