1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

Removed global debugf. Replaced with lp_set_logfile(name).

Fixed winbindd to finally stop leaving log. file droppings :-).
Jeremy.
This commit is contained in:
Jeremy Allison -
parent fe7ad37612
commit 0bea6cf79a
8 changed files with 46 additions and 26 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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();

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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");

View File

@ -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;
}