The branch, master has been updated via a55ac51 s3:rpcclient add -m option via d0cdf02 s3:selftest add a test for rpcclient --pw-nt-hash option via 4fe5987 s3:rpcclient make --pw-nt-hash option work from 86dbdce s3:rpc_server/samr: simplify the logic in get_user_info_18()
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit a55ac51f5f67c61bda1fee7067ad7d09a0c1efdf Author: Christian Ambach <a...@samba.org> Date: Wed May 11 18:54:58 2016 +0200 s3:rpcclient add -m option Signed-off-by: Christian Ambach <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Thu May 12 17:36:09 CEST 2016 on sn-devel-144 commit d0cdf02dc9733dae960021ff1ca07587d8155e58 Author: Christian Ambach <a...@samba.org> Date: Wed May 11 19:21:20 2016 +0200 s3:selftest add a test for rpcclient --pw-nt-hash option Signed-off-by: Christian Ambach <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 4fe59879cc2a608194578e33e27e0dc1e2f0fc58 Author: Christian Ambach <a...@samba.org> Date: Wed May 11 17:41:24 2016 +0200 s3:rpcclient make --pw-nt-hash option work Bug: https://bugzilla.samba.org/show_bug.cgi?id=10796 Signed-off-by: Christian Ambach <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: docs-xml/manpages/rpcclient.1.xml | 14 ++++++++++++ source3/rpcclient/rpcclient.c | 8 +++++++ source3/script/tests/test_rpcclient_pw_nt_hash.sh | 27 +++++++++++++++++++++++ source3/selftest/tests.py | 5 +++++ 4 files changed, 54 insertions(+) create mode 100755 source3/script/tests/test_rpcclient_pw_nt_hash.sh Changeset truncated at 500 lines: diff --git a/docs-xml/manpages/rpcclient.1.xml b/docs-xml/manpages/rpcclient.1.xml index fcdd0c6..2ce1443 100644 --- a/docs-xml/manpages/rpcclient.1.xml +++ b/docs-xml/manpages/rpcclient.1.xml @@ -24,6 +24,7 @@ <arg choice="opt">-c <command string></arg> <arg choice="opt">-d debuglevel</arg> <arg choice="opt">-l logdir</arg> + <arg choice="opt">-m maxprotocol</arg> <arg choice="opt">-N</arg> <arg choice="opt">-s <smb config file></arg> <arg choice="opt">-U username[%password]</arg> @@ -86,6 +87,19 @@ </varlistentry> <varlistentry> + <term>-m|--max-protocol protocol</term> + <listitem><para>This allows the user to select the + highest SMB protocol level that rpcclient will use to + connect to the server. By default this is set to + NT1, which is the highest available SMB1 protocol. + To connect using SMB2 or SMB3 protocol, use the + strings SMB2 or SMB3 respectively. Note that to connect + to a Windows 2012 server with encrypted transport selecting + a max-protocol of SMB3 is required. + </para></listitem> + </varlistentry> + + <varlistentry> <term>-p|--port port</term> <listitem><para>This number is the TCP port number that will be used when making connections to the server. The standard (well-known) diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index c32fbc7..44d691b 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -913,6 +913,7 @@ out_free: {"command", 'c', POPT_ARG_STRING, &cmdstr, 'c', "Execute semicolon separated cmds", "COMMANDS"}, {"dest-ip", 'I', POPT_ARG_STRING, &opt_ipaddr, 'I', "Specify destination IP address", "IP"}, {"port", 'p', POPT_ARG_INT, &opt_port, 'p', "Specify port number", "PORT"}, + {"max-protocol", 'm', POPT_ARG_STRING, NULL, 'm', "Set the max protocol level", "LEVEL" }, POPT_COMMON_SAMBA POPT_COMMON_CONNECTION POPT_COMMON_CREDENTIALS @@ -949,6 +950,10 @@ out_free: while((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { + case 'm': + lp_set_cmdline("client max protocol", poptGetOptArg(pc)); + break; + case 'I': if (!interpret_string_addr(&server_ss, opt_ipaddr, @@ -1084,6 +1089,9 @@ out_free: if (get_cmdline_auth_info_use_ccache(rpcclient_auth_info)) { flags |= CLI_FULL_CONNECTION_USE_CCACHE; } + if (get_cmdline_auth_info_use_pw_nt_hash(rpcclient_auth_info)) { + flags |= CLI_FULL_CONNECTION_USE_NT_HASH; + } user = talloc_strdup(frame, get_cmdline_auth_info_username(rpcclient_auth_info)); SMB_ASSERT(user != NULL); diff --git a/source3/script/tests/test_rpcclient_pw_nt_hash.sh b/source3/script/tests/test_rpcclient_pw_nt_hash.sh new file mode 100755 index 0000000..c03d22f --- /dev/null +++ b/source3/script/tests/test_rpcclient_pw_nt_hash.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Blackbox tests for the rpcclient --pw-nt-hash option +# + +if [ $# -lt 4 ]; then +cat <<EOF +Usage: test_rpcclient_pw_nt_hash.sh USERNAME PASSWORD SERVER RPCCLIENT +EOF +exit 1; +fi + +USERNAME="$1" +PASSWORD="$2" +SERVER="$3" +RPCCLIENT="$4" + +HASH=`echo -n $PASSWORD | iconv -t utf16le | openssl md4 |cut -d ' ' -f2` + +RPCCLIENTCMD="$RPCCLIENT $SERVER --pw-nt-hash -U$USERNAME%$HASH -c queryuser" + +incdir=$(dirname $0)/../../../testprogs/blackbox +. $incdir/subunit.sh + +testit "rpcclient --pw-nt-hash" $RPCCLIENTCMD || failed=`expr $failed + 1` + +testok $0 $failed diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index 077510c..4ecb3f1 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -464,6 +464,11 @@ plantestsuite("samba3.blackbox.rpcclient_srvsvc", "simpleserver", "$USERNAME", "$PASSWORD", "$SERVER", os.path.join(bindir(), "rpcclient"), "tmp"]) +plantestsuite("samba3.blackbox.rpcclient.pw-nt-hash", "simpleserver", + [os.path.join(samba3srcdir, "script/tests/test_rpcclient_pw_nt_hash.sh"), + "$USERNAME", "$PASSWORD", "$SERVER", + os.path.join(bindir(), "rpcclient")]) + options_list = ["", "-e"] for options in options_list: plantestsuite("samba3.blackbox.smbclient_krb5 old ccache %s" % options, "ktest:local", -- Samba Shared Repository