From 4ba496bf3c13c567b7a2617133e0bc7f5a2c8f1f Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Sat, 10 Nov 2018 21:56:28 +0100 Subject: libcli/smb: defer singing check a little bit This allows adding an additional condition to the if check where the condition state may be modified in the "if (opcode == SMB2_OP_SESSSETUP)" case directly above. No change in behaviour. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13661 Signed-off-by: Ralph Boehme Reviewed-by: Andreas Schneider (cherry picked from commit 7abf3900218e3d27c075b405735b2c38ec0fc4ca) --- libcli/smb/smbXcli_base.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libcli') diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index 51702efdb3f..07de4297707 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -3752,12 +3752,6 @@ static NTSTATUS smb2cli_conn_dispatch_incoming(struct smbXcli_conn *conn, } last_session = session; - if (state->smb2.should_sign) { - if (!(flags & SMB2_HDR_FLAG_SIGNED)) { - return NT_STATUS_ACCESS_DENIED; - } - } - if (flags & SMB2_HDR_FLAG_SIGNED) { uint64_t uid = BVAL(inhdr, SMB2_HDR_SESSION_ID); @@ -3806,6 +3800,12 @@ static NTSTATUS smb2cli_conn_dispatch_incoming(struct smbXcli_conn *conn, } } + if (state->smb2.should_sign) { + if (!(flags & SMB2_HDR_FLAG_SIGNED)) { + return NT_STATUS_ACCESS_DENIED; + } + } + if (cur[0].iov_len == SMB2_TF_HDR_SIZE) { const uint8_t *tf = (const uint8_t *)cur[0].iov_base; uint64_t uid = BVAL(tf, SMB2_TF_SESSION_ID); -- cgit v1.2.1