[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Mon Mar 28 23:04:02 MDT 2011


The branch, master has been updated
       via  af31bf6 debug: ignore debug_set_logfile() with a blank string
       via  3351897 s4-cmdline: moved loadparm init after fault setup
       via  77cc161 s4-param: set a default logfile
       via  8d2d0ef lib: removed a spurios declaration of 'logfile'
      from  bae14fb Remove two unused labels.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit af31bf6bf5ef3af6eaf87ebe2f9f5903698c22db
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 29 14:41:58 2011 +1100

    debug: ignore debug_set_logfile() with a blank string
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User: Andrew Tridgell <tridge at samba.org>
    Autobuild-Date: Tue Mar 29 07:03:58 CEST 2011 on sn-devel-104

commit 335189792448a209f1f654c6173f359f17ae7fb1
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 29 14:30:24 2011 +1100

    s4-cmdline: moved loadparm init after fault setup
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 77cc1610e0b03e013ac478e8b9b874e73ac2e09a
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 29 14:29:54 2011 +1100

    s4-param: set a default logfile
    
    setup a logfile for when one is not specified in smb.conf
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 8d2d0ef0eb506f2be960f4b3abcbc4ae2a3730e7
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 29 14:29:22 2011 +1100

    lib: removed a spurios declaration of 'logfile'
    
    we don't have a global logfile variable any more
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/util/debug.c                  |    6 +++++-
 lib/util/util.h                   |    1 -
 source4/lib/cmdline/popt_common.c |    3 +--
 source4/param/loadparm.c          |    5 +++++
 4 files changed, 11 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/debug.c b/lib/util/debug.c
index c7ba19e..2ff7cb2 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -493,6 +493,10 @@ void setup_logging(const char *prog_name, enum debug_logtype new_logtype)
 
 void debug_set_logfile(const char *name)
 {
+	if (name == NULL || *name == 0) {
+		/* this copes with calls when smb.conf is not loaded yet */
+		return;
+	}
 	TALLOC_FREE(state.debugf);
 	state.debugf = talloc_strdup(NULL, name);
 }
@@ -564,7 +568,7 @@ bool reopen_logs_internal(void)
 
 	if (new_fd == -1) {
 		log_overflow = true;
-		DEBUG(0, ("Unable to open new log file %s: %s\n", state.debugf, strerror(errno)));
+		DEBUG(0, ("Unable to open new log file '%s': %s\n", state.debugf, strerror(errno)));
 		log_overflow = false;
 		ret = false;
 	} else {
diff --git a/lib/util/util.h b/lib/util/util.h
index 58e6ffd..48d6566 100644
--- a/lib/util/util.h
+++ b/lib/util/util.h
@@ -34,7 +34,6 @@
 
 struct smbsrv_tcon;
 
-extern const char *logfile;
 extern const char *panic_action;
 
 #include "lib/util/time.h"
diff --git a/source4/lib/cmdline/popt_common.c b/source4/lib/cmdline/popt_common.c
index afc8742..16c6a1b 100644
--- a/source4/lib/cmdline/popt_common.c
+++ b/source4/lib/cmdline/popt_common.c
@@ -83,8 +83,6 @@ static void popt_samba_callback(poptContext con,
 		pname++;
 
 	if (reason == POPT_CALLBACK_REASON_PRE) {
-		cmdline_lp_ctx = loadparm_init_global(false);
-
 		/* Hook for 'almost the first thing to do in a samba program' here */
 		/* setup for panics */
 		fault_setup();
@@ -94,6 +92,7 @@ static void popt_samba_callback(poptContext con,
 		talloc_set_log_fn(popt_s4_talloc_log_fn);
 		talloc_set_abort_fn(smb_panic);
 
+		cmdline_lp_ctx = loadparm_init_global(false);
 		return;
 	}
 
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index f69dfd1..93158f2 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -650,6 +650,7 @@ FN_GLOBAL_INTEGER(krb5_port, krb5_port)
 FN_GLOBAL_INTEGER(kpasswd_port, kpasswd_port)
 FN_GLOBAL_INTEGER(web_port, web_port)
 FN_GLOBAL_BOOL(tls_enabled, tls_enabled)
+FN_GLOBAL_STRING(logfile, logfile)
 FN_GLOBAL_STRING(share_backend, szShareBackend)
 FN_GLOBAL_STRING(sam_url, szSAM_URL)
 FN_GLOBAL_STRING(idmap_url, szIDMAP_URL)
@@ -2326,6 +2327,7 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
 	char *myname;
 	struct loadparm_context *lp_ctx;
 	struct parmlist_entry *parm;
+	char *logfile;
 
 	lp_ctx = talloc_zero(mem_ctx, struct loadparm_context);
 	if (lp_ctx == NULL)
@@ -2365,6 +2367,9 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
 		}
 	}
 
+	logfile = talloc_asprintf(lp_ctx, "%s/log.samba", dyn_LOGFILEBASE);
+	lpcfg_do_global_parameter(lp_ctx, "log file", logfile);
+	talloc_free(logfile);
 
 	lpcfg_do_global_parameter(lp_ctx, "log level", "0");
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list