summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-12-20 22:27:05 +0000
committerJeremy Allison <jra@samba.org>2001-12-20 22:27:05 +0000
commit0bea6cf79a44f79fa3a4f2c8381e898e79c66509 (patch)
treef133d2b79db55d39f20457fc03b293adee0482e6
parentfe7ad3761233f7adb13756d611a11dbf0594b77f (diff)
downloadsamba-0bea6cf79a44f79fa3a4f2c8381e898e79c66509.tar.gz
Removed global debugf. Replaced with lp_set_logfile(name).
Fixed winbindd to finally stop leaving log. file droppings :-). Jeremy.
-rw-r--r--source/client/client.c6
-rw-r--r--source/nmbd/nmbd.c11
-rw-r--r--source/nsswitch/winbindd.c18
-rw-r--r--source/param/loadparm.c9
-rw-r--r--source/rpcclient/rpcclient.c5
-rw-r--r--source/rpcclient/samsync.c5
-rw-r--r--source/smbd/server.c12
-rw-r--r--source/torture/rpctorture.c6
8 files changed, 46 insertions, 26 deletions
diff --git a/source/client/client.c b/source/client/client.c
index 52c032e1309..a5654a0eafb 100644
--- a/source/client/client.c
+++ b/source/client/client.c
@@ -63,8 +63,6 @@ static int cmd_help(void);
time_t newer_than = 0;
int archive_level = 0;
-extern pstring debugf;
-
BOOL translation = False;
static BOOL have_ip;
@@ -2402,6 +2400,7 @@ static int do_message_op(void)
extern char tar_type;
pstring term_code;
pstring new_name_resolve_order;
+ pstring logfile;
char *p;
int rc = 0;
@@ -2569,7 +2568,8 @@ static int do_message_op(void)
port = atoi(optarg);
break;
case 'l':
- slprintf(debugf,sizeof(debugf)-1, "%s.client",optarg);
+ slprintf(logfile,sizeof(logfile)-1, "%s.client",optarg);
+ lp_set_logfile(logfile);
break;
case 'h':
usage(pname);
diff --git a/source/nmbd/nmbd.c b/source/nmbd/nmbd.c
index 963e2653300..80d712036da 100644
--- a/source/nmbd/nmbd.c
+++ b/source/nmbd/nmbd.c
@@ -26,8 +26,6 @@
#include "includes.h"
-extern pstring debugf;
-
int ClientNMB = -1;
int ClientDGRAM = -1;
int global_nmb_port = -1;
@@ -103,7 +101,7 @@ static BOOL dump_core(void)
{
char *p;
pstring dname;
- pstrcpy( dname, debugf );
+ pstrcpy( dname, lp_logfile() );
if ((p=strrchr_m(dname,'/')))
*p=0;
pstrcat( dname, "/corefiles" );
@@ -662,6 +660,7 @@ static void usage(char *pname)
extern char *optarg;
extern BOOL append_log;
BOOL opt_interactive = False;
+ pstring logfile;
append_log = True; /* Default, override with '-o' option. */
@@ -672,7 +671,8 @@ static void usage(char *pname)
sys_srandom(time(NULL) ^ sys_getpid());
- slprintf(debugf, sizeof(debugf)-1, "%s/log.nmbd", dyn_LOGFILEBASE);
+ slprintf(logfile, sizeof(logfile)-1, "%s/log.nmbd", dyn_LOGFILEBASE);
+ lp_set_logfile(logfile);
/* this is for people who can't start the program correctly */
while (argc > 1 && (*argv[1] != '-'))
@@ -728,7 +728,8 @@ static void usage(char *pname)
strupper(global_myname);
break;
case 'l':
- slprintf(debugf, sizeof(debugf)-1, "%s/log.nmbd", optarg);
+ slprintf(logfile, sizeof(logfile)-1, "%s/log.nmbd", optarg);
+ lp_set_logfile(logfile);
break;
case 'a':
append_log = True;
diff --git a/source/nsswitch/winbindd.c b/source/nsswitch/winbindd.c
index c10cd9e2caa..e68708469c8 100644
--- a/source/nsswitch/winbindd.c
+++ b/source/nsswitch/winbindd.c
@@ -23,8 +23,6 @@
#include "winbindd.h"
-extern pstring debugf;
-
/* List of all connected clients */
struct winbindd_cli_state *client_list;
@@ -36,6 +34,7 @@ BOOL opt_nocache;
static BOOL reload_services_file(BOOL test)
{
BOOL ret;
+ pstring logfile;
if (lp_loaded()) {
pstring fname;
@@ -47,9 +46,15 @@ static BOOL reload_services_file(BOOL test)
}
}
+ 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();
@@ -66,7 +71,7 @@ static BOOL dump_core(void)
{
char *p;
pstring dname;
- pstrcpy( dname, debugf );
+ pstrcpy( dname, lp_logfile() );
if ((p=strrchr(dname,'/')))
*p=0;
pstrcat( dname, "/corefiles" );
@@ -725,6 +730,7 @@ int main(int argc, char **argv)
{
extern pstring global_myname;
extern fstring global_myworkgroup;
+ pstring logfile;
int accept_sock;
BOOL interactive = False;
int opt, new_debuglevel = -1;
@@ -735,7 +741,8 @@ int main(int argc, char **argv)
CatchSignal(SIGUSR1, SIG_IGN);
fault_setup((void (*)(void *))fault_quit );
- snprintf(debugf, sizeof(debugf), "%s/log.winbindd", dyn_LOGFILEBASE);
+ snprintf(logfile, sizeof(logfile), "%s/log.winbindd", dyn_LOGFILEBASE);
+ lp_set_logfile(logfile);
/* Initialise for running in non-root mode */
@@ -777,7 +784,8 @@ int main(int argc, char **argv)
}
}
- snprintf(debugf, sizeof(debugf), "%s/log.winbindd", dyn_LOGFILEBASE);
+ snprintf(logfile, sizeof(logfile), "%s/log.winbindd", dyn_LOGFILEBASE);
+ lp_set_logfile(logfile);
setup_logging("winbindd", interactive);
reopen_logs();
diff --git a/source/param/loadparm.c b/source/param/loadparm.c
index f88361f7abe..335995b0dd2 100644
--- a/source/param/loadparm.c
+++ b/source/param/loadparm.c
@@ -3881,4 +3881,13 @@ BOOL is_netbios_alias_or_name(char *name)
return False;
}
+/***********************************************************
+ Allow daemons such as winbindd to fix their logfile name.
+************************************************************/
+void lp_set_logfile(const char *name)
+{
+ extern pstring debugf;
+ pstrcpy(Globals.szLogFile, name);
+ pstrcpy(debugf, name);
+}
diff --git a/source/rpcclient/rpcclient.c b/source/rpcclient/rpcclient.c
index 81fb47c525e..dd490f90660 100644
--- a/source/rpcclient/rpcclient.c
+++ b/source/rpcclient/rpcclient.c
@@ -23,8 +23,6 @@
#include "includes.h"
#include "rpcclient.h"
-extern pstring debugf;
-
DOM_SID domain_sid;
/* List to hold groups of commands */
@@ -590,7 +588,8 @@ static void usage(void)
break;
case 'l':
- slprintf(debugf, sizeof(debugf) - 1, "%s.client", optarg);
+ slprintf(logfile, sizeof(logfile) - 1, "%s.client", optarg);
+ lp_set_logfile(logfile);
interactive = False;
break;
diff --git a/source/rpcclient/samsync.c b/source/rpcclient/samsync.c
index 4d3e15550e8..532517f2efa 100644
--- a/source/rpcclient/samsync.c
+++ b/source/rpcclient/samsync.c
@@ -481,7 +481,7 @@ static struct cli_state *init_connection(struct cli_state *cli,
struct cli_state cli;
NTSTATUS result;
int opt;
- extern pstring debugf;
+ pstring logfile;
BOOL interactive = False, do_smbpasswd_output = False;
BOOL verbose = False;
uint32 low_serial = 0;
@@ -554,8 +554,9 @@ static struct cli_state *init_connection(struct cli_state *cli,
/* Initialise samba */
- slprintf(debugf, sizeof(debugf) - 1, "%s/log.%s", dyn_LOGFILEBASE,
+ slprintf(logfile, sizeof(logfile) - 1, "%s/log.%s", dyn_LOGFILEBASE,
"samsync");
+ lp_set_logfile(logfile);
setup_logging("samsync", interactive);
diff --git a/source/smbd/server.c b/source/smbd/server.c
index df56dfe9ab0..c6eed4b9bb4 100644
--- a/source/smbd/server.c
+++ b/source/smbd/server.c
@@ -21,7 +21,6 @@
#include "includes.h"
-extern pstring debugf;
extern fstring global_myworkgroup;
extern pstring global_myname;
@@ -425,7 +424,7 @@ static BOOL dump_core(void)
{
char *p;
pstring dname;
- pstrcpy(dname,debugf);
+ pstrcpy(dname,lp_logfile());
if ((p=strrchr_m(dname,'/'))) *p=0;
pstrcat(dname,"/corefiles");
mkdir(dname,0700);
@@ -583,12 +582,13 @@ static void usage(char *pname)
int main(int argc,char *argv[])
{
extern BOOL append_log;
+ extern char *optarg;
/* shall I run as a daemon */
BOOL is_daemon = False;
BOOL specified_logfile = False;
int port = SMB_PORT;
int opt;
- extern char *optarg;
+ pstring logfile;
#ifdef HAVE_SET_AUTH_PARAMETERS
set_auth_parameters(argc,argv);
@@ -612,7 +612,8 @@ static void usage(char *pname)
case 'l':
specified_logfile = True;
- slprintf(debugf, sizeof(debugf)-1, "%s/log.smbd", optarg);
+ slprintf(logfile, sizeof(logfile)-1, "%s/log.smbd", optarg);
+ lp_set_logfile(logfile);
break;
case 'a':
@@ -670,8 +671,9 @@ static void usage(char *pname)
append_log = True;
if(!specified_logfile) {
- slprintf(debugf, sizeof(debugf)-1, "%s/log.smbd",
+ slprintf(logfile, sizeof(logfile)-1, "%s/log.smbd",
dyn_LOGFILEBASE);
+ lp_set_logfile(logfile);
}
pstrcpy(remote_machine, "smbd");
diff --git a/source/torture/rpctorture.c b/source/torture/rpctorture.c
index 231e3a75f56..6844440fbec 100644
--- a/source/torture/rpctorture.c
+++ b/source/torture/rpctorture.c
@@ -30,8 +30,6 @@ extern pstring global_myname;
extern pstring user_socket_options;
-extern pstring debugf;
-
extern file_info def_finfo;
#define CNV_LANG(s) dos2unix_format(s,False)
@@ -232,6 +230,7 @@ enum client_action
enum client_action cli_action = CLIENT_NONE;
int nprocs = 1;
int numops = 100;
+ pstring logfile;
struct client_info cli_info;
@@ -445,8 +444,9 @@ enum client_action
case 'l':
{
- slprintf(debugf, sizeof(debugf)-1,
+ slprintf(logfile, sizeof(logfile)-1,
"%s.client",optarg);
+ lp_set_logfile(logfile);
break;
}