kcc: default to logging to DBGLVL_WARNING
authorGary Lockyer <gary@catalyst.net.nz>
Wed, 5 Jun 2019 23:40:08 +0000 (11:40 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 2 Jul 2019 05:49:43 +0000 (05:49 +0000)
If the "-d" debug level parameter is not supplied, default to DBGLVL_WARNING.
Overiding the "log level" set in smb.conf.

When samba runs the kcc command stderr output is logged at DBGLVL_ERR,
the default log destination is stderr.  As a result any log messages
generated by the kcc command, are effectively logged at DBGLVL_ERR.
This causes issues if auth or audit logging are enabled in smb.conf.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Pair-programmed-with: Tim Beale <timbeale@catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Jul  2 05:49:43 UTC 2019 on sn-devel-184

source4/scripting/bin/samba_kcc

index aded135907b316c4ba5bab4de74885850303b6ad..122a5ed2c5e2c02f32588b28182b6a604d5bd5a7 100755 (executable)
@@ -250,7 +250,6 @@ parser.add_option("--forget-intersite-links", default=False,
                   help="pretend not to know the existing intersite topology",
                   action="store_true")
 
-
 opts, args = parser.parse_args()
 
 
@@ -286,6 +285,10 @@ else:
     unix_now = int(time.time())
 
 lp = sambaopts.get_loadparm()
+# only log warnings/errors by default, unless the user has specified otherwise
+if opts.debug is None:
+    lp.set('log level', '1')
+
 creds = credopts.get_credentials(lp, fallback_machine=True)
 
 if opts.dburl is None: