summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-09-21 04:41:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:56 -0500
commited4d10fb43ea462500dbaf690b8e04d910bfac4e (patch)
treea3cb8b7ffc219540ba5c82c47af62efebe1c898f
parent6108ead954121c52f1595fb68afe7e96964edf4a (diff)
downloadsamba-ed4d10fb43ea462500dbaf690b8e04d910bfac4e.tar.gz
samba-ed4d10fb43ea462500dbaf690b8e04d910bfac4e.tar.bz2
samba-ed4d10fb43ea462500dbaf690b8e04d910bfac4e.zip
r2463: make sure we don't send the password in a tconx unless we really have to
(This used to be commit 3e84c06f4c76d62f4f2606b457d9a76b6c1a061d)
-rw-r--r--source4/libcli/cliconnect.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index 220a450433..f25f29f86e 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -99,7 +99,7 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli,
/* wrapper around smb_tree_connect() */
NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename,
- const char *devtype, const char *password)
+ const char *devtype, const char *password)
{
union smb_tcon tcon;
TALLOC_CTX *mem_ctx;
@@ -110,17 +110,25 @@ NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename,
cli->tree->reference_count++;
+ mem_ctx = talloc_init("tcon");
+ if (!mem_ctx) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
/* setup a tree connect */
tcon.generic.level = RAW_TCON_TCONX;
tcon.tconx.in.flags = 0;
- tcon.tconx.in.password = data_blob(password, strlen(password)+1);
+ if (cli->transport->negotiate.sec_mode & NEGOTIATE_SECURITY_USER_LEVEL) {
+ tcon.tconx.in.password = data_blob(NULL, 0);
+ } else if (cli->transport->negotiate.sec_mode & NEGOTIATE_SECURITY_CHALLENGE_RESPONSE) {
+ tcon.tconx.in.password = data_blob_talloc(mem_ctx, NULL, 16);
+ E_md4hash(password, tcon.tconx.in.password.data);
+ } else {
+ tcon.tconx.in.password = data_blob_talloc(mem_ctx, password, strlen(password)+1);
+ }
tcon.tconx.in.path = sharename;
tcon.tconx.in.device = devtype;
- mem_ctx = talloc_init("tcon");
- if (!mem_ctx)
- return NT_STATUS_NO_MEMORY;
-
status = smb_tree_connect(cli->tree, mem_ctx, &tcon);
cli->tree->tid = tcon.tconx.out.cnum;