smb2srv: sign replies when the request was also signed
authorStefan Metzmacher <metze@samba.org>
Wed, 13 Aug 2008 13:20:18 +0000 (15:20 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 14 Aug 2008 11:13:50 +0000 (13:13 +0200)
metze

source/smb_server/smb2/receive.c
source/smb_server/smb2/smb2_server.h

index 007125c4c49c22492bf11e1f35bad408722ef74a..bcc91e4ee3c53e932fc31916a95ed6b84e7ea95f 100644 (file)
@@ -236,7 +236,7 @@ void smb2srv_send_reply(struct smb2srv_request *req)
        }
 
        /* if signing is active on the session then sign the packet */
-       if (req->session && req->session->smb2_signing.active) {
+       if (req->is_signed) {
                status = smb2_sign_message(&req->out, 
                                           req->session->session_info->session_key);
                if (!NT_STATUS_IS_OK(status)) {
@@ -310,12 +310,7 @@ static NTSTATUS smb2srv_reply(struct smb2srv_request *req)
 
                if (!req->session) goto nosession;
 
-               if (!req->session->smb2_signing.active) {
-                       /* TODO: workout the correct error code */
-                       smb2srv_send_error(req, NT_STATUS_FOOBAR);
-                       return NT_STATUS_OK;
-               }
-
+               req->is_signed = true;
                status = smb2_check_signature(&req->in, 
                                              req->session->session_info->session_key);
                if (!NT_STATUS_IS_OK(status)) {
index ae4abbd71e1b440cdadff6cd849447ff0baef649..d45e0861af4a422bdb2c756c7c457623318eca61 100644 (file)
@@ -62,6 +62,8 @@ struct smb2srv_request {
        uint8_t _chained_file_handle[16];
        uint8_t *chained_file_handle;
 
+       bool is_signed;
+
        struct smb2_request_buffer in;
        struct smb2_request_buffer out;
 };