diff options
author | Jeremy Allison <jra@samba.org> | 2001-12-20 22:27:05 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-12-20 22:27:05 +0000 |
commit | 9ed10f83d76eba1c4d4ac19842314f24db1c7a65 (patch) | |
tree | 5d3a6e68e9a597e160e74d03f34799850dd43a08 | |
parent | 0c26ae18809f82146ff584c3ba875c82d0b4824f (diff) | |
download | samba-9ed10f83d76eba1c4d4ac19842314f24db1c7a65.tar.gz samba-9ed10f83d76eba1c4d4ac19842314f24db1c7a65.tar.bz2 samba-9ed10f83d76eba1c4d4ac19842314f24db1c7a65.zip |
Removed global debugf. Replaced with lp_set_logfile(name).
Fixed winbindd to finally stop leaving log. file droppings :-).
Jeremy.
(This used to be commit 0bea6cf79a44f79fa3a4f2c8381e898e79c66509)
-rw-r--r-- | source3/client/client.c | 6 | ||||
-rw-r--r-- | source3/nmbd/nmbd.c | 11 | ||||
-rw-r--r-- | source3/nsswitch/winbindd.c | 18 | ||||
-rw-r--r-- | source3/param/loadparm.c | 9 | ||||
-rw-r--r-- | source3/rpcclient/rpcclient.c | 5 | ||||
-rw-r--r-- | source3/rpcclient/samsync.c | 5 | ||||
-rw-r--r-- | source3/smbd/server.c | 12 | ||||
-rw-r--r-- | source3/torture/rpctorture.c | 6 |
8 files changed, 46 insertions, 26 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index 52c032e130..a5654a0eaf 100644 --- a/source3/client/client.c +++ b/source3/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/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 963e265330..80d712036d 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/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/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index c10cd9e2ca..e68708469c 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/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/source3/param/loadparm.c b/source3/param/loadparm.c index f88361f7ab..335995b0dd 100644 --- a/source3/param/loadparm.c +++ b/source3/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/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 81fb47c525..dd490f9066 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/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/source3/rpcclient/samsync.c b/source3/rpcclient/samsync.c index 4d3e15550e..532517f2ef 100644 --- a/source3/rpcclient/samsync.c +++ b/source3/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/source3/smbd/server.c b/source3/smbd/server.c index df56dfe9ab..c6eed4b9bb 100644 --- a/source3/smbd/server.c +++ b/source3/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/source3/torture/rpctorture.c b/source3/torture/rpctorture.c index 231e3a75f5..6844440fbe 100644 --- a/source3/torture/rpctorture.c +++ b/source3/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; } |