summaryrefslogtreecommitdiffstats
path: root/libcli/smb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-07-19 11:16:16 +0200
committerStefan Metzmacher <metze@samba.org>2012-07-23 18:19:36 +0200
commit7e0982421b1e8b6a73ef67cdb085ffc60cd3b59b (patch)
treea9c06d8634a14b5db8ea09c9c1548c56b4d30182 /libcli/smb
parent5adf63fe301e812f5776448f9560af9d6d842554 (diff)
downloadsamba-7e0982421b1e8b6a73ef67cdb085ffc60cd3b59b.tar.gz
samba-7e0982421b1e8b6a73ef67cdb085ffc60cd3b59b.tar.xz
samba-7e0982421b1e8b6a73ef67cdb085ffc60cd3b59b.zip
libcli/smb: construct the signing_key before forming the message
metze
Diffstat (limited to 'libcli/smb')
-rw-r--r--libcli/smb/smbXcli_base.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index eb9e7d55cfe..9aab0ab563a 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -2558,37 +2558,6 @@ NTSTATUS smb2cli_req_compound_submit(struct tevent_req **reqs,
SBVAL(state->smb2.hdr, SMB2_HDR_MESSAGE_ID, mid);
skip_credits:
- hdr_iov = num_iov;
- iov[num_iov].iov_base = state->smb2.hdr;
- iov[num_iov].iov_len = sizeof(state->smb2.hdr);
- num_iov += 1;
-
- iov[num_iov].iov_base = discard_const(state->smb2.fixed);
- iov[num_iov].iov_len = state->smb2.fixed_len;
- num_iov += 1;
-
- if (state->smb2.dyn != NULL) {
- iov[num_iov].iov_base = discard_const(state->smb2.dyn);
- iov[num_iov].iov_len = state->smb2.dyn_len;
- num_iov += 1;
- }
-
- reqlen = sizeof(state->smb2.hdr);
- reqlen += state->smb2.fixed_len;
- reqlen += state->smb2.dyn_len;
-
- if (i < num_reqs-1) {
- if ((reqlen % 8) > 0) {
- uint8_t pad = 8 - (reqlen % 8);
- iov[num_iov].iov_base = state->smb2.pad;
- iov[num_iov].iov_len = pad;
- num_iov += 1;
- reqlen += pad;
- }
- SIVAL(state->smb2.hdr, SMB2_HDR_NEXT_COMMAND, reqlen);
- }
- nbt_len += reqlen;
-
if (state->session) {
bool should_sign = state->session->smb2.should_sign;
@@ -2622,6 +2591,37 @@ skip_credits:
}
}
+ hdr_iov = num_iov;
+ iov[num_iov].iov_base = state->smb2.hdr;
+ iov[num_iov].iov_len = sizeof(state->smb2.hdr);
+ num_iov += 1;
+
+ iov[num_iov].iov_base = discard_const(state->smb2.fixed);
+ iov[num_iov].iov_len = state->smb2.fixed_len;
+ num_iov += 1;
+
+ if (state->smb2.dyn != NULL) {
+ iov[num_iov].iov_base = discard_const(state->smb2.dyn);
+ iov[num_iov].iov_len = state->smb2.dyn_len;
+ num_iov += 1;
+ }
+
+ reqlen = sizeof(state->smb2.hdr);
+ reqlen += state->smb2.fixed_len;
+ reqlen += state->smb2.dyn_len;
+
+ if (i < num_reqs-1) {
+ if ((reqlen % 8) > 0) {
+ uint8_t pad = 8 - (reqlen % 8);
+ iov[num_iov].iov_base = state->smb2.pad;
+ iov[num_iov].iov_len = pad;
+ num_iov += 1;
+ reqlen += pad;
+ }
+ SIVAL(state->smb2.hdr, SMB2_HDR_NEXT_COMMAND, reqlen);
+ }
+ nbt_len += reqlen;
+
if (signing_key) {
NTSTATUS status;