diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-03-18 09:52:55 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-03-18 09:52:55 +0000 |
commit | cdc6fc8acb24645ccd0f2862741c9ea9e1c02829 (patch) | |
tree | 95656003f6e226490d9605f69190dad8022e2dab /source3/lib | |
parent | 50eea935161f0c2b5122d9bea5c95eced0a3c485 (diff) | |
download | samba-cdc6fc8acb24645ccd0f2862741c9ea9e1c02829.tar.gz samba-cdc6fc8acb24645ccd0f2862741c9ea9e1c02829.tar.bz2 samba-cdc6fc8acb24645ccd0f2862741c9ea9e1c02829.zip |
Add an extra parameter to our 'set_remote_machine_name' and
'set_local_machine_name' so that the client can't change it from under us.
(.NET RC2 and WinXP install calls the machine 'machinename' during NTLMSSP
on the domain join).
Andrew Bartlett
(This used to be commit 4c7163e7c2cc09bd95faa05156ee480957a7a4d8)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/substitute.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index 2d1b2ab1fa..ef68bce985 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -29,21 +29,44 @@ fstring remote_proto="UNKNOWN"; static fstring remote_machine; static fstring smb_user_name; +/** + * Set the 'local' machine name + * @param local_name the name we are being called + * @param if this is the 'final' name for us, not be be changed again + */ -void set_local_machine_name(const char* local_name) +void set_local_machine_name(const char* local_name, BOOL perm) { + static BOOL already_perm = False; fstring tmp_local_machine; + if (already_perm) + return; + + already_perm = perm; + fstrcpy(tmp_local_machine,local_name); trim_string(tmp_local_machine," "," "); strlower(tmp_local_machine); alpha_strcpy(local_machine,tmp_local_machine,SAFE_NETBIOS_CHARS,sizeof(local_machine)-1); } -void set_remote_machine_name(const char* remote_name) +/** + * Set the 'remote' machine name + * @param remote_name the name our client wants to be called by + * @param if this is the 'final' name for them, not be be changed again + */ + +void set_remote_machine_name(const char* remote_name, BOOL perm) { + static BOOL already_perm = False; fstring tmp_remote_machine; + if (already_perm) + return; + + already_perm = perm; + fstrcpy(tmp_remote_machine,remote_name); trim_string(tmp_remote_machine," "," "); strlower(tmp_remote_machine); @@ -57,6 +80,10 @@ const char* get_remote_machine_name(void) const char* get_local_machine_name(void) { + if (!*local_machine) { + return global_myname(); + } + return local_machine; } |