Revert "source3/smbd"
[metze/samba/wip.git] / source3 / smbd / smb2_ioctl.c
index 3592c74b495c50ef6bcd81e998f52771e60fefcc..9471e2f6caec13d6da8afaac48a2ace4dfd0d130 100644 (file)
@@ -30,7 +30,6 @@ static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx,
                                               struct tevent_context *ev,
                                               struct smbd_smb2_request *smb2req,
                                               uint32_t in_ctl_code,
-                                              uint64_t in_file_id_persistent,
                                               uint64_t in_file_id_volatile,
                                               DATA_BLOB in_input,
                                               uint32_t in_max_output,
@@ -89,11 +88,19 @@ NTSTATUS smbd_smb2_request_process_ioctl(struct smbd_smb2_request *req)
        in_input_buffer.data = (uint8_t *)req->in.vector[i+2].iov_base;
        in_input_buffer.length = in_input_length;
 
+       if (req->compat_chain_fsp) {
+               /* skip check */
+       } else if (in_file_id_persistent == UINT64_MAX &&
+                  in_file_id_volatile == UINT64_MAX) {
+               /* without a handle */
+       } else if (in_file_id_persistent != in_file_id_volatile) {
+               return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
+       }
+
        subreq = smbd_smb2_ioctl_send(req,
                                      req->sconn->ev_ctx,
                                      req,
                                      in_ctl_code,
-                                     in_file_id_persistent,
                                      in_file_id_volatile,
                                      in_input_buffer,
                                      in_max_output_length,
@@ -213,7 +220,6 @@ static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx,
                                               struct tevent_context *ev,
                                               struct smbd_smb2_request *smb2req,
                                               uint32_t in_ctl_code,
-                                              uint64_t in_file_id_persistent,
                                               uint64_t in_file_id_volatile,
                                               DATA_BLOB in_input,
                                               uint32_t in_max_output,
@@ -247,19 +253,12 @@ static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx,
        }
        state->smbreq = smbreq;
 
-       if (in_file_id_volatile != UINT64_MAX &&
-           in_file_id_persistent != UINT64_MAX) {
+       if (in_file_id_volatile != UINT64_MAX) {
                fsp = file_fsp(smbreq, (uint16_t)in_file_id_volatile);
                if (fsp == NULL) {
                        tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
                        return tevent_req_post(req, ev);
                }
-               if (smb2req->compat_chain_fsp) {
-                       /* skip check */
-               } else if (in_file_id_persistent != fsp->smbXsrv->global->open_persistent_id) {
-                       tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
-                       return tevent_req_post(req, ev);
-               }
                if (smbreq->conn != fsp->conn) {
                        tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
                        return tevent_req_post(req, ev);