s3:auth_sam: introduce effective_domain helper variables
authorStefan Metzmacher <metze@samba.org>
Thu, 23 Jan 2020 15:21:43 +0000 (16:21 +0100)
committerKarolin Seeger <kseeger@samba.org>
Tue, 11 Feb 2020 07:51:23 +0000 (07:51 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14247

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit a63e2a312c761093fedb09bd234b6736485a930a)

source3/auth/auth_sam.c

index e2c62f94d4895eb0dfbd8acd106434fcc9a229f1..2948c18df0c15d645d5697b728d0984093728cfc 100644 (file)
@@ -77,6 +77,7 @@ static NTSTATUS auth_samstrict_auth(const struct auth_context *auth_context,
                                    const struct auth_usersupplied_info *user_info,
                                    struct auth_serversupplied_info **server_info)
 {
+       const char *effective_domain = user_info->mapped.domain_name;
        bool is_local_name, is_my_domain;
 
        if (!user_info || !auth_context) {
@@ -90,11 +91,11 @@ static NTSTATUS auth_samstrict_auth(const struct auth_context *auth_context,
        }
 
        DBG_DEBUG("Check auth for: [%s]\\[%s]\n",
-                 user_info->mapped.domain_name,
+                 effective_domain,
                  user_info->mapped.account_name);
 
-       is_local_name = is_myname(user_info->mapped.domain_name);
-       is_my_domain  = strequal(user_info->mapped.domain_name, lp_workgroup());
+       is_local_name = is_myname(effective_domain);
+       is_my_domain  = strequal(effective_domain, lp_workgroup());
 
        /* check whether or not we service this domain/workgroup name */
 
@@ -103,7 +104,7 @@ static NTSTATUS auth_samstrict_auth(const struct auth_context *auth_context,
                case ROLE_DOMAIN_MEMBER:
                        if ( !is_local_name ) {
                                DEBUG(6,("check_samstrict_security: %s is not one of my local names (%s)\n",
-                                       user_info->mapped.domain_name, (lp_server_role() == ROLE_DOMAIN_MEMBER
+                                       effective_domain, (lp_server_role() == ROLE_DOMAIN_MEMBER
                                        ? "ROLE_DOMAIN_MEMBER" : "ROLE_STANDALONE") ));
                                return NT_STATUS_NOT_IMPLEMENTED;
                        }
@@ -113,7 +114,7 @@ static NTSTATUS auth_samstrict_auth(const struct auth_context *auth_context,
                case ROLE_DOMAIN_BDC:
                        if ( !is_local_name && !is_my_domain ) {
                                DEBUG(6,("check_samstrict_security: %s is not one of my local names or domain name (DC)\n",
-                                       user_info->mapped.domain_name));
+                                       effective_domain));
                                return NT_STATUS_NOT_IMPLEMENTED;
                        }
 
@@ -154,6 +155,7 @@ static NTSTATUS auth_sam_netlogon3_auth(const struct auth_context *auth_context,
                                        const struct auth_usersupplied_info *user_info,
                                        struct auth_serversupplied_info **server_info)
 {
+       const char *effective_domain = user_info->mapped.domain_name;
        bool is_my_domain;
 
        if (!user_info || !auth_context) {
@@ -167,7 +169,7 @@ static NTSTATUS auth_sam_netlogon3_auth(const struct auth_context *auth_context,
        }
 
        DBG_DEBUG("Check auth for: [%s]\\[%s]\n",
-                 user_info->mapped.domain_name,
+                 effective_domain,
                  user_info->mapped.account_name);
 
        /* check whether or not we service this domain/workgroup name */
@@ -184,7 +186,7 @@ static NTSTATUS auth_sam_netlogon3_auth(const struct auth_context *auth_context,
        is_my_domain = strequal(user_info->mapped.domain_name, lp_workgroup());
        if (!is_my_domain) {
                DBG_INFO("%s is not our domain name (DC for %s)\n",
-                        user_info->mapped.domain_name, lp_workgroup());
+                        effective_domain, lp_workgroup());
                return NT_STATUS_NOT_IMPLEMENTED;
        }