s3:auth_sam: introduce effective_domain helper variables
[amitay/samba.git] / source3 / auth / auth_sam.c
index da38bf4caed86c05805db21647064209151f54f4..fa40a5c8f3eb8b24057d1e61ff19e69e71a0e6fb 100644 (file)
@@ -80,6 +80,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) {
@@ -93,11 +94,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 */
 
@@ -106,7 +107,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;
                        }
@@ -116,7 +117,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;
                        }
 
@@ -160,6 +161,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) {
@@ -173,7 +175,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 */
@@ -190,7 +192,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;
        }