summaryrefslogtreecommitdiff
path: root/source4/libcli/cliconnect.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-09-22 05:13:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:57 -0500
commit1d2611df82e80d7b5af7f75ffd66ce18ea68858e (patch)
tree43d26c00aef5e23faaca02d02aee4851014d0ca6 /source4/libcli/cliconnect.c
parent787b65b048f2079c51a8f3e8ad36fcd5cde39f12 (diff)
downloadsamba-1d2611df82e80d7b5af7f75ffd66ce18ea68858e.tar.gz
samba-1d2611df82e80d7b5af7f75ffd66ce18ea68858e.tar.bz2
samba-1d2611df82e80d7b5af7f75ffd66ce18ea68858e.zip
r2494: fixed connecting to a share mode server (tested and really works now)
(This used to be commit 25f725c9be8fe5a7fd85488214b598bc431d4c7f)
Diffstat (limited to 'source4/libcli/cliconnect.c')
-rw-r--r--source4/libcli/cliconnect.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c
index f25f29f86e..66882f605d 100644
--- a/source4/libcli/cliconnect.c
+++ b/source4/libcli/cliconnect.c
@@ -83,7 +83,11 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli,
setup.generic.in.domain = "";
setup.generic.in.capabilities &= ~CAP_EXTENDED_SECURITY;
} else {
- setup.generic.in.password = password;
+ if (cli->transport->negotiate.sec_mode & NEGOTIATE_SECURITY_USER_LEVEL) {
+ setup.generic.in.password = password;
+ } else {
+ setup.generic.in.password = NULL;
+ }
setup.generic.in.user = user;
setup.generic.in.domain = domain;
}
@@ -121,8 +125,11 @@ NTSTATUS smbcli_send_tconX(struct smbcli_state *cli, const char *sharename,
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);
+ tcon.tconx.in.password = data_blob_talloc(mem_ctx, NULL, 24);
+ if (cli->transport->negotiate.secblob.length < 8) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+ SMBencrypt(password, cli->transport->negotiate.secblob.data, tcon.tconx.in.password.data);
} else {
tcon.tconx.in.password = data_blob_talloc(mem_ctx, password, strlen(password)+1);
}