s3:smb2_ioctl: call SMB_VFS_FSCTL() as fallback for non SMB2 specific functions
authorStefan Metzmacher <metze@samba.org>
Thu, 10 May 2012 15:43:36 +0000 (17:43 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 11 May 2012 16:19:50 +0000 (18:19 +0200)
metze

source3/smbd/smb2_ioctl.c

index d537a8798cf04ceb46028a8a94656774d88d3002..a529fc52981d07565b0982f51ec4e6e482d0410a 100644 (file)
@@ -502,14 +502,43 @@ static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
         }
 
-       default:
-               if (IS_IPC(smbreq->conn)) {
-                       tevent_req_nterror(req, NT_STATUS_FS_DRIVER_REQUIRED);
+       default: {
+               uint8_t *out_data = NULL;
+               uint32_t out_data_len = 0;
+               NTSTATUS status;
+
+               if (fsp == NULL) {
+                       tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
                        return tevent_req_post(req, ev);
                }
-               tevent_req_nterror(req, NT_STATUS_INVALID_DEVICE_REQUEST);
+
+               status = SMB_VFS_FSCTL(fsp,
+                                      state,
+                                      in_ctl_code,
+                                      smbreq->flags2,
+                                      in_input.data,
+                                      in_input.length,
+                                      &out_data,
+                                      in_max_output,
+                                      &out_data_len);
+               state->out_output = data_blob_const(out_data, out_data_len);
+               if (NT_STATUS_IS_OK(status)) {
+                       tevent_req_done(req);
+                       return tevent_req_post(req, ev);
+               }
+
+               if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
+                       if (IS_IPC(smbreq->conn)) {
+                               status = NT_STATUS_FS_DRIVER_REQUIRED;
+                       } else {
+                               status = NT_STATUS_INVALID_DEVICE_REQUEST;
+                       }
+               }
+
+               tevent_req_nterror(req, status);
                return tevent_req_post(req, ev);
        }
+       }
 
        tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
        return tevent_req_post(req, ev);