|
|
bec1a9 |
From 7417ea49cc998d07e0208736269b40f8ac3f2c48 Mon Sep 17 00:00:00 2001
|
|
|
bec1a9 |
From: Andreas Schneider <asn@samba.org>
|
|
|
bec1a9 |
Date: Mon, 19 Jun 2017 14:50:33 +0200
|
|
|
bec1a9 |
Subject: [PATCH 1/2] s3:popt_common: Reparse the username in
|
|
|
bec1a9 |
popt_common_credentials_post()
|
|
|
bec1a9 |
|
|
|
bec1a9 |
When we parse the username in the options handling, the smb.conf file
|
|
|
bec1a9 |
has not been loaded yet. So we are not aware of a 'winbind separator'
|
|
|
bec1a9 |
set in the config file.
|
|
|
bec1a9 |
|
|
|
bec1a9 |
We need to read and set the username again in the post-processing of the
|
|
|
bec1a9 |
credentials.
|
|
|
bec1a9 |
|
|
|
bec1a9 |
https://bugzilla.samba.org/show_bug.cgi?id=12849
|
|
|
bec1a9 |
|
|
|
bec1a9 |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
bec1a9 |
Reviewed-by: Stefan Metzmacher <metze@samba.org>
|
|
|
bec1a9 |
(cherry picked from commit 0caf40ec0196de0de016fda0d4aff0734d498d2b)
|
|
|
bec1a9 |
---
|
|
|
bec1a9 |
source3/lib/popt_common.c | 15 +++++++++++++++
|
|
|
bec1a9 |
1 file changed, 15 insertions(+)
|
|
|
bec1a9 |
|
|
|
bec1a9 |
diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c
|
|
|
bec1a9 |
index 3589a4fbd2b..9928c708e89 100644
|
|
|
bec1a9 |
--- a/source3/lib/popt_common.c
|
|
|
bec1a9 |
+++ b/source3/lib/popt_common.c
|
|
|
bec1a9 |
@@ -238,6 +238,7 @@ void popt_common_credentials_set_delay_post(void)
|
|
|
bec1a9 |
void popt_common_credentials_post(void)
|
|
|
bec1a9 |
{
|
|
|
bec1a9 |
struct user_auth_info *auth_info = cmdline_auth_info;
|
|
|
bec1a9 |
+ const char *username = NULL;
|
|
|
bec1a9 |
|
|
|
bec1a9 |
if (get_cmdline_auth_info_use_machine_account(auth_info) &&
|
|
|
bec1a9 |
!set_cmdline_auth_info_machine_account_creds(auth_info))
|
|
|
bec1a9 |
@@ -248,6 +249,20 @@ void popt_common_credentials_post(void)
|
|
|
bec1a9 |
}
|
|
|
bec1a9 |
|
|
|
bec1a9 |
set_cmdline_auth_info_getpass(auth_info);
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
+ /*
|
|
|
bec1a9 |
+ * When we set the username during the handling of the options passed to
|
|
|
bec1a9 |
+ * the binary we haven't loaded the config yet. This means that we
|
|
|
bec1a9 |
+ * didnn't take the 'winbind separator' into account.
|
|
|
bec1a9 |
+ *
|
|
|
bec1a9 |
+ * The username might contain the domain name and thus it hasn't been
|
|
|
bec1a9 |
+ * correctly parsed yet. If we have a username we need to set it again
|
|
|
bec1a9 |
+ * to run the string parser for the username correctly.
|
|
|
bec1a9 |
+ */
|
|
|
bec1a9 |
+ username = get_cmdline_auth_info_username(auth_info);
|
|
|
bec1a9 |
+ if (username != NULL && username[0] != '\0') {
|
|
|
bec1a9 |
+ set_cmdline_auth_info_username(auth_info, username);
|
|
|
bec1a9 |
+ }
|
|
|
bec1a9 |
}
|
|
|
bec1a9 |
|
|
|
bec1a9 |
static void popt_common_credentials_callback(poptContext con,
|
|
|
bec1a9 |
--
|
|
|
bec1a9 |
2.13.1
|
|
|
bec1a9 |
|
|
|
bec1a9 |
|
|
|
bec1a9 |
From 5143e70481e5b47f37a2eb16a8b74bf74d8ec639 Mon Sep 17 00:00:00 2001
|
|
|
bec1a9 |
From: Andreas Schneider <asn@samba.org>
|
|
|
bec1a9 |
Date: Mon, 19 Jun 2017 15:52:23 +0200
|
|
|
bec1a9 |
Subject: [PATCH 2/2] s3:tests: Add test for smbclient -UDOMAIN+username
|
|
|
bec1a9 |
|
|
|
bec1a9 |
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12849
|
|
|
bec1a9 |
|
|
|
bec1a9 |
Signed-off-by: Andreas Schneider <asn@samba.org>
|
|
|
bec1a9 |
Reviewed-by: Stefan Metzmacher <metze@samba.org>
|
|
|
bec1a9 |
|
|
|
bec1a9 |
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
|
|
|
bec1a9 |
Autobuild-Date(master): Tue Jun 20 14:48:33 CEST 2017 on sn-devel-144
|
|
|
bec1a9 |
|
|
|
bec1a9 |
(cherry picked from commit e60aeb6f56a26019788442247361ed516bf965af)
|
|
|
bec1a9 |
---
|
|
|
bec1a9 |
source3/script/tests/test_smbclient_basic.sh | 62 ++++++++++++++++++++++++++++
|
|
|
bec1a9 |
source3/selftest/tests.py | 1 +
|
|
|
bec1a9 |
2 files changed, 63 insertions(+)
|
|
|
bec1a9 |
create mode 100755 source3/script/tests/test_smbclient_basic.sh
|
|
|
bec1a9 |
|
|
|
bec1a9 |
diff --git a/source3/script/tests/test_smbclient_basic.sh b/source3/script/tests/test_smbclient_basic.sh
|
|
|
bec1a9 |
new file mode 100755
|
|
|
bec1a9 |
index 00000000000..90e579b68e9
|
|
|
bec1a9 |
--- /dev/null
|
|
|
bec1a9 |
+++ b/source3/script/tests/test_smbclient_basic.sh
|
|
|
bec1a9 |
@@ -0,0 +1,62 @@
|
|
|
bec1a9 |
+#!/bin/sh
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
+# this runs the file serving tests that are expected to pass with samba3 against shares with various options
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
+if [ $# -lt 5 ]; then
|
|
|
bec1a9 |
+cat <
|
|
|
bec1a9 |
+Usage: test_smbclient_basic.sh SERVER SERVER_IP DOMAIN USERNAME PASSWORD SMBCLIENT <smbclient arguments>
|
|
|
bec1a9 |
+EOF
|
|
|
bec1a9 |
+exit 1;
|
|
|
bec1a9 |
+fi
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
+SERVER="$1"
|
|
|
bec1a9 |
+SERVER_IP="$2"
|
|
|
bec1a9 |
+USERNAME="$3"
|
|
|
bec1a9 |
+PASSWORD="$4"
|
|
|
bec1a9 |
+smbclient="$5"
|
|
|
bec1a9 |
+CONFIGURATION="$6"
|
|
|
bec1a9 |
+shift 6
|
|
|
bec1a9 |
+ADDARGS="$@"
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
+incdir=`dirname $0`/../../../testprogs/blackbox
|
|
|
bec1a9 |
+. $incdir/subunit.sh
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
+test_smbclient() {
|
|
|
bec1a9 |
+ name="$1"
|
|
|
bec1a9 |
+ cmd="$2"
|
|
|
bec1a9 |
+ shift
|
|
|
bec1a9 |
+ shift
|
|
|
bec1a9 |
+ echo "test: $name"
|
|
|
bec1a9 |
+ $VALGRIND $smbclient $CONFIGURATION //$SERVER/tmp -c "$cmd" $@
|
|
|
bec1a9 |
+ status=$?
|
|
|
bec1a9 |
+ if [ x$status = x0 ]; then
|
|
|
bec1a9 |
+ echo "success: $name"
|
|
|
bec1a9 |
+ else
|
|
|
bec1a9 |
+ echo "failure: $name"
|
|
|
bec1a9 |
+ fi
|
|
|
bec1a9 |
+ return $status
|
|
|
bec1a9 |
+}
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
+# TEST using \ as the separator (default)
|
|
|
bec1a9 |
+test_smbclient "smbclient as $DOMAIN\\$USERNAME" 'ls' -U$DOMAIN\\$USERNAME%$PASSWORD $CONFIGURATION || failed=`expr $failed + 1`
|
|
|
bec1a9 |
+# TEST using / as the separator (default)
|
|
|
bec1a9 |
+test_smbclient "smbclient as $DOMAIN/$USERNAME" 'ls' -U$DOMAIN/$USERNAME%$PASSWORD $CONFIGURATION || failed=`expr $failed + 1`
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
+# TEST using 'winbind separator = +'
|
|
|
bec1a9 |
+test_smbclient "smbclient as $DOMAIN+$USERNAME" 'ls' -U$DOMAIN+$USERNAME%$PASSWORD $CONFIGURATION --option=winbindseparator=+ || failed=`expr $failed + 1`
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
+# TEST using 'winbind separator = +' set in a config file
|
|
|
bec1a9 |
+smbclient_config="$PREFIX/tmpsmbconf"
|
|
|
bec1a9 |
+cat > $smbclient_config <
|
|
|
bec1a9 |
+[global]
|
|
|
bec1a9 |
+ include = $(echo $CONFIGURATION | cut -d= -f2)
|
|
|
bec1a9 |
+ winbind separator = +
|
|
|
bec1a9 |
+EOF
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
+SAVE_CONFIGURATION="$CONFIGURATION"
|
|
|
bec1a9 |
+CONFIGURATION="--configfile=$smbclient_config"
|
|
|
bec1a9 |
+test_smbclient "smbclient as $DOMAIN+$USERNAME" 'ls' -U$DOMAIN+$USERNAME%$PASSWORD || failed=`expr $failed + 1`
|
|
|
bec1a9 |
+CONFIGURATION="$SAVE_CONFIGURATION"
|
|
|
bec1a9 |
+rm -rf $smbclient_config
|
|
|
bec1a9 |
+
|
|
|
bec1a9 |
+exit $failed
|
|
|
bec1a9 |
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
|
|
|
bec1a9 |
index dfe7866b283..d3cb071b903 100755
|
|
|
bec1a9 |
--- a/source3/selftest/tests.py
|
|
|
bec1a9 |
+++ b/source3/selftest/tests.py
|
|
|
bec1a9 |
@@ -152,6 +152,7 @@ plantestsuite("samba.vfstest.xattr-tdb-1", "nt4_dc:local", [os.path.join(samba3s
|
|
|
bec1a9 |
plantestsuite("samba.vfstest.acl", "nt4_dc:local", [os.path.join(samba3srcdir, "script/tests/vfstest-acl/run.sh"), binpath("vfstest"), "$PREFIX", configuration])
|
|
|
bec1a9 |
plantestsuite("samba.vfstest.catia", "nt4_dc:local", [os.path.join(samba3srcdir, "script/tests/vfstest-catia/run.sh"), binpath("vfstest"), "$PREFIX", configuration])
|
|
|
bec1a9 |
|
|
|
bec1a9 |
+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])
|
|
|
bec1a9 |
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"]:
|
|
|
bec1a9 |
env = "nt4_dc"
|
|
|
bec1a9 |
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])
|
|
|
bec1a9 |
--
|
|
|
bec1a9 |
2.13.1
|
|
|
bec1a9 |
|