summaryrefslogtreecommitdiffstats
path: root/source/libsmb/smbencrypt.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-06-16 04:21:56 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-06-16 04:21:56 +0000
commit1dc5a8765876c1ca822e454651f8fd4a551965e9 (patch)
tree1c989c0b3cff1cbe1626d4d224ed1387391e1d3d /source/libsmb/smbencrypt.c
parentbda8f12ff551f24a6f2a8e8f7a120b2e0e45a269 (diff)
downloadsamba-1dc5a8765876c1ca822e454651f8fd4a551965e9.tar.gz
samba-1dc5a8765876c1ca822e454651f8fd4a551965e9.tar.xz
samba-1dc5a8765876c1ca822e454651f8fd4a551965e9.zip
Fix up some of the SMB signing code:
The problem was that *all* packets were being signed, even packets before signing was set up. (This broke the session request). This fixes it to be an 'opt in' measure - that is, we only attempt to sign things after we have got a valid, non-guest session setup as per the CIFS spec. I've not tested this against an MS server, becouse my VMware is down, but at least it doesn't break the build farm any more. Andrew Bartlett
Diffstat (limited to 'source/libsmb/smbencrypt.c')
-rw-r--r--source/libsmb/smbencrypt.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/libsmb/smbencrypt.c b/source/libsmb/smbencrypt.c
index 29e168f7bf4..9ae6da0ced9 100644
--- a/source/libsmb/smbencrypt.c
+++ b/source/libsmb/smbencrypt.c
@@ -343,6 +343,8 @@ void cli_calculate_mac_key(struct cli_state *cli, const unsigned char *ntpasswd,
E_md4hash(ntpasswd,&cli->sign_info.mac_key[0]);
memcpy(&cli->sign_info.mac_key[16],resp,24);
cli->sign_info.mac_key_len = 40;
+ cli->sign_info.use_smb_signing = True;
+
}
/***********************************************************
@@ -354,6 +356,14 @@ void cli_caclulate_sign_mac(struct cli_state *cli)
unsigned char calc_md5_mac[16];
struct MD5Context md5_ctx;
+ if (!cli->sign_info.use_smb_signing) {
+ return;
+ }
+
+ /* These calls are INCONPATIBLE with SMB signing */
+ cli->readbraw_supported = False;
+ cli->writebraw_supported = False;
+
/*
* Firstly put the sequence number into the first 4 bytes.
* and zero out the next 4 bytes.