]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli/smb: defer singing check a little bit
authorRalph Boehme <slow@samba.org>
Sat, 10 Nov 2018 20:56:28 +0000 (21:56 +0100)
committerKarolin Seeger <kseeger@samba.org>
Fri, 23 Nov 2018 08:01:26 +0000 (09:01 +0100)
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 <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 7abf3900218e3d27c075b405735b2c38ec0fc4ca)

libcli/smb/smbXcli_base.c

index 51702efdb3fedab35f1f2c60e8e29e158a66e43f..07de4297707c3c2b03932a2b0edf068e5488745a 100644 (file)
@@ -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);