s3-auth: Fix 'map to guest = Bad Uid' support
authorAndreas Schneider <asn@samba.org>
Wed, 19 Aug 2015 14:11:47 +0000 (16:11 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 21 Aug 2015 12:46:15 +0000 (14:46 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=9862

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source3/auth/auth_util.c

index 69e150fc972be54fc7b01d089f4fb07344771b78..593ecfb5bbe9726db6280c352420a103195c99b8 100644 (file)
@@ -1397,6 +1397,14 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
                                     &username_was_mapped);
 
        if (!NT_STATUS_IS_OK(nt_status)) {
+               /* Handle 'map to guest = Bad Uid */
+               if (NT_STATUS_EQUAL(nt_status, NT_STATUS_NO_SUCH_USER) &&
+                   (lp_security() == SEC_ADS || lp_security() == SEC_DOMAIN) &&
+                   lp_map_to_guest() == MAP_TO_GUEST_ON_BAD_UID) {
+                       DBG_NOTICE("Try to map %s to guest account",
+                                  nt_username);
+                       return make_server_info_guest(mem_ctx, server_info);
+               }
                return nt_status;
        }