s3-auth: Fix account check over ncalrpc.
authorAndreas Schneider <asn@samba.org>
Tue, 12 Jul 2011 10:23:08 +0000 (12:23 +0200)
committerAndreas Schneider <asn@samba.org>
Wed, 13 Jul 2011 12:09:35 +0000 (14:09 +0200)
source3/auth/auth.c
source3/auth/auth_unix.c

index 0bdce9d1f4c0be880c5c9efc977434417a601e0b..a7fe1c624cfd3bf1017a58ab0cfe80a611a85986 100644 (file)
@@ -284,12 +284,16 @@ static NTSTATUS check_ntlm_password(const struct auth_context *auth_context,
        if (NT_STATUS_IS_OK(nt_status)) {
                unix_username = (*server_info)->unix_name;
                if (!(*server_info)->guest) {
-                       char *rhost;
+                       const char *rhost;
 
-                       rhost = tsocket_address_inet_addr_string(user_info->remote_host,
-                                                                talloc_tos());
-                       if (rhost == NULL) {
-                               return NT_STATUS_NO_MEMORY;
+                       if (tsocket_address_is_inet(user_info->remote_host, "ip")) {
+                               rhost = tsocket_address_inet_addr_string(user_info->remote_host,
+                                                                        talloc_tos());
+                               if (rhost == NULL) {
+                                       return NT_STATUS_NO_MEMORY;
+                               }
+                       } else {
+                               rhost = "127.0.0.1";
                        }
 
                        /* We might not be root if we are an RPC call */
index 6f232ec66ce801694755836f904d6a8424c03b2b..c8b5435abc8c7811ecb1c7371ba47186a8e4113b 100644 (file)
@@ -39,14 +39,18 @@ static NTSTATUS check_unix_security(const struct auth_context *auth_context,
 {
        NTSTATUS nt_status;
        struct passwd *pass = NULL;
-       char *rhost;
+       const char *rhost;
 
        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;
+       if (tsocket_address_is_inet(user_info->remote_host, "ip")) {
+               rhost = tsocket_address_inet_addr_string(user_info->remote_host,
+                                                        talloc_tos());
+               if (rhost == NULL) {
+                       return NT_STATUS_NO_MEMORY;
+               }
+       } else {
+               rhost = "127.0.0.1";
        }
 
        become_root();