Index: lib/substitute.c =================================================================== RCS file: /data/cvs/samba/source/lib/substitute.c,v retrieving revision 1.25.2.18 diff -u -r1.25.2.18 substitute.c --- lib/substitute.c 8 Dec 2003 17:40:44 -0000 1.25.2.18 +++ lib/substitute.c 19 Mar 2004 21:59:20 -0000 @@ -116,6 +116,11 @@ 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: lib/username.c =================================================================== RCS file: /data/cvs/samba/source/lib/username.c,v retrieving revision 1.66.2.13 diff -u -r1.66.2.13 username.c --- lib/username.c 4 Nov 2003 18:24:33 -0000 1.66.2.13 +++ lib/username.c 19 Mar 2004 21:59:20 -0000 @@ -283,6 +283,11 @@ 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: param/loadparm.c =================================================================== RCS file: /data/cvs/samba/source/param/loadparm.c,v retrieving revision 1.397.2.126 diff -u -r1.397.2.126 loadparm.c --- param/loadparm.c 2 Mar 2004 04:09:39 -0000 1.397.2.126 +++ param/loadparm.c 19 Mar 2004 21:59:20 -0000 @@ -2657,7 +2657,16 @@ 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 @@ 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: smbd/password.c =================================================================== RCS file: /data/cvs/samba/source/smbd/password.c,v retrieving revision 1.248.2.20 diff -u -r1.248.2.20 password.c --- smbd/password.c 31 Jan 2004 14:44:27 -0000 1.248.2.20 +++ smbd/password.c 19 Mar 2004 21:59:20 -0000 @@ -273,6 +273,10 @@ /* 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: smbd/sesssetup.c =================================================================== RCS file: /data/cvs/samba/source/smbd/sesssetup.c,v retrieving revision 1.50.2.48 diff -u -r1.50.2.48 sesssetup.c --- smbd/sesssetup.c 16 Mar 2004 16:41:54 -0000 1.50.2.48 +++ smbd/sesssetup.c 19 Mar 2004 21:59:20 -0000 @@ -282,6 +282,9 @@ 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 @@ 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); @@ -910,6 +916,9 @@ if (sess_vuid == -1) { 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");