diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-03-08 10:22:50 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-03-08 10:22:50 +0000 |
commit | 01289b14a7cbe0e1a1e135349037b0e7ba5fe70b (patch) | |
tree | f356a9b03834bc459ab5896eb185b7b10120f071 /source3/lib/substitute.c | |
parent | bbf8961b284a877b5cfa4101e0fd677664a867f1 (diff) | |
download | samba-01289b14a7cbe0e1a1e135349037b0e7ba5fe70b.tar.gz samba-01289b14a7cbe0e1a1e135349037b0e7ba5fe70b.tar.bz2 samba-01289b14a7cbe0e1a1e135349037b0e7ba5fe70b.zip |
Make sure that the 'remote' machine name can only be set once. For some weird
reason, during a Win2003 installation, when you select 'domain join' it sends
one machine name in the name exchange, and litraly 'machinename' during the
NTLMSSP login.
Also fix up winbindd's logfile handling, so that it matches smbd and nmbd.
(This helps me, by seperating the logs by pid).
Andrew Bartlett
(This used to be commit afe5a3832f79131fb74461577f1db0e5e8bf4b6d)
Diffstat (limited to 'source3/lib/substitute.c')
-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..1e3f51e2d8 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -29,9 +29,20 @@ 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; + if (already_perm) + return; + + already_perm = perm; + fstring tmp_local_machine; fstrcpy(tmp_local_machine,local_name); @@ -40,8 +51,20 @@ void set_local_machine_name(const char* local_name) 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; + if (already_perm) + return; + + already_perm = perm; + fstring tmp_remote_machine; fstrcpy(tmp_remote_machine,remote_name); @@ -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; } |