s3-auth: Remove global smbd_server_conn from auth_unix.c.
authorAndreas Schneider <asn@samba.org>
Wed, 15 Jun 2011 09:32:12 +0000 (11:32 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 4 Jul 2011 08:28:04 +0000 (18:28 +1000)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
source3/auth/auth_unix.c

index 36956986c595b40badcc867e295ffa75337ac48f..f0a5215dd7beb2381f86b34016966990fc630ae8 100644 (file)
@@ -20,7 +20,7 @@
 #include "includes.h"
 #include "auth.h"
 #include "system/passwd.h"
-#include "smbd/globals.h"
+#include "../lib/tsocket/tsocket.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_AUTH
@@ -39,9 +39,17 @@ static NTSTATUS check_unix_security(const struct auth_context *auth_context,
 {
        NTSTATUS nt_status;
        struct passwd *pass = NULL;
+       char *rhost;
+       int rc;
 
        DEBUG(10, ("Check auth for: [%s]\n", user_info->mapped.account_name));
 
+       rhost = tsocket_address_inet_addr_string(user_info->remote_host,
+                                                talloc_tos());
+       if (rhost == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
        become_root();
        pass = Get_Pwnam_alloc(talloc_tos(), user_info->mapped.account_name);
 
@@ -49,7 +57,7 @@ static NTSTATUS check_unix_security(const struct auth_context *auth_context,
            done.  We may need to revisit this **/
        nt_status = pass_check(pass,
                                pass ? pass->pw_name : user_info->mapped.account_name,
-                              smbd_server_conn->client_id.name,
+                               rhost,
                                user_info->password.plaintext,
                                true);