vfs: remove root_dir_fid arg from SMB_VFS_CREATE_FILE()
authorRalph Boehme <slow@samba.org>
Thu, 14 May 2020 13:59:33 +0000 (15:59 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 14 May 2020 19:43:27 +0000 (19:43 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu May 14 19:43:27 UTC 2020 on sn-devel-184

24 files changed:
examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
source3/include/vfs.h
source3/include/vfs_macros.h
source3/lib/adouble.c
source3/modules/vfs_default.c
source3/modules/vfs_fruit.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_media_harmony.c
source3/modules/vfs_not_implemented.c
source3/modules/vfs_time_audit.c
source3/modules/vfs_unityed_media.c
source3/modules/vfs_worm.c
source3/printing/nt_printing.c
source3/rpc_server/srvsvc/srv_srvsvc_nt.c
source3/smbd/dosmode.c
source3/smbd/nttrans.c
source3/smbd/open.c
source3/smbd/proto.h
source3/smbd/reply.c
source3/smbd/smb2_create.c
source3/smbd/trans2.c
source3/smbd/vfs.c
source3/utils/net_vfs.c

index 6eb68df3e1ee15b1a79fe55fac3edebc48d1a676..cd04de0dab0c5e14229607b6de3a8d8e6fbb7915 100644 (file)
@@ -200,7 +200,6 @@ static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
 
 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
                                 struct smb_request *req,
-                                uint16_t root_dir_fid,
                                 struct smb_filename *smb_fname,
                                 uint32_t access_mask,
                                 uint32_t share_access,
index 2eb7a7dbcd99764491b71f468ca9290942825671..b95ba1b858d161ca9b15ecf5ac67ed3420e9a3b1 100644 (file)
@@ -208,7 +208,6 @@ static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname,
 
 static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
                                 struct smb_request *req,
-                                uint16_t root_dir_fid,
                                 struct smb_filename *smb_fname,
                                 uint32_t access_mask,
                                 uint32_t share_access,
@@ -227,7 +226,6 @@ static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
 {
        return SMB_VFS_NEXT_CREATE_FILE(handle,
                                        req,
-                                       root_dir_fid,
                                        smb_fname,
                                        access_mask,
                                        share_access,
index 5861b9065f0367861c8f60b738d4b82672ca718d..4780d87c3c2226b1d8b4db228e8e460fedc49edc 100644 (file)
  * Version 43 - convert link_contents arg of SMB_VFS_SYMLINKAT()
  *              to struct smb_filename
  * Version 43 - Move SMB_VFS_GET_NT_ACL() -> SMB_VFS_GET_NT_ACL_AT().
+ * Version 43 - Remove root_dir_fid from SMB_VFS_CREATE_FILE().
  */
 
 #define SMB_VFS_INTERFACE_VERSION 43
@@ -761,7 +762,6 @@ struct vfs_fn_pointers {
                       int flags, mode_t mode);
        NTSTATUS (*create_file_fn)(struct vfs_handle_struct *handle,
                                   struct smb_request *req,
-                                  uint16_t root_dir_fid,
                                   struct smb_filename *smb_fname,
                                   uint32_t access_mask,
                                   uint32_t share_access,
@@ -1273,7 +1273,6 @@ int smb_vfs_call_open(struct vfs_handle_struct *handle,
                      int flags, mode_t mode);
 NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle,
                                  struct smb_request *req,
-                                 uint16_t root_dir_fid,
                                  struct smb_filename *smb_fname,
                                  uint32_t access_mask,
                                  uint32_t share_access,
@@ -1728,7 +1727,6 @@ int vfs_not_implemented_open(vfs_handle_struct *handle,
                             files_struct *fsp, int flags, mode_t mode);
 NTSTATUS vfs_not_implemented_create_file(struct vfs_handle_struct *handle,
                                struct smb_request *req,
-                               uint16_t root_dir_fid,
                                struct smb_filename *smb_fname,
                                uint32_t access_mask,
                                uint32_t share_access,
index 20fe6f9a0cf47882cae388c15fb02cb58c06ab30..65de31af08d43603df3394c95e1150305f3b6a5b 100644 (file)
 #define SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode) \
        smb_vfs_call_open((handle)->next, (fname), (fsp), (flags), (mode))
 
-#define SMB_VFS_CREATE_FILE(conn, req, root_dir_fid, smb_fname, access_mask, share_access, create_disposition, \
+#define SMB_VFS_CREATE_FILE(conn, req, smb_fname, access_mask, share_access, create_disposition, \
         create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo, in_context_blobs, out_context_blobs) \
-        smb_vfs_call_create_file((conn)->vfs_handles, (req), (root_dir_fid), (smb_fname), (access_mask), (share_access), (create_disposition), \
+        smb_vfs_call_create_file((conn)->vfs_handles, (req), (smb_fname), (access_mask), (share_access), (create_disposition), \
         (create_options), (file_attributes), (oplock_request), (lease), (allocation_size), (private_flags), (sd), (ea_list), (result), (pinfo), \
        (in_context_blobs), (out_context_blobs))
-#define SMB_VFS_NEXT_CREATE_FILE(handle, req, root_dir_fid, smb_fname, access_mask, share_access, create_disposition, \
+#define SMB_VFS_NEXT_CREATE_FILE(handle, req, smb_fname, access_mask, share_access, create_disposition, \
        create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo, in_context_blobs, out_context_blobs) \
-       smb_vfs_call_create_file((handle)->next, (req), (root_dir_fid), (smb_fname), (access_mask), (share_access), (create_disposition), \
+       smb_vfs_call_create_file((handle)->next, (req), (smb_fname), (access_mask), (share_access), (create_disposition), \
         (create_options), (file_attributes), (oplock_request), (lease), (allocation_size), (private_flags), (sd), (ea_list), (result), (pinfo), \
        (in_context_blobs), (out_context_blobs))
 
index b5b88e2404b070cb2436ed91ec50983fb3c0a80f..8e8b6a7750363de7df3bd6b4e79a2f70086affb8 100644 (file)
@@ -1109,7 +1109,6 @@ static bool ad_convert_xattr(vfs_handle_struct *handle,
                status = SMB_VFS_CREATE_FILE(
                        handle->conn,                   /* conn */
                        NULL,                           /* req */
-                       0,                              /* root_dir_fid */
                        stream_name,                    /* fname */
                        FILE_GENERIC_WRITE,             /* access_mask */
                        FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */
@@ -1239,7 +1238,6 @@ static bool ad_convert_finderinfo(vfs_handle_struct *handle,
        status = SMB_VFS_CREATE_FILE(
                handle->conn,                   /* conn */
                NULL,                           /* req */
-               0,                              /* root_dir_fid */
                stream_name,                    /* fname */
                FILE_GENERIC_WRITE,             /* access_mask */
                FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */
@@ -1470,7 +1468,6 @@ static bool ad_unconvert_open_ad(TALLOC_CTX *mem_ctx,
        status = SMB_VFS_CREATE_FILE(
                handle->conn,
                NULL,                           /* req */
-               0,                              /* root_dir_fid */
                adpath,
                FILE_READ_DATA|FILE_WRITE_DATA,
                FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
@@ -1522,7 +1519,6 @@ static bool ad_unconvert_get_streams(struct vfs_handle_struct *handle,
        status = SMB_VFS_CREATE_FILE(
                handle->conn,                           /* conn */
                NULL,                                   /* req */
-               0,                                      /* root_dir_fid */
                smb_fname,                              /* fname */
                FILE_READ_ATTRIBUTES,                   /* access_mask */
                (FILE_SHARE_READ | FILE_SHARE_WRITE |   /* share_access */
@@ -1622,7 +1618,6 @@ static bool ad_collect_one_stream(struct vfs_handle_struct *handle,
        status = SMB_VFS_CREATE_FILE(
                handle->conn,
                NULL,                           /* req */
-               0,                              /* root_dir_fid */
                sname,
                FILE_READ_DATA|DELETE_ACCESS,
                FILE_SHARE_READ,
@@ -2084,7 +2079,6 @@ static int ad_open_rsrc(vfs_handle_struct *handle,
        status = SMB_VFS_CREATE_FILE(
                handle->conn,                   /* conn */
                NULL,                           /* req */
-               0,                              /* root_dir_fid */
                adp_smb_fname,
                access_mask,
                share_access,
index 386a34f81d12c6631afa5320e9480c1666f4e6ab..5512938d6a618cf1d59c0e24a9068e82b28e2de3 100644 (file)
@@ -690,7 +690,6 @@ static int vfswrap_open(vfs_handle_struct *handle,
 
 static NTSTATUS vfswrap_create_file(vfs_handle_struct *handle,
                                    struct smb_request *req,
-                                   uint16_t root_dir_fid,
                                    struct smb_filename *smb_fname,
                                    uint32_t access_mask,
                                    uint32_t share_access,
@@ -708,7 +707,7 @@ static NTSTATUS vfswrap_create_file(vfs_handle_struct *handle,
                                    const struct smb2_create_blobs *in_context_blobs,
                                    struct smb2_create_blobs *out_context_blobs)
 {
-       return create_file_default(handle->conn, req, root_dir_fid, smb_fname,
+       return create_file_default(handle->conn, req, smb_fname,
                                   access_mask, share_access,
                                   create_disposition, create_options,
                                   file_attributes, oplock_request, lease,
index a9785e5b4a2c10741fcd12ca85cdc3bb08a60522..7d77393e99a611036d30a72720a6d62b1b3f6325 100644 (file)
@@ -898,7 +898,6 @@ static bool readdir_attr_meta_finderi_stream(
        status = SMB_VFS_CREATE_FILE(
                handle->conn,                           /* conn */
                NULL,                                   /* req */
-               0,                                      /* root_dir_fid */
                stream_name,                            /* fname */
                FILE_READ_DATA,                         /* access_mask */
                (FILE_SHARE_READ | FILE_SHARE_WRITE |   /* share_access */
@@ -3884,7 +3883,6 @@ static int fruit_ftruncate(struct vfs_handle_struct *handle,
 
 static NTSTATUS fruit_create_file(vfs_handle_struct *handle,
                                  struct smb_request *req,
-                                 uint16_t root_dir_fid,
                                  struct smb_filename *smb_fname,
                                  uint32_t access_mask,
                                  uint32_t share_access,
@@ -3939,7 +3937,7 @@ static NTSTATUS fruit_create_file(vfs_handle_struct *handle,
        }
 
        status = SMB_VFS_NEXT_CREATE_FILE(
-               handle, req, root_dir_fid, smb_fname,
+               handle, req, smb_fname,
                access_mask, share_access,
                create_disposition, create_options,
                file_attributes, oplock_request,
@@ -4704,7 +4702,6 @@ static bool fruit_get_bandsize(vfs_handle_struct *handle,
        status = SMB_VFS_NEXT_CREATE_FILE(
                handle,                         /* conn */
                NULL,                           /* req */
-               0,                              /* root_dir_fid */
                smb_fname,                      /* fname */
                FILE_GENERIC_READ,              /* access_mask */
                FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */
index c9b294975f21a86298456ee8cf74857910eec785..07bbfcce9a7297cfe844e18380022017a22a5fd3 100644 (file)
@@ -1093,7 +1093,6 @@ static int smb_full_audit_open(vfs_handle_struct *handle,
 
 static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle,
                                      struct smb_request *req,
-                                     uint16_t root_dir_fid,
                                      struct smb_filename *smb_fname,
                                      uint32_t access_mask,
                                      uint32_t share_access,
@@ -1140,7 +1139,6 @@ static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle,
        result = SMB_VFS_NEXT_CREATE_FILE(
                handle,                                 /* handle */
                req,                                    /* req */
-               root_dir_fid,                           /* root_dir_fid */
                smb_fname,                              /* fname */
                access_mask,                            /* access_mask */
                share_access,                           /* share_access */
index 325a54462950004fc3d50ff85b7990b8c97700ca..cb1b1398214980df2e0a866e8f60325f3e2b3048 100644 (file)
@@ -1105,7 +1105,6 @@ out:
  */
 static NTSTATUS mh_create_file(vfs_handle_struct *handle,
                struct smb_request *req,
-               uint16_t root_dir_fid,
                struct smb_filename *smb_fname,
                uint32_t access_mask,
                uint32_t share_access,
@@ -1135,7 +1134,6 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle,
                status = SMB_VFS_NEXT_CREATE_FILE(
                        handle,
                        req,
-                       root_dir_fid,
                        smb_fname,
                        access_mask,
                        share_access,
@@ -1174,7 +1172,6 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle,
        status = SMB_VFS_NEXT_CREATE_FILE(
                handle,
                req,
-               root_dir_fid,
                clientFname,
                access_mask,
                share_access,
index 6b4abf8de67ad5004142f09187dbbe32de63c460..0cb59abcb319e9c4ae96d317679c868bce5d0fff 100644 (file)
@@ -198,7 +198,6 @@ int vfs_not_implemented_open(vfs_handle_struct *handle,
 
 NTSTATUS vfs_not_implemented_create_file(struct vfs_handle_struct *handle,
                                struct smb_request *req,
-                               uint16_t root_dir_fid,
                                struct smb_filename *smb_fname,
                                uint32_t access_mask,
                                uint32_t share_access,
index c173359c0869a18785da9ad727df515addab46ca..a442e5af3156ccef2e241882612b499d297996f3 100644 (file)
@@ -607,7 +607,6 @@ static int smb_time_audit_open(vfs_handle_struct *handle,
 
 static NTSTATUS smb_time_audit_create_file(vfs_handle_struct *handle,
                                           struct smb_request *req,
-                                          uint16_t root_dir_fid,
                                           struct smb_filename *fname,
                                           uint32_t access_mask,
                                           uint32_t share_access,
@@ -633,7 +632,6 @@ static NTSTATUS smb_time_audit_create_file(vfs_handle_struct *handle,
        result = SMB_VFS_NEXT_CREATE_FILE(
                handle,                                 /* handle */
                req,                                    /* req */
-               root_dir_fid,                           /* root_dir_fid */
                fname,                                  /* fname */
                access_mask,                            /* access_mask */
                share_access,                           /* share_access */
index 4bbabfdbb1d8eda3b904651d1c430a76f81a80e1..70db8f182d1b9f57e51b8b049365a8944631335b 100644 (file)
@@ -826,7 +826,6 @@ err:
 
 static NTSTATUS um_create_file(vfs_handle_struct *handle,
                               struct smb_request *req,
-                              uint16_t root_dir_fid,
                               struct smb_filename *smb_fname,
                               uint32_t access_mask,
                               uint32_t share_access,
@@ -854,7 +853,6 @@ static NTSTATUS um_create_file(vfs_handle_struct *handle,
                return SMB_VFS_NEXT_CREATE_FILE(
                        handle,
                        req,
-                       root_dir_fid,
                        smb_fname,
                        access_mask,
                        share_access,
@@ -889,7 +887,6 @@ static NTSTATUS um_create_file(vfs_handle_struct *handle,
        status = SMB_VFS_NEXT_CREATE_FILE(
                handle,
                req,
-               root_dir_fid,
                client_fname,
                access_mask,
                share_access,
index 9b1a5facae7134a5f3fc1bbf51af8a018c4e9c32..3ae1f9f39e682e7c08cb910727840b2ea1afd1e1 100644 (file)
@@ -24,7 +24,6 @@
 
 static NTSTATUS vfs_worm_create_file(vfs_handle_struct *handle,
                                     struct smb_request *req,
-                                    uint16_t root_dir_fid,
                                     struct smb_filename *smb_fname,
                                     uint32_t access_mask,
                                     uint32_t share_access,
@@ -63,7 +62,7 @@ static NTSTATUS vfs_worm_create_file(vfs_handle_struct *handle,
        }
 
        status = SMB_VFS_NEXT_CREATE_FILE(
-               handle, req, root_dir_fid, smb_fname, access_mask,
+               handle, req, smb_fname, access_mask,
                share_access, create_disposition, create_options,
                file_attributes, oplock_request, lease, allocation_size,
                private_flags, sd, ea_list, result, pinfo,
index 4c7bc481b5a3b396a7c58c8189ba8abc1a6c284e..b36b9a283294ae4a6c05f3bcaf2f3e180a073034 100644 (file)
@@ -843,7 +843,6 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
        status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                NULL,                                   /* req */
-               0,                                      /* root_dir_fid */
                smb_fname,                              /* fname */
                FILE_GENERIC_READ,                      /* access_mask */
                FILE_SHARE_READ | FILE_SHARE_WRITE,     /* share_access */
@@ -898,7 +897,6 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
        status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                NULL,                                   /* req */
-               0,                                      /* root_dir_fid */
                smb_fname,                              /* fname */
                FILE_GENERIC_READ,                      /* access_mask */
                FILE_SHARE_READ | FILE_SHARE_WRITE,     /* share_access */
@@ -1102,7 +1100,6 @@ static uint32_t get_correct_cversion(const struct auth_session_info *session_inf
        nt_status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                NULL,                                   /* req */
-               0,                                      /* root_dir_fid */
                smb_fname,                              /* fname */
                FILE_GENERIC_READ,                      /* access_mask */
                FILE_SHARE_READ | FILE_SHARE_WRITE,     /* share_access */
index f178ada9b8c305ed762bb0530f69e5a959772099..17391424fc0b9f3c2033fa112811f3b97d250b62 100644 (file)
@@ -2414,7 +2414,6 @@ WERROR _srvsvc_NetGetFileSecurity(struct pipes_struct *p,
        nt_status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                NULL,                                   /* req */
-               0,                                      /* root_dir_fid */
                smb_fname,                              /* fname */
                FILE_READ_ATTRIBUTES,                   /* access_mask */
                FILE_SHARE_READ|FILE_SHARE_WRITE,       /* share_access */
@@ -2550,7 +2549,6 @@ WERROR _srvsvc_NetSetFileSecurity(struct pipes_struct *p,
        nt_status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                NULL,                                   /* req */
-               0,                                      /* root_dir_fid */
                smb_fname,                              /* fname */
                FILE_WRITE_ATTRIBUTES,                  /* access_mask */
                FILE_SHARE_READ|FILE_SHARE_WRITE,       /* share_access */
index 9bb8d1c1941659b52a52dfc9641fe0e02745ae2e..f336416b07cfc5ef5a3287423098a9f289328efa 100644 (file)
@@ -1410,7 +1410,6 @@ static NTSTATUS get_file_handle_for_metadata(connection_struct *conn,
        status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                NULL,                                   /* req */
-               0,                                      /* root_dir_fid */
                smb_fname_cp,                           /* fname */
                FILE_WRITE_ATTRIBUTES,                  /* access_mask */
                (FILE_SHARE_READ | FILE_SHARE_WRITE |   /* share_access */
index de218103f6bab6ad5f2114a5edd6b90091a36ac0..307f1254978a5c53a2105e024ff42cccf0e9bdc7 100644 (file)
@@ -656,7 +656,6 @@ void reply_ntcreate_and_X(struct smb_request *req)
        status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
-               0,                                      /* root_dir_fid */
                smb_fname,                              /* fname */
                access_mask,                            /* access_mask */
                share_access,                           /* share_access */
@@ -1339,7 +1338,6 @@ static void call_nt_transact_create(connection_struct *conn,
        status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
-               0,                                      /* root_dir_fid */
                smb_fname,                              /* fname */
                access_mask,                            /* access_mask */
                share_access,                           /* share_access */
@@ -1598,7 +1596,6 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
         status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
-               0,                                      /* root_dir_fid */
                smb_fname_src,                          /* fname */
                FILE_READ_DATA|FILE_READ_ATTRIBUTES|
                        FILE_READ_EA,                   /* access_mask */
@@ -1624,7 +1621,6 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
         status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
-               0,                                      /* root_dir_fid */
                smb_fname_dst,                          /* fname */
                FILE_WRITE_DATA|FILE_WRITE_ATTRIBUTES|
                        FILE_WRITE_EA,                  /* access_mask */
index cc71cce4df48eeca1f53fc71e4725609da54ebb1..9abfe1b6d97018fe229a01ba6825a59f9c10f69f 100644 (file)
@@ -4634,7 +4634,6 @@ NTSTATUS create_directory(connection_struct *conn, struct smb_request *req,
        status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
-               0,                                      /* root_dir_fid */
                smb_dname,                              /* fname */
                FILE_READ_ATTRIBUTES,                   /* access_mask */
                FILE_SHARE_NONE,                        /* share_access */
@@ -4827,7 +4826,6 @@ static NTSTATUS open_streams_for_delete(connection_struct *conn,
                status = SMB_VFS_CREATE_FILE(
                         conn,                  /* conn */
                         NULL,                  /* req */
-                        0,                     /* root_dir_fid */
                         smb_fname_cp,          /* fname */
                         DELETE_ACCESS,         /* access_mask */
                         (FILE_SHARE_READ |     /* share_access */
@@ -5832,130 +5830,8 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
        return status;
 }
 
-/*
- * Calculate the full path name given a relative fid.
- */
-static NTSTATUS get_relative_fid_filename(
-       connection_struct *conn,
-       struct smb_request *req,
-       uint16_t root_dir_fid,
-       const struct smb_filename *smb_fname,
-       struct smb_filename **smb_fname_out)
-{
-       files_struct *dir_fsp;
-       char *parent_fname = NULL;
-       char *new_base_name = NULL;
-       uint32_t ucf_flags = ucf_flags_from_smb_request(req);
-       NTSTATUS status;
-
-       if (root_dir_fid == 0 || !smb_fname) {
-               status = NT_STATUS_INTERNAL_ERROR;
-               goto out;
-       }
-
-       dir_fsp = file_fsp(req, root_dir_fid);
-
-       if (dir_fsp == NULL) {
-               status = NT_STATUS_INVALID_HANDLE;
-               goto out;
-       }
-
-       if (is_ntfs_stream_smb_fname(dir_fsp->fsp_name)) {
-               status = NT_STATUS_INVALID_HANDLE;
-               goto out;
-       }
-
-       if (!dir_fsp->fsp_flags.is_directory) {
-
-               /*
-                * Check to see if this is a mac fork of some kind.
-                */
-
-               if ((conn->fs_capabilities & FILE_NAMED_STREAMS) &&
-                   is_ntfs_stream_smb_fname(smb_fname)) {
-                       status = NT_STATUS_OBJECT_PATH_NOT_FOUND;
-                       goto out;
-               }
-
-               /*
-                 we need to handle the case when we get a
-                 relative open relative to a file and the
-                 pathname is blank - this is a reopen!
-                 (hint from demyn plantenberg)
-               */
-
-               status = NT_STATUS_INVALID_HANDLE;
-               goto out;
-       }
-
-       if (ISDOT(dir_fsp->fsp_name->base_name)) {
-               /*
-                * We're at the toplevel dir, the final file name
-                * must not contain ./, as this is filtered out
-                * normally by srvstr_get_path and unix_convert
-                * explicitly rejects paths containing ./.
-                */
-               parent_fname = talloc_strdup(talloc_tos(), "");
-               if (parent_fname == NULL) {
-                       status = NT_STATUS_NO_MEMORY;
-                       goto out;
-               }
-       } else {
-               size_t dir_name_len = strlen(dir_fsp->fsp_name->base_name);
-
-               /*
-                * Copy in the base directory name.
-                */
-
-               parent_fname = talloc_array(talloc_tos(), char,
-                   dir_name_len+2);
-               if (parent_fname == NULL) {
-                       status = NT_STATUS_NO_MEMORY;
-                       goto out;
-               }
-               memcpy(parent_fname, dir_fsp->fsp_name->base_name,
-                   dir_name_len+1);
-
-               /*
-                * Ensure it ends in a '/'.
-                * We used TALLOC_SIZE +2 to add space for the '/'.
-                */
-
-               if(dir_name_len
-                   && (parent_fname[dir_name_len-1] != '\\')
-                   && (parent_fname[dir_name_len-1] != '/')) {
-                       parent_fname[dir_name_len] = '/';
-                       parent_fname[dir_name_len+1] = '\0';
-               }
-       }
-
-       new_base_name = talloc_asprintf(talloc_tos(), "%s%s", parent_fname,
-                                       smb_fname->base_name);
-       if (new_base_name == NULL) {
-               status = NT_STATUS_NO_MEMORY;
-               goto out;
-       }
-
-       status = filename_convert(req,
-                               conn,
-                               new_base_name,
-                               ucf_flags,
-                               0,
-                               NULL,
-                               smb_fname_out);
-       if (!NT_STATUS_IS_OK(status)) {
-               goto out;
-       }
-
- out:
-       TALLOC_FREE(parent_fname);
-       TALLOC_FREE(new_base_name);
-       return status;
-}
-
 NTSTATUS create_file_default(connection_struct *conn,
                             struct smb_request *req,
-                            uint16_t root_dir_fid,
                             struct smb_filename *smb_fname,
                             uint32_t access_mask,
                             uint32_t share_access,
@@ -5984,7 +5860,7 @@ NTSTATUS create_file_default(connection_struct *conn,
                  "create_disposition = 0x%x create_options = 0x%x "
                  "oplock_request = 0x%x "
                  "private_flags = 0x%x "
-                 "root_dir_fid = 0x%x, ea_list = %p, sd = %p, "
+                 "ea_list = %p, sd = %p, "
                  "fname = %s\n",
                  (unsigned int)access_mask,
                  (unsigned int)file_attributes,
@@ -5993,7 +5869,6 @@ NTSTATUS create_file_default(connection_struct *conn,
                  (unsigned int)create_options,
                  (unsigned int)oplock_request,
                  (unsigned int)private_flags,
-                 (unsigned int)root_dir_fid,
                  ea_list, sd, smb_fname_str_dbg(smb_fname));
 
        if (req != NULL) {
@@ -6005,20 +5880,6 @@ NTSTATUS create_file_default(connection_struct *conn,
                get_deferred_open_message_state(req, &req->request_time, NULL);
        }
 
-       /*
-        * Calculate the filename from the root_dir_if if necessary.
-        */
-
-       if (root_dir_fid != 0) {
-               struct smb_filename *smb_fname_out = NULL;
-               status = get_relative_fid_filename(conn, req, root_dir_fid,
-                                                  smb_fname, &smb_fname_out);
-               if (!NT_STATUS_IS_OK(status)) {
-                       goto fail;
-               }
-               smb_fname = smb_fname_out;
-       }
-
        /*
         * Check to see if this is a mac fork of some kind.
         */
index ba72fb94e0fc7dfee00fc7ac0bb4d44697e47e8a..2476d08c8a24f82bfb66f7543597225439c9647f 100644 (file)
@@ -752,7 +752,6 @@ struct fsp_lease *find_fsp_lease(struct files_struct *new_fsp,
                                 uint16_t lease_epoch);
 NTSTATUS create_file_default(connection_struct *conn,
                             struct smb_request *req,
-                            uint16_t root_dir_fid,
                             struct smb_filename * smb_fname,
                             uint32_t access_mask,
                             uint32_t share_access,
index c9e4d7e9c9001a7912f10b8f412a4b97a72924a1..e58329e01be94904623499da2cd3abb265b3756d 100644 (file)
@@ -1899,7 +1899,6 @@ void reply_search(struct smb_request *req)
                nt_status = SMB_VFS_CREATE_FILE(
                                conn, /* conn */
                                req, /* req */
-                               0, /* root_dir_fid */
                                smb_dname, /* dname */
                                FILE_LIST_DIRECTORY, /* access_mask */
                                FILE_SHARE_READ|
@@ -2285,7 +2284,6 @@ void reply_open(struct smb_request *req)
        status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
-               0,                                      /* root_dir_fid */
                smb_fname,                              /* fname */
                access_mask,                            /* access_mask */
                share_mode,                             /* share_access */
@@ -2476,7 +2474,6 @@ void reply_open_and_X(struct smb_request *req)
        status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
-               0,                                      /* root_dir_fid */
                smb_fname,                              /* fname */
                access_mask,                            /* access_mask */
                share_mode,                             /* share_access */
@@ -2908,7 +2905,6 @@ void reply_mknew(struct smb_request *req)
        status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
-               0,                                      /* root_dir_fid */
                smb_fname,                              /* fname */
                access_mask,                            /* access_mask */
                share_mode,                             /* share_access */
@@ -3045,7 +3041,6 @@ void reply_ctemp(struct smb_request *req)
                status = SMB_VFS_CREATE_FILE(
                        conn,                                   /* conn */
                        req,                                    /* req */
-                       0,                                      /* root_dir_fid */
                        smb_fname,                              /* fname */
                        FILE_GENERIC_READ | FILE_GENERIC_WRITE, /* access_mask */
                        FILE_SHARE_READ | FILE_SHARE_WRITE,     /* share_access */
@@ -3290,7 +3285,6 @@ static NTSTATUS do_unlink(connection_struct *conn,
        status = SMB_VFS_CREATE_FILE
                (conn,                  /* conn */
                 req,                   /* req */
-                0,                     /* root_dir_fid */
                 smb_fname,             /* fname */
                 DELETE_ACCESS,         /* access_mask */
                 FILE_SHARE_NONE,       /* share_access */
@@ -7214,7 +7208,6 @@ void reply_rmdir(struct smb_request *req)
        status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
-               0,                                      /* root_dir_fid */
                smb_dname,                              /* fname */
                DELETE_ACCESS,                          /* access_mask */
                (FILE_SHARE_READ | FILE_SHARE_WRITE |   /* share_access */
@@ -8054,7 +8047,6 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
                status = SMB_VFS_CREATE_FILE(
                        conn,                           /* conn */
                        req,                            /* req */
-                       0,                              /* root_dir_fid */
                        smb_fname_src,                  /* fname */
                        access_mask,                    /* access_mask */
                        (FILE_SHARE_READ |              /* share_access */
@@ -8221,7 +8213,6 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
                status = SMB_VFS_CREATE_FILE(
                        conn,                           /* conn */
                        req,                            /* req */
-                       0,                              /* root_dir_fid */
                        smb_fname_src,                  /* fname */
                        access_mask,                    /* access_mask */
                        (FILE_SHARE_READ |              /* share_access */
@@ -8530,7 +8521,6 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
        status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                NULL,                                   /* req */
-               0,                                      /* root_dir_fid */
                smb_fname_src,                          /* fname */
                FILE_GENERIC_READ,                      /* access_mask */
                FILE_SHARE_READ | FILE_SHARE_WRITE,     /* share_access */
@@ -8561,7 +8551,6 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
        status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                NULL,                                   /* req */
-               0,                                      /* root_dir_fid */
                smb_fname_dst,                          /* fname */
                FILE_GENERIC_WRITE,                     /* access_mask */
                FILE_SHARE_READ | FILE_SHARE_WRITE,     /* share_access */
index 0d49184d1b54a04dc31ac72c3826ee9f14f2339e..f3fa6fba646c247c4eb99327570a76ba68e0d8dc 100644 (file)
@@ -989,7 +989,6 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 
        status = SMB_VFS_CREATE_FILE(smb1req->conn,
                                     smb1req,
-                                    0, /* root_dir_fid */
                                     smb_fname,
                                     in_desired_access,
                                     in_share_access,
index e442d2ad4a422042fc65f0eb3a27246a28960227..0a809234d026f1c184b38417d99649dbc8f3a43c 100644 (file)
@@ -166,7 +166,6 @@ static NTSTATUS get_posix_fsp(connection_struct *conn,
        status = SMB_VFS_CREATE_FILE(
                conn,           /* conn */
                req,            /* req */
-               0,              /* root_dir_fid */
                smb_fname_tmp,  /* fname */
                access_mask,    /* access_mask */
                share_access,   /* share_access */
@@ -1437,7 +1436,6 @@ static void call_trans2open(connection_struct *conn,
        status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
-               0,                                      /* root_dir_fid */
                smb_fname,                              /* fname */
                access_mask,                            /* access_mask */
                share_mode,                             /* share_access */
@@ -2973,7 +2971,6 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
        ntstatus = SMB_VFS_CREATE_FILE(
                        conn, /* conn */
                        req, /* req */
-                       0, /* root_dir_fid */
                        smb_dname, /* dname */
                        FILE_LIST_DIRECTORY, /* access_mask */
                        FILE_SHARE_READ|
@@ -6740,7 +6737,6 @@ static NTSTATUS smb_set_file_size(connection_struct *conn,
         status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
-               0,                                      /* root_dir_fid */
                smb_fname_tmp,                          /* fname */
                FILE_WRITE_DATA,                        /* access_mask */
                (FILE_SHARE_READ | FILE_SHARE_WRITE |   /* share_access */
@@ -8017,7 +8013,6 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
        status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
-               0,                                      /* root_dir_fid */
                smb_fname,                              /* fname */
                FILE_WRITE_DATA,                        /* access_mask */
                (FILE_SHARE_READ | FILE_SHARE_WRITE |   /* share_access */
@@ -8531,7 +8526,6 @@ static NTSTATUS smb_posix_mkdir(connection_struct *conn,
         status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
-               0,                                      /* root_dir_fid */
                smb_fname,                              /* fname */
                FILE_READ_ATTRIBUTES,                   /* access_mask */
                FILE_SHARE_NONE,                        /* share_access */
@@ -8773,7 +8767,6 @@ static NTSTATUS smb_posix_open(connection_struct *conn,
         status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
-               0,                                      /* root_dir_fid */
                smb_fname,                              /* fname */
                access_mask,                            /* access_mask */
                (FILE_SHARE_READ | FILE_SHARE_WRITE |   /* share_access */
@@ -8916,7 +8909,6 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
         status = SMB_VFS_CREATE_FILE(
                conn,                                   /* conn */
                req,                                    /* req */
-               0,                                      /* root_dir_fid */
                smb_fname,                              /* fname */
                DELETE_ACCESS,                          /* access_mask */
                (FILE_SHARE_READ | FILE_SHARE_WRITE |   /* share_access */
index f49b53f4b7c62cfa16a1c07d9df326ec3b6188f9..d1585321ed3b6df1b934d60e57ae43795a23a32b 100644 (file)
@@ -1726,7 +1726,6 @@ int smb_vfs_call_open(struct vfs_handle_struct *handle,
 
 NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle,
                                  struct smb_request *req,
-                                 uint16_t root_dir_fid,
                                  struct smb_filename *smb_fname,
                                  uint32_t access_mask,
                                  uint32_t share_access,
@@ -1746,7 +1745,7 @@ NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle,
 {
        VFS_FIND(create_file);
        return handle->fns->create_file_fn(
-               handle, req, root_dir_fid, smb_fname, access_mask,
+               handle, req, smb_fname, access_mask,
                share_access, create_disposition, create_options,
                file_attributes, oplock_request, lease, allocation_size,
                private_flags, sd, ea_list,
index 0585a8d989b8cdd0d7fb318f5b7704151a30b9bb..59e9c60b3a6109795d18b8e32c37e3033cf26f17 100644 (file)
@@ -244,7 +244,6 @@ static int net_vfs_get_ntacl(struct net_context *net,
        status = SMB_VFS_CREATE_FILE(
                state.conn_tos->conn,
                NULL,                           /* req */
-               0,                              /* root_dir_fid */
                smb_fname,
                FILE_READ_ATTRIBUTES|READ_CONTROL_ACCESS,
                FILE_SHARE_READ|FILE_SHARE_WRITE,