HACK FSCTL_LMR_REQ_RESILIENCY...
authorStefan Metzmacher <metze@samba.org>
Fri, 5 Sep 2014 22:11:03 +0000 (00:11 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 15 Oct 2019 07:36:22 +0000 (09:36 +0200)
source3/librpc/idl/smbXsrv.idl
source3/smbd/smb2_ioctl_network_fs.c
source3/smbd/smb2_lock.c

index c7acdff3b4e06b13cdcab69b7f559aadce134f2b..d03ed445d2ebdb9cad6266c48f10ee7ccd291817 100644 (file)
@@ -435,6 +435,7 @@ interface smbXsrv
                DATA_BLOB                               backend_cookie;
                uint16                                  channel_sequence;
                hyper                                   channel_generation;
+               boolean8                                is_resilient; //TODO
                [flag(NDR_PAHEX)] uint8                 lock_sequence_array[64];
        } smbXsrv_open_global0;
 
index 8154fa3f92ed2ea7986bdf0642b1422743b2724a..8e10d71f864a0bec8279bc9c028679438203b940 100644 (file)
@@ -511,6 +511,42 @@ static NTSTATUS fsctl_validate_neg_info(TALLOC_CTX *mem_ctx,
        return NT_STATUS_OK;
 }
 
+static NTSTATUS fsctl_network_resiliency(TALLOC_CTX *mem_ctx,
+                                        struct tevent_context *ev,
+                                        struct files_struct *in_fsp,
+                                        DATA_BLOB *in_input,
+                                        uint32_t in_max_output,
+                                        DATA_BLOB *out_output)
+{
+       NTSTATUS status;
+       uint32_t in_timeout;
+
+       *out_output = data_blob_null;
+
+       if (in_fsp == NULL) {
+               return NT_STATUS_FILE_CLOSED;
+       }
+
+       if (in_input->length < 8) {
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       in_timeout = IVAL(in_input->data, 0);
+       if (in_timeout > 300000) {
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       in_fsp->op->global->is_resilient = true;
+
+       status = smbXsrv_open_update(in_fsp->op);
+       if (!NT_STATUS_IS_OK(status)) {
+               in_fsp->op->global->is_resilient = false;
+               return status;
+       }
+
+       return NT_STATUS_OK;
+}
+
 static void smb2_ioctl_network_fs_copychunk_done(struct tevent_req *subreq);
 static void smb2_ioctl_network_fs_offload_read_done(struct tevent_req *subreq);
 
@@ -593,7 +629,17 @@ struct tevent_req *smb2_ioctl_network_fs(uint32_t ctl_code,
                tevent_req_set_callback(
                        subreq, smb2_ioctl_network_fs_offload_read_done, req);
                return req;
-
+       case FSCTL_LMR_REQ_RESILIENCY:
+               status = fsctl_network_resiliency(state, ev,
+                                                 state->fsp,
+                                                 &state->in_input,
+                                                 state->in_max_output,
+                                                 &state->out_output);
+               if (!tevent_req_nterror(req, status)) {
+                       tevent_req_done(req);
+               }
+               return tevent_req_post(req, ev);
+               break;
        default: {
                uint8_t *out_data = NULL;
                uint32_t out_data_len = 0;
index 9f0c1ffeb7f4d64a1382f38c07b5675a3d0c2eeb..43bfd168de029ed0e4951fe111c5accc04bae3ce 100644 (file)
@@ -274,6 +274,9 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
         *
         * We implement what the specification says.
         */
+       if (fsp->op->global->is_resilient) {
+               check_lock_sequence = true;
+       }
        if (smb2req->xconn->protocol >= PROTOCOL_SMB2_22) {
                check_lock_sequence = true;
        }