r15532: add a BOOL body_dynamic_present, because the body_dynamic_size can be 0
[ab/samba.git/.git] / source4 / smb_server / smb2 / receive.c
index e27e622a4a9b1c2e43db5d5b80cba79c463b719e..abd825adcc774c20316594da39a62ec31e13bb01 100644 (file)
@@ -41,8 +41,17 @@ static struct smb2srv_request *smb2srv_init_request(struct smbsrv_connection *sm
        return req;
 }
 
-NTSTATUS smb2srv_setup_reply(struct smb2srv_request *req, uint_t body_fixed_size, size_t body_dynamic_size)
+NTSTATUS smb2srv_setup_reply(struct smb2srv_request *req, uint16_t body_fixed_size,
+                            BOOL body_dynamic_present, uint32_t body_dynamic_size)
 {
+       if (body_dynamic_present) {
+               if (body_dynamic_size == 0) {
+                       body_dynamic_size = 1;
+               }
+       } else {
+               body_dynamic_size = 0;
+       }
+
        req->out.size           = SMB2_HDR_BODY+NBT_HDR_SIZE+body_fixed_size;
 
        req->out.allocated      = req->out.size + body_dynamic_size;
@@ -103,7 +112,7 @@ void smb2srv_send_error(struct smb2srv_request *req, NTSTATUS error)
 {
        NTSTATUS status;
 
-       status = smb2srv_setup_reply(req, 8, 1);
+       status = smb2srv_setup_reply(req, 8, True, 0);
        if (!NT_STATUS_IS_OK(status)) {
                smbsrv_terminate_connection(req->smb_conn, nt_errstr(status));
                talloc_free(req);