svn commit: samba r2463 - in branches/SAMBA_4_0/source/libcli: .
tridge at samba.org
tridge at samba.org
Tue Sep 21 04:41:17 GMT 2004
Author: tridge
Date: 2004-09-21 04:41:17 +0000 (Tue, 21 Sep 2004)
New Revision: 2463
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/libcli&rev=2463&nolog=1
Log:
make sure we don't send the password in a tconx unless we really have to
Modified:
branches/SAMBA_4_0/source/libcli/cliconnect.c
Changeset:
Modified: branches/SAMBA_4_0/source/libcli/cliconnect.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/cliconnect.c 2004-09-21 04:11:48 UTC (rev 2462)
+++ branches/SAMBA_4_0/source/libcli/cliconnect.c 2004-09-21 04:41:17 UTC (rev 2463)
@@ -99,7 +99,7 @@
/* 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 @@
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;
More information about the samba-cvs
mailing list