summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-08-28 23:57:34 +0000
committerJeremy Allison <jra@samba.org>2003-08-28 23:57:34 +0000
commitfcdebdae6fb69575bbe6e622b112d2e61f972898 (patch)
tree49237015e9ac117da0815b88db93e39fff01a307 /source3/lib
parentafe845235a7fdeac5ea888db695da48f8df83349 (diff)
downloadsamba-fcdebdae6fb69575bbe6e622b112d2e61f972898.tar.gz
samba-fcdebdae6fb69575bbe6e622b112d2e61f972898.tar.bz2
samba-fcdebdae6fb69575bbe6e622b112d2e61f972898.zip
Fix bug found by tridge in 2.2.x. Ensure that %U substitution is
restored on next valid packet if a logon fails. This has relevence if people are using su.exe within logon scripts ! Jeremy. (This used to be commit d405a93a9d3f9a1d93bb3289b00683fba3160bbe)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/substitute.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c
index 71c7b9ab1c..a73f9d85da 100644
--- a/source3/lib/substitute.c
+++ b/source3/lib/substitute.c
@@ -98,16 +98,17 @@ const char* get_local_machine_name(void)
return local_machine;
}
+/*******************************************************************
+ Setup the string used by %U substitution.
+********************************************************************/
-/*
- setup the string used by %U substitution
-*/
void sub_set_smb_name(const char *name)
{
fstring tmp;
/* don't let anonymous logins override the name */
- if (! *name) return;
+ if (! *name)
+ return;
fstrcpy(tmp,name);
trim_string(tmp," "," ");
@@ -115,6 +116,18 @@ void sub_set_smb_name(const char *name)
alpha_strcpy(smb_user_name,tmp,SAFE_NETBIOS_CHARS,sizeof(smb_user_name)-1);
}
+/*******************************************************************
+ Setup the strings used by substitutions. Called per packet. Ensure
+ %U name is set correctly also.
+********************************************************************/
+
+void set_current_user_info(const userdom_struct *pcui)
+{
+ current_user_info = *pcui;
+ /* The following is safe as current_user_info.smb_name
+ * has already been sanitised in register_vuid. */
+ fstrcpy(smb_user_name, current_user_info.smb_name);
+}
/*******************************************************************
Given a pointer to a %$(NAME) expand it as an environment variable.