[SCM] Samba Shared Repository - branch master updated
Andreas Schneider
asn at samba.org
Tue Jun 20 12:49:02 UTC 2017
The branch, master has been updated
via e60aeb6 s3:tests: Add test for smbclient -UDOMAIN+username
via 0caf40e s3:popt_common: Reparse the username in popt_common_credentials_post()
via 5b3c121 selftest: Use 'ad_dc' as the default for testenv
from ac4b788 ctdb-locking: If a record could not be locked, log the key
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit e60aeb6f56a26019788442247361ed516bf965af
Author: Andreas Schneider <asn at samba.org>
Date: Mon Jun 19 15:52:23 2017 +0200
s3:tests: Add test for smbclient -UDOMAIN+username
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12849
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Tue Jun 20 14:48:33 CEST 2017 on sn-devel-144
commit 0caf40ec0196de0de016fda0d4aff0734d498d2b
Author: Andreas Schneider <asn at samba.org>
Date: Mon Jun 19 14:50:33 2017 +0200
s3:popt_common: Reparse the username in popt_common_credentials_post()
When we parse the username in the options handling, the smb.conf file
has not been loaded yet. So we are not aware of a 'winbind separator'
set in the config file.
We need to read and set the username again in the post-processing of the
credentials.
https://bugzilla.samba.org/show_bug.cgi?id=12849
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 5b3c121a261b8e1c99809d16d9e4e4edf7fb2060
Author: Andreas Schneider <asn at samba.org>
Date: Mon Jun 19 14:34:02 2017 +0200
selftest: Use 'ad_dc' as the default for testenv
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
-----------------------------------------------------------------------
Summary of changes:
selftest/selftest.pl | 2 +-
source3/lib/popt_common.c | 16 +++++++
source3/script/tests/test_smbclient_basic.sh | 62 ++++++++++++++++++++++++++++
source3/selftest/tests.py | 1 +
4 files changed, 80 insertions(+), 1 deletion(-)
create mode 100755 source3/script/tests/test_smbclient_basic.sh
Changeset truncated at 500 lines:
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index f05fc5c..6869132 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -445,7 +445,7 @@ if (defined($ENV{SMBD_MAXTIME}) and $ENV{SMBD_MAXTIME} ne "") {
unless ($opt_list) {
if ($opt_target eq "samba") {
- $testenv_default = "ad_dc_ntvfs";
+ $testenv_default = "ad_dc";
require target::Samba;
$target = new Samba($bindir, $ldap, $srcdir, $server_maxtime);
} elsif ($opt_target eq "samba3") {
diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c
index 1c1e3d7..65b6efe 100644
--- a/source3/lib/popt_common.c
+++ b/source3/lib/popt_common.c
@@ -247,6 +247,8 @@ void popt_common_credentials_set_delay_post(void)
void popt_common_credentials_post(void)
{
+ const char *username = NULL;
+
if (get_cmdline_auth_info_use_machine_account(cmdline_auth_info) &&
!set_cmdline_auth_info_machine_account_creds(cmdline_auth_info))
{
@@ -256,6 +258,20 @@ void popt_common_credentials_post(void)
}
set_cmdline_auth_info_getpass(cmdline_auth_info);
+
+ /*
+ * When we set the username during the handling of the options passed to
+ * the binary we haven't loaded the config yet. This means that we
+ * didnn't take the 'winbind separator' into account.
+ *
+ * The username might contain the domain name and thus it hasn't been
+ * correctly parsed yet. If we have a username we need to set it again
+ * to run the string parser for the username correctly.
+ */
+ username = get_cmdline_auth_info_username(cmdline_auth_info);
+ if (username != NULL && username[0] != '\0') {
+ set_cmdline_auth_info_username(cmdline_auth_info, username);
+ }
}
static void popt_common_credentials_callback(poptContext con,
diff --git a/source3/script/tests/test_smbclient_basic.sh b/source3/script/tests/test_smbclient_basic.sh
new file mode 100755
index 0000000..90e579b
--- /dev/null
+++ b/source3/script/tests/test_smbclient_basic.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+# this runs the file serving tests that are expected to pass with samba3 against shares with various options
+
+if [ $# -lt 5 ]; then
+cat <<EOF
+Usage: test_smbclient_basic.sh SERVER SERVER_IP DOMAIN USERNAME PASSWORD SMBCLIENT <smbclient arguments>
+EOF
+exit 1;
+fi
+
+SERVER="$1"
+SERVER_IP="$2"
+USERNAME="$3"
+PASSWORD="$4"
+smbclient="$5"
+CONFIGURATION="$6"
+shift 6
+ADDARGS="$@"
+
+incdir=`dirname $0`/../../../testprogs/blackbox
+. $incdir/subunit.sh
+
+test_smbclient() {
+ name="$1"
+ cmd="$2"
+ shift
+ shift
+ echo "test: $name"
+ $VALGRIND $smbclient $CONFIGURATION //$SERVER/tmp -c "$cmd" $@
+ status=$?
+ if [ x$status = x0 ]; then
+ echo "success: $name"
+ else
+ echo "failure: $name"
+ fi
+ return $status
+}
+
+# TEST using \ as the separator (default)
+test_smbclient "smbclient as $DOMAIN\\$USERNAME" 'ls' -U$DOMAIN\\$USERNAME%$PASSWORD $CONFIGURATION || failed=`expr $failed + 1`
+# TEST using / as the separator (default)
+test_smbclient "smbclient as $DOMAIN/$USERNAME" 'ls' -U$DOMAIN/$USERNAME%$PASSWORD $CONFIGURATION || failed=`expr $failed + 1`
+
+# TEST using 'winbind separator = +'
+test_smbclient "smbclient as $DOMAIN+$USERNAME" 'ls' -U$DOMAIN+$USERNAME%$PASSWORD $CONFIGURATION --option=winbindseparator=+ || failed=`expr $failed + 1`
+
+# TEST using 'winbind separator = +' set in a config file
+smbclient_config="$PREFIX/tmpsmbconf"
+cat > $smbclient_config <<EOF
+[global]
+ include = $(echo $CONFIGURATION | cut -d= -f2)
+ winbind separator = +
+EOF
+
+SAVE_CONFIGURATION="$CONFIGURATION"
+CONFIGURATION="--configfile=$smbclient_config"
+test_smbclient "smbclient as $DOMAIN+$USERNAME" 'ls' -U$DOMAIN+$USERNAME%$PASSWORD || failed=`expr $failed + 1`
+CONFIGURATION="$SAVE_CONFIGURATION"
+rm -rf $smbclient_config
+
+exit $failed
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 965ad7e..ac861e8 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -164,6 +164,7 @@ plantestsuite("samba.vfstest.xattr-tdb-1", "nt4_dc:local", [os.path.join(samba3s
plantestsuite("samba.vfstest.acl", "nt4_dc:local", [os.path.join(samba3srcdir, "script/tests/vfstest-acl/run.sh"), binpath("vfstest"), "$PREFIX", configuration])
plantestsuite("samba.vfstest.catia", "nt4_dc:local", [os.path.join(samba3srcdir, "script/tests/vfstest-catia/run.sh"), binpath("vfstest"), "$PREFIX", configuration])
+plantestsuite("samba3.blackbox.smbclient_basic", "ad_member", [os.path.join(samba3srcdir, "script/tests/test_smbclient_basic.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration])
for options in ["", "--option=clientntlmv2auth=no", "--option=clientusespnego=no", "--option=clientusespnego=no --option=clientntlmv2auth=no", "--option=clientntlmv2auth=no --option=clientlanmanauth=yes --max-protocol=LANMAN2", "--option=clientntlmv2auth=no --option=clientlanmanauth=yes --option=clientmaxprotocol=NT1"]:
env = "nt4_dc"
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])
--
Samba Shared Repository
More information about the samba-cvs
mailing list