/* the client has given us its machine name (which we otherwise would not get on port 445).
we need to possibly reload smb.conf if smb.conf includes depend on the machine name */
- set_remote_machine_name(auth_ntlmssp_state->ntlmssp_state->workstation);
+ set_remote_machine_name(auth_ntlmssp_state->ntlmssp_state->workstation, True);
/* setup the string used by %U */
/* sub_set_smb_name checks for weird internally */
}
/* here we are no longer interactive */
- set_remote_machine_name("smbmount"); /* sneaky ... */
+ set_remote_machine_name("smbmount", False); /* sneaky ... */
setup_logging("mount.smbfs", False);
reopen_logs();
DEBUG(0, ("mount.smbfs: entering daemon mode for service %s, pid=%d\n", the_service, sys_getpid()));
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);
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);
const char* get_local_machine_name(void)
{
+ if (!*local_machine) {
+ return global_myname();
+ }
+
return local_machine;
}
{
BOOL ret;
- set_remote_machine_name("nmbd");
+ set_remote_machine_name("nmbd", False);
if ( lp_loaded() ) {
pstring fname;
}
}
- snprintf(logfile, sizeof(logfile), "%s/log.winbindd", dyn_LOGFILEBASE);
- lp_set_logfile(logfile);
-
reopen_logs();
ret = lp_load(dyn_CONFIGFILE,False,False,True);
- snprintf(logfile, sizeof(logfile), "%s/log.winbindd", dyn_LOGFILEBASE);
- lp_set_logfile(logfile);
-
reopen_logs();
load_interfaces();
fault_setup((void (*)(void *))fault_quit );
- snprintf(logfile, sizeof(logfile), "%s/log.winbindd", dyn_LOGFILEBASE);
- lp_set_logfile(logfile);
-
/* Initialise for running in non-root mode */
sec_init();
+ set_remote_machine_name("winbindd", False);
+
/* Set environment variable so we don't recursively call ourselves.
This may also be useful interactively. */
name2[15] = 0;
}
- set_local_machine_name(name1);
- set_remote_machine_name(name2);
+ set_local_machine_name(name1, True);
+ set_remote_machine_name(name2, True);
DEBUG(2,("netbios connect: local=%s remote=%s\n",
get_local_machine_name(), get_remote_machine_name() ));
/* this is needed so that we get decent entries
in smbstatus for port 445 connects */
- set_remote_machine_name(get_socket_addr(smbd_server_fd()));
+ set_remote_machine_name(get_socket_addr(smbd_server_fd()), False);
/* Reset global variables in util.c so
that client substitutions will be
load_case_tables();
- set_remote_machine_name("smbd");
+ set_remote_machine_name("smbd", False);
if (interactive) {
Fork = False;
lp_set_logfile(logfile);
}
- set_remote_machine_name("wrepld");
+ set_remote_machine_name("wrepld", False);
setup_logging(argv[0],log_stdout);