HACK FSCTL_LMR_REQ_RESILIENCY...
authorStefan Metzmacher <metze@samba.org>
Fri, 5 Sep 2014 22:11:03 +0000 (00:11 +0200)
committerGünther Deschner <gd@samba.org>
Mon, 19 Sep 2016 20:20:49 +0000 (22:20 +0200)
source3/librpc/idl/smbXsrv.idl
source3/smbd/smb2_ioctl_network_fs.c
source3/smbd/smb2_lock.c

index 624e00c3a3338a3ed5b3093d4371a6f2615a70e0..56955897ff28367c217ea9a720323f1a23cf2a57 100644 (file)
@@ -431,8 +431,8 @@ interface smbXsrv
                boolean8                                durable;
                DATA_BLOB                               backend_cookie;
                hyper                                   channel_sequence;
+               boolean8                                is_resilient; //TODO
                [flag(NDR_PAHEX)] uint8                 lock_sequence_array[64];
-               hyper                                   channel_sequence;
        } smbXsrv_open_global0;
 
        typedef union {
index c2b889b830db2117cf32aa91398cf7a06ce4cfbf..63e34c2d7b84a05168d017886a55eebae1f4ef13 100644 (file)
@@ -620,6 +620,42 @@ static NTSTATUS fsctl_srv_req_resume_key(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);
 
 struct tevent_req *smb2_ioctl_network_fs(uint32_t ctl_code,
@@ -698,6 +734,17 @@ struct tevent_req *smb2_ioctl_network_fs(uint32_t ctl_code,
                }
                return tevent_req_post(req, ev);
                break;
+       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 d62065ee8088ce1ef61d1beca24d97eef6b89a37..2652f7a6acd3fc648493d5dc20048c3c5b1b4d14 100644 (file)
@@ -231,6 +231,10 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
                check_lock_sequence = true;
        }
 
+       if (fsp->op->global->is_resilient) {
+               check_lock_sequence = true;
+       }
+
        if (check_lock_sequence) {
                state->lock_sequence_value = in_lock_sequence & 0xF;
                lock_sequence_bucket = in_lock_sequence >> 4;