s3/auth: use set_current_user_info() in auth3_generate_session_info_pac()
authorRalph Boehme <slow@samba.org>
Sat, 18 Jan 2020 07:06:45 +0000 (08:06 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 6 Feb 2020 10:17:43 +0000 (10:17 +0000)
This delays reloading config slightly, but I don't see how could affect
observable behaviour other then log messages coming from the functions in
between the different locations for lp_load_with_shares() like
make_session_info_krb5() are sent to a different logfile if "log file" uses %U.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/auth/auth_generic.c

index 9243a0ba02d33d89db4ae04afc1cbbb9f16302a7..0e9500ac08d1c1bc590d353091ba38a3e251a778 100644 (file)
@@ -159,12 +159,6 @@ static NTSTATUS auth3_generate_session_info_pac(struct auth4_context *auth_ctx,
                }
        }
 
-       /* setup the string used by %U */
-       sub_set_smb_name(username);
-
-       /* reload services so that the new %U is taken into account */
-       lp_load_with_shares(get_dyn_CONFIGFILE());
-
        status = make_session_info_krb5(mem_ctx,
                                        ntuser, ntdomain, username, pw,
                                        info3_copy, is_guest, is_mapped, NULL /* No session key for now, caller will sort it out */,
@@ -176,6 +170,14 @@ static NTSTATUS auth3_generate_session_info_pac(struct auth4_context *auth_ctx,
                goto done;
        }
 
+       /* setup the string used by %U */
+       set_current_user_info((*session_info)->unix_info->sanitized_username,
+                             (*session_info)->unix_info->unix_name,
+                             (*session_info)->info->domain_name);
+
+       /* reload services so that the new %U is taken into account */
+       lp_load_with_shares(get_dyn_CONFIGFILE());
+
        DEBUG(5, (__location__ "OK: user: %s domain: %s client: %s\n",
                  ntuser, ntdomain, rhost));