s4-pvfs: implement root_fid support in posix backend
authorAndrew Tridgell <tridge@samba.org>
Thu, 15 Oct 2009 07:27:21 +0000 (18:27 +1100)
committerAndrew Tridgell <tridge@samba.org>
Thu, 15 Oct 2009 09:03:00 +0000 (20:03 +1100)
Construct the filename from the old handle and the new name.

source4/ntvfs/posix/pvfs_open.c

index 46e39a00dd46c51716ce81f8922cf77e81aa5d35..e8f1c0c4c8c7c3154e20795576201a87f62a6f56 100644 (file)
@@ -1272,6 +1272,21 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
                return NT_STATUS_ACCESS_DENIED;
        }
 
+       /* cope with non-zero root_fid */
+       if (io->ntcreatex.in.root_fid.ntvfs != NULL) {
+               f = pvfs_find_fd(pvfs, req, io->ntcreatex.in.root_fid.ntvfs);
+               if (f == NULL) {
+                       return NT_STATUS_INVALID_HANDLE;
+               }
+               if (f->handle->fd != -1) {
+                       return NT_STATUS_INVALID_DEVICE_REQUEST;
+               }
+               io->ntcreatex.in.fname = talloc_asprintf(req, "%s\\%s", 
+                                                        f->handle->name->original_name,
+                                                        io->ntcreatex.in.fname);
+               NT_STATUS_HAVE_NO_MEMORY(io->ntcreatex.in.fname);                       
+       }
+
        if (io->ntcreatex.in.file_attr & (FILE_ATTRIBUTE_DEVICE|
                                          FILE_ATTRIBUTE_VOLUME| 
                                          (~FILE_ATTRIBUTE_ALL_MASK))) {