libcli/smb: support additional_flags = SMB2_HDR_FLAG_SIGNED
authorStefan Metzmacher <metze@samba.org>
Wed, 24 Sep 2014 23:22:29 +0000 (01:22 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 30 Sep 2014 21:35:08 +0000 (23:35 +0200)
With SMB2_HDR_FLAG_SIGNED we make sure that we either use smb2 signing
or smb2 encryption for the request.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
libcli/smb/smbXcli_base.c

index 6c367aeb9455488a44d8d7f4067b54926052eb50..113699c6b718ba9aa40b2ea824aeb60e3b1d0de1 100644 (file)
@@ -2679,6 +2679,16 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
                    session->smb2_channel.signing_key.length == 0) {
                        state->smb2.should_encrypt = false;
                }
+
+               if (additional_flags & SMB2_HDR_FLAG_SIGNED) {
+                       if (session->smb2_channel.signing_key.length == 0) {
+                               tevent_req_nterror(req, NT_STATUS_NO_USER_SESSION_KEY);
+                               return req;
+                       }
+
+                       additional_flags &= ~SMB2_HDR_FLAG_SIGNED;
+                       state->smb2.should_sign = true;
+               }
        }
 
        if (tcon) {