From 50d2e6c0cd8530e6b0c566e54b64e8de95510182 Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Wed, 22 Apr 2020 06:53:33 -0500 Subject: [PATCH 1/2] Add a test for smbclient -l basename BUG: https://bugzilla.samba.org/show_bug.cgi?id=14345 Signed-off-by: Amit Kumar Reviewed-by: Andreas Schneider Reviewed-by: Alexander Bokovoy (cherry picked from commit 2a7fc40fb3f3ca994cecad3e2957433d7a411208) --- selftest/knownfail.d/smbclog | 1 + .../tests/test_smbclient_log_basename.sh | 36 +++++++++++++++++++ source3/selftest/tests.py | 3 ++ 3 files changed, 40 insertions(+) create mode 100644 selftest/knownfail.d/smbclog create mode 100755 source3/script/tests/test_smbclient_log_basename.sh diff --git a/selftest/knownfail.d/smbclog b/selftest/knownfail.d/smbclog new file mode 100644 index 00000000000..bfe1bfeda7c --- /dev/null +++ b/selftest/knownfail.d/smbclog @@ -0,0 +1 @@ + ^samba3.blackbox.smbclient_log_basename diff --git a/source3/script/tests/test_smbclient_log_basename.sh b/source3/script/tests/test_smbclient_log_basename.sh new file mode 100755 index 00000000000..c721b3f5ca1 --- /dev/null +++ b/source3/script/tests/test_smbclient_log_basename.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# this test checks whether smbclient can log into -l log-basename + +if [ $# -lt 2 ]; then +cat < +EOF +exit 1; +fi + +SERVER="$1" +SMBCLIENT="$2" +PREFIX="$3" +shift 3 +ADDARGS="$*" + +incdir=`dirname $0`/../../../testprogs/blackbox +. $incdir/subunit.sh + +failed=0 + +LOG_DIR=$PREFIX/st_log_basename_dir + +test_smbclient_log_basename() +{ + rm -rf $LOG_DIR + mkdir $LOG_DIR + cmd='$VALGRIND $SMBCLIENT -l $LOG_DIR -d3 //$SERVER/IPC\$ $CONFIGURATION -U%badpassword -c quit $ADDARGS' + out=`eval $cmd 2>&1` + grep 'lp_load_ex: refreshing parameters' $LOG_DIR/log.smbclient +} + +testit "smbclient log-basename" test_smbclient_log_basename || failed=`expr $failed + 1` + +testok $0 $failed diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index 5c43e6e9458..98babc9e344 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -237,6 +237,9 @@ for env in ["nt4_dc", "nt4_member", "ad_member", "ad_dc", "ad_dc_ntvfs", "s4memb plantestsuite("samba3.blackbox.smbclient_machine_auth.plain (%s:local)" % env, "%s:local" % env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_machine_auth.sh"), '$SERVER', smbclient3, configuration]) plantestsuite("samba3.blackbox.smbclient_ntlm.plain (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_ntlm.sh"), '$SERVER', '$DC_USERNAME', '$DC_PASSWORD', "never", smbclient3, configuration]) + +plantestsuite("samba3.blackbox.smbclient_log_basename", "ad_dc", [os.path.join(samba3srcdir, "script/tests/test_smbclient_log_basename.sh"), '$SERVER', smbclient3, '$PREFIX', configuration]) + for options in ["--option=clientntlmv2auth=no", "--option=clientusespnego=no --option=clientntlmv2auth=no", "--option=clientusespnego=no --option=clientntlmv2auth=no -mNT1", ""]: for env in ["nt4_member", "ad_member"]: plantestsuite("samba3.blackbox.smbclient_auth.plain (%s) %s" % (env, options), env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_auth.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration, options]) -- 2.26.2 From 9086bbbcf43f89e9309f3b1a1764b49097c5e382 Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Wed, 22 Apr 2020 06:53:42 -0500 Subject: [PATCH 2/2] lib:util: Fix smbclient -l basename dir BUG: https://bugzilla.samba.org/show_bug.cgi?id=14345 Pair-Programmed-With: Andreas Schneider Signed-off-by: Andreas Schneider Signed-off-by: Amit Kumar Reviewed-by: Alexander Bokovoy (cherry picked from commit c83ce5f4f99aef94530411ec82cc03e9935b352d) --- lib/util/debug.c | 8 +++++++- selftest/knownfail.d/smbclog | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) delete mode 100644 selftest/knownfail.d/smbclog diff --git a/lib/util/debug.c b/lib/util/debug.c index c42022ec9bb..6b5d5f9bd0c 100644 --- a/lib/util/debug.c +++ b/lib/util/debug.c @@ -1140,9 +1140,15 @@ bool reopen_logs_internal(void) dbgc_config[DBGC_ALL].fd = 2; return true; - case DEBUG_FILE: + case DEBUG_FILE: { + struct debug_backend *b = debug_find_backend("file"); + + if (b != NULL) { + b->log_level = dbgc_config[DBGC_ALL].loglevel; + } break; } + } oldumask = umask( 022 ); diff --git a/selftest/knownfail.d/smbclog b/selftest/knownfail.d/smbclog deleted file mode 100644 index bfe1bfeda7c..00000000000 --- a/selftest/knownfail.d/smbclog +++ /dev/null @@ -1 +0,0 @@ - ^samba3.blackbox.smbclient_log_basename -- 2.26.2