s3: Lift smbd_server_fd() from smb_pam_passcheck
authorVolker Lendecke <vl@samba.org>
Sat, 21 Aug 2010 12:41:01 +0000 (14:41 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 27 Aug 2010 19:59:09 +0000 (21:59 +0200)
source3/auth/pampass.c
source3/auth/pass_check.c
source3/include/proto.h

index 2f8c4cc416e41e44c247c10e1a44d2174ffaa54d..7c09c1630a8fabf414c6b62d87251074df77af8a 100644 (file)
@@ -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;
 
index 594376127779d02eab58a10a863a71e6ae23dd10..a4bc6b509c0a2f62b02c202583281bd78f6c7023 100644 (file)
@@ -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;
index 1cafe9babc16ade44de586f3e42f2361d77e35a9..7d1655916b986219133237a1c599ddfdbca89d31 100644 (file)
@@ -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);