]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
BUG 417: fix %UuGg variables expansion in include lines setging the current_user_info...
authorGerald Carter <jerry@samba.org>
Fri, 19 Mar 2004 22:06:54 +0000 (22:06 +0000)
committerGerald Carter <jerry@samba.org>
Fri, 19 Mar 2004 22:06:54 +0000 (22:06 +0000)
(This used to be commit a90c3bd281e7a62bb8482e42aa3b674eeeb5995a)

source3/lib/substitute.c
source3/lib/username.c
source3/param/loadparm.c
source3/smbd/password.c
source3/smbd/sesssetup.c

index 5dec9808101d957d7340364367183f68167e177b..fed11c22982e000d17967bb74d1baf5c084556bb 100644 (file)
@@ -116,6 +116,11 @@ void sub_set_smb_name(const char *name)
        alpha_strcpy(smb_user_name,tmp,SAFE_NETBIOS_CHARS,sizeof(smb_user_name)-1);
 }
 
+char* sub_get_smb_name( void )
+{
+       return smb_user_name;
+}
+
 /*******************************************************************
  Setup the strings used by substitutions. Called per packet. Ensure
  %U name is set correctly also.
index 40327f81687d013ea7b4936bd45e7f9068a03daa..ac5530b5c71dd7b2c04cc93be56f377cd5a05e71 100644 (file)
@@ -283,6 +283,11 @@ struct passwd *Get_Pwnam(const char *user)
        fstring user2;
        struct passwd *ret;
 
+       if ( *user == '\0' ) {
+               DEBUG(10,("Get_Pwnam: empty username!\n"));
+               return NULL;
+       }
+
        fstrcpy(user2, user);
 
        DEBUG(5,("Finding user %s\n", user));
index af26697476ae92da05de70a5a894fd5bd2a1020d..35bd464b56b7d601c7f6d4c358ab35982260f0be 100644 (file)
@@ -2657,7 +2657,16 @@ static void add_to_file_list(const char *fname, const char *subfname)
 BOOL lp_file_list_changed(void)
 {
        struct file_lists *f = file_lists;
-       DEBUG(6, ("lp_file_list_changed()\n"));
+       char *username;
+
+       DEBUG(6, ("lp_file_list_changed()\n"));
+
+       /* get the username for substituion -- preference to the current_user_info */
+       if ( strlen( current_user_info.smb_name ) != 0 )
+               username = current_user_info.smb_name;
+       else
+               username = sub_get_smb_name();
+               
 
        while (f) {
                pstring n2;
@@ -3806,9 +3815,18 @@ BOOL lp_load(const char *pszFname, BOOL global_only, BOOL save_defaults,
        pstring n2;
        BOOL bRetval;
        param_opt_struct *data, *pdata;
+       char *username;
 
        pstrcpy(n2, pszFname);
-       standard_sub_basic(current_user_info.smb_name, n2,sizeof(n2));
+       
+       /* get the username for substituion -- preference to the current_user_info */
+       
+       if ( strlen( current_user_info.smb_name ) != 0 )
+               username = current_user_info.smb_name;
+       else
+               username = sub_get_smb_name();
+               
+       standard_sub_basic( username, n2,sizeof(n2) );
 
        add_to_file_list(pszFname, n2);
 
index 10c6aadb1fc49d66c34461d9b252134853646653..9449113ddc550d4060fe37c68b2ed915b37cf80c 100644 (file)
@@ -273,6 +273,10 @@ int register_vuid(auth_serversupplied_info *server_info, DATA_BLOB session_key,
                /* Try and turn on server signing on the first non-guest sessionsetup. */
                srv_set_signing(vuser->session_key, response_blob);
        }
+       
+       /* fill in the current_user_info struct */
+       set_current_user_info( &vuser->user );
+
 
        return vuser->vuid;
 }
index d91aa9472865b9a49e070c76a3cf7992b5def20c..244db6d2c140739a2868b23bc1671ae0c0caad86 100644 (file)
@@ -282,6 +282,9 @@ static int reply_spnego_kerberos(connection_struct *conn,
        if (sess_vuid == -1) {
                ret = NT_STATUS_LOGON_FAILURE;
        } else {
+               /* current_user_info is changed on new vuid */
+               reload_services( True );
+
                set_message(outbuf,4,0,True);
                SSVAL(outbuf, smb_vwv3, 0);
                        
@@ -355,6 +358,9 @@ static BOOL reply_spnego_ntlmssp(connection_struct *conn, char *inbuf, char *out
                        nt_status = NT_STATUS_LOGON_FAILURE;
                } else {
                        
+                       /* current_user_info is changed on new vuid */
+                       reload_services( True );
+
                        set_message(outbuf,4,0,True);
                        SSVAL(outbuf, smb_vwv3, 0);
                        
@@ -911,6 +917,9 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,
                return ERROR_NT(NT_STATUS_LOGON_FAILURE);
        }
 
+       /* current_user_info is changed on new vuid */
+       reload_services( True );
+
        if (!server_info->guest && !srv_check_sign_mac(inbuf)) {
                exit_server("reply_sesssetup_and_X: bad smb signature");
        }