From dc5dad48139a3dcb4544e4f31aabe269f6401849 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 18 Mar 2016 21:19:38 -0700 Subject: [PATCH] s3: Filenames: Add uint32_t flags parameter to synthetic_smb_fname(). Get it from parent/deriving smb_filename if present. Use 0 (as usually this a Windows-style lookup) if not. Signed-off-by: Jeremy Allison Reviewed-by: Uri Simchoni --- source3/include/proto.h | 3 +- source3/lib/filename_util.c | 12 +++-- source3/modules/non_posix_acls.c | 2 +- source3/modules/vfs_cap.c | 21 +++++--- source3/modules/vfs_catia.c | 27 ++++++---- source3/modules/vfs_default.c | 2 +- source3/modules/vfs_fake_acls.c | 2 +- source3/modules/vfs_fruit.c | 22 +++++--- source3/modules/vfs_gpfs.c | 2 +- source3/modules/vfs_hpuxacl.c | 2 +- source3/modules/vfs_media_harmony.c | 6 ++- source3/modules/vfs_nfs4acl_xattr.c | 2 +- source3/modules/vfs_recycle.c | 10 ++-- source3/modules/vfs_shadow_copy.c | 3 +- source3/modules/vfs_shadow_copy2.c | 27 ++++++---- source3/modules/vfs_snapper.c | 24 ++++++--- source3/modules/vfs_streams_depot.c | 71 +++++++++++++++++++------- source3/modules/vfs_streams_xattr.c | 14 +++-- source3/modules/vfs_unityed_media.c | 6 ++- source3/modules/vfs_vxfs.c | 2 +- source3/modules/vfs_xattr_tdb.c | 2 +- source3/printing/nt_printing.c | 2 +- source3/printing/printspoolss.c | 2 +- source3/rpc_server/fss/srv_fss_agent.c | 2 +- source3/smbd/close.c | 17 ++++-- source3/smbd/dir.c | 14 +++-- source3/smbd/dosmode.c | 14 +++-- source3/smbd/durable.c | 7 ++- source3/smbd/file_access.c | 9 +++- source3/smbd/filename.c | 3 +- source3/smbd/files.c | 2 +- source3/smbd/msdfs.c | 19 +++++-- source3/smbd/open.c | 38 +++++++++----- source3/smbd/pipes.c | 2 +- source3/smbd/posix_acls.c | 5 +- source3/smbd/pysmbd.c | 12 +++-- source3/smbd/reply.c | 12 +++-- source3/smbd/service.c | 7 ++- source3/smbd/trans2.c | 37 +++++++++----- source3/smbd/vfs.c | 9 ++-- source3/torture/cmd_vfs.c | 29 ++++++++--- 41 files changed, 347 insertions(+), 157 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index dc8fee91963..8cdbadfbb0d 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1139,7 +1139,8 @@ NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, const struct smb_filename *smb_f struct smb_filename *synthetic_smb_fname(TALLOC_CTX *mem_ctx, const char *base_name, const char *stream_name, - const SMB_STRUCT_STAT *psbuf); + const SMB_STRUCT_STAT *psbuf, + uint32_t flags); struct smb_filename *synthetic_smb_fname_split(TALLOC_CTX *ctx, const char *fname, bool posix_path); diff --git a/source3/lib/filename_util.c b/source3/lib/filename_util.c index c2beae170af..78bfc7040d8 100644 --- a/source3/lib/filename_util.c +++ b/source3/lib/filename_util.c @@ -53,13 +53,15 @@ NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, struct smb_filename *synthetic_smb_fname(TALLOC_CTX *mem_ctx, const char *base_name, const char *stream_name, - const SMB_STRUCT_STAT *psbuf) + const SMB_STRUCT_STAT *psbuf, + uint32_t flags) { struct smb_filename smb_fname_loc = { 0, }; /* Setup the base_name/stream_name. */ smb_fname_loc.base_name = discard_const_p(char, base_name); smb_fname_loc.stream_name = discard_const_p(char, stream_name); + smb_fname_loc.flags = flags; /* Copy the psbuf if one was given. */ if (psbuf) @@ -83,7 +85,11 @@ struct smb_filename *synthetic_smb_fname_split(TALLOC_CTX *ctx, if (posix_path) { /* No stream name looked for. */ - return synthetic_smb_fname(ctx, fname, NULL, NULL); + return synthetic_smb_fname(ctx, + fname, + NULL, + NULL, + SMB_FILENAME_POSIX_PATH); } ok = split_stream_filename(ctx, @@ -94,7 +100,7 @@ struct smb_filename *synthetic_smb_fname_split(TALLOC_CTX *ctx, return NULL; } - ret = synthetic_smb_fname(ctx, base_name, stream_name, NULL); + ret = synthetic_smb_fname(ctx, base_name, stream_name, NULL, 0); TALLOC_FREE(base_name); TALLOC_FREE(stream_name); return ret; diff --git a/source3/modules/non_posix_acls.c b/source3/modules/non_posix_acls.c index fca9979d649..8d3be72223d 100644 --- a/source3/modules/non_posix_acls.c +++ b/source3/modules/non_posix_acls.c @@ -32,7 +32,7 @@ int non_posix_sys_acl_blob_get_file_helper(vfs_handle_struct *handle, struct xattr_sys_acl_hash_wrapper acl_wrapper = {}; struct smb_filename *smb_fname; - smb_fname = synthetic_smb_fname(frame, path_p, NULL, NULL); + smb_fname = synthetic_smb_fname(frame, path_p, NULL, NULL, 0); if (smb_fname == NULL) { TALLOC_FREE(frame); errno = ENOMEM; diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 42b4b8dc013..eece1986f90 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -69,7 +69,8 @@ static DIR *cap_opendir(vfs_handle_struct *handle, cap_smb_fname = synthetic_smb_fname(talloc_tos(), capname, NULL, - NULL); + NULL, + smb_fname->flags); if (cap_smb_fname == NULL) { TALLOC_FREE(capname); errno = ENOMEM; @@ -125,7 +126,8 @@ static int cap_mkdir(vfs_handle_struct *handle, cap_smb_fname = synthetic_smb_fname(talloc_tos(), cappath, NULL, - NULL); + NULL, + smb_fname->flags); if (cap_smb_fname == NULL) { TALLOC_FREE(cappath); errno = ENOMEM; @@ -149,7 +151,8 @@ static int cap_rmdir(vfs_handle_struct *handle, cap_smb_fname = synthetic_smb_fname(talloc_tos(), cappath, NULL, - NULL); + NULL, + smb_fname->flags); if (cap_smb_fname == NULL) { TALLOC_FREE(cappath); errno = ENOMEM; @@ -321,7 +324,8 @@ static int cap_chmod(vfs_handle_struct *handle, cap_smb_fname = synthetic_smb_fname(talloc_tos(), cappath, NULL, - NULL); + NULL, + smb_fname->flags); if (cap_smb_fname == NULL) { TALLOC_FREE(cappath); errno = ENOMEM; @@ -354,7 +358,8 @@ static int cap_chown(vfs_handle_struct *handle, cap_smb_fname = synthetic_smb_fname(talloc_tos(), cappath, NULL, - NULL); + NULL, + smb_fname->flags); if (cap_smb_fname == NULL) { TALLOC_FREE(cappath); errno = ENOMEM; @@ -387,7 +392,8 @@ static int cap_lchown(vfs_handle_struct *handle, cap_smb_fname = synthetic_smb_fname(talloc_tos(), cappath, NULL, - NULL); + NULL, + smb_fname->flags); if (cap_smb_fname == NULL) { TALLOC_FREE(cappath); errno = ENOMEM; @@ -522,7 +528,8 @@ static int cap_chmod_acl(vfs_handle_struct *handle, cap_smb_fname = synthetic_smb_fname(talloc_tos(), cappath, NULL, - NULL); + NULL, + smb_fname->flags); if (cap_smb_fname == NULL) { TALLOC_FREE(cappath); errno = ENOMEM; diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c index e2b4eb5745e..c5d2b6a1b28 100644 --- a/source3/modules/vfs_catia.c +++ b/source3/modules/vfs_catia.c @@ -290,7 +290,8 @@ static DIR *catia_opendir(vfs_handle_struct *handle, mapped_smb_fname = synthetic_smb_fname(talloc_tos(), name_mapped, NULL, - NULL); + NULL, + smb_fname->flags); if (mapped_smb_fname == NULL) { TALLOC_FREE(mapped_smb_fname); errno = ENOMEM; @@ -543,7 +544,8 @@ static int catia_chown(vfs_handle_struct *handle, catia_smb_fname = synthetic_smb_fname(talloc_tos(), name, NULL, - NULL); + NULL, + smb_fname->flags); if (catia_smb_fname == NULL) { TALLOC_FREE(name); errno = ENOMEM; @@ -580,7 +582,8 @@ static int catia_lchown(vfs_handle_struct *handle, catia_smb_fname = synthetic_smb_fname(talloc_tos(), name, NULL, - NULL); + NULL, + smb_fname->flags); if (catia_smb_fname == NULL) { TALLOC_FREE(name); errno = ENOMEM; @@ -616,7 +619,8 @@ static int catia_chmod(vfs_handle_struct *handle, catia_smb_fname = synthetic_smb_fname(talloc_tos(), name, NULL, - NULL); + NULL, + smb_fname->flags); if (catia_smb_fname == NULL) { TALLOC_FREE(name); errno = ENOMEM; @@ -650,7 +654,8 @@ static int catia_rmdir(vfs_handle_struct *handle, catia_smb_fname = synthetic_smb_fname(talloc_tos(), name, NULL, - NULL); + NULL, + smb_fname->flags); if (catia_smb_fname == NULL) { TALLOC_FREE(name); errno = ENOMEM; @@ -684,7 +689,8 @@ static int catia_mkdir(vfs_handle_struct *handle, catia_smb_fname = synthetic_smb_fname(talloc_tos(), name, NULL, - NULL); + NULL, + smb_fname->flags); if (catia_smb_fname == NULL) { TALLOC_FREE(name); errno = ENOMEM; @@ -819,7 +825,8 @@ catia_streaminfo(struct vfs_handle_struct *handle, catia_smb_fname = synthetic_smb_fname(talloc_tos(), mapped_name, NULL, - NULL); + NULL, + smb_fname->flags); if (catia_smb_fname == NULL) { TALLOC_FREE(mapped_name); return NT_STATUS_NO_MEMORY; @@ -898,7 +905,8 @@ catia_get_nt_acl(struct vfs_handle_struct *handle, mapped_smb_fname = synthetic_smb_fname(talloc_tos(), mapped_name, NULL, - NULL); + NULL, + smb_fname->flags); if (mapped_smb_fname == NULL) { TALLOC_FREE(mapped_name); return NT_STATUS_NO_MEMORY; @@ -935,7 +943,8 @@ catia_chmod_acl(vfs_handle_struct *handle, mapped_smb_fname = synthetic_smb_fname(talloc_tos(), mapped_name, NULL, - NULL); + NULL, + smb_fname->flags); if (mapped_smb_fname == NULL) { TALLOC_FREE(mapped_name); errno = ENOMEM; diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 23df640b415..65a14dfa9bc 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -133,7 +133,7 @@ static uint32_t vfswrap_fs_capabilities(struct vfs_handle_struct *handle, * use when setting a timestamp. */ smb_fname_cpath = synthetic_smb_fname(talloc_tos(), conn->connectpath, - NULL, NULL); + NULL, NULL, 0); if (smb_fname_cpath == NULL) { return caps; } diff --git a/source3/modules/vfs_fake_acls.c b/source3/modules/vfs_fake_acls.c index 491e1ac1ea8..55ff7db37df 100644 --- a/source3/modules/vfs_fake_acls.c +++ b/source3/modules/vfs_fake_acls.c @@ -364,7 +364,7 @@ static int fake_acls_sys_acl_delete_def_file(vfs_handle_struct *handle, const ch TALLOC_CTX *frame = talloc_stackframe(); struct smb_filename *smb_fname; - smb_fname = synthetic_smb_fname(frame, path, NULL, NULL); + smb_fname = synthetic_smb_fname(frame, path, NULL, NULL, 0); if (smb_fname == NULL) { TALLOC_FREE(frame); errno = ENOMEM; diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index 0c742861d76..761741a3570 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -2132,7 +2132,10 @@ static int fruit_open_meta(vfs_handle_struct *handle, /* Create an smb_filename with stream_name == NULL. */ smb_fname_base = synthetic_smb_fname(talloc_tos(), - smb_fname->base_name, NULL, NULL); + smb_fname->base_name, + NULL, + NULL, + smb_fname->flags); if (smb_fname_base == NULL) { errno = ENOMEM; @@ -2281,7 +2284,10 @@ static int fruit_open_rsrc(vfs_handle_struct *handle, /* Create an smb_filename with stream_name == NULL. */ smb_fname_base = synthetic_smb_fname(talloc_tos(), - adpath, NULL, NULL); + adpath, + NULL, + NULL, + smb_fname->flags); if (smb_fname_base == NULL) { errno = ENOMEM; rc = -1; @@ -2527,7 +2533,8 @@ static int fruit_chmod(vfs_handle_struct *handle, smb_fname_adp = synthetic_smb_fname(talloc_tos(), adp, NULL, - NULL); + NULL, + smb_fname->flags); if (smb_fname_adp == NULL) { TALLOC_FREE(adp); errno = ENOMEM; @@ -2583,7 +2590,8 @@ static int fruit_chown(vfs_handle_struct *handle, adp_smb_fname = synthetic_smb_fname(talloc_tos(), adp, NULL, - NULL); + NULL, + smb_fname->flags); if (adp_smb_fname == NULL) { errno = ENOMEM; rc = -1; @@ -3802,7 +3810,8 @@ static void fruit_copy_chunk_done(struct tevent_req *subreq) req, state->src_fsp->fsp_name->base_name, streams[i].name, - NULL); + NULL, + state->src_fsp->fsp_name->flags); if (tevent_req_nomem(src_fname_tmp, req)) { return; } @@ -3816,7 +3825,8 @@ static void fruit_copy_chunk_done(struct tevent_req *subreq) req, state->dst_fsp->fsp_name->base_name, streams[i].name, - NULL); + NULL, + state->dst_fsp->fsp_name->flags); if (tevent_req_nomem(dst_fname_tmp, req)) { TALLOC_FREE(src_fname_tmp); return; diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 09e37fa7f53..04d89f48997 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -1380,7 +1380,7 @@ static int gpfsacl_emu_chmod(vfs_handle_struct *handle, /* don't add complementary DENY ACEs here */ fake_fsp.fsp_name = synthetic_smb_fname( - frame, path, NULL, NULL); + frame, path, NULL, NULL, 0); if (fake_fsp.fsp_name == NULL) { errno = ENOMEM; TALLOC_FREE(frame); diff --git a/source3/modules/vfs_hpuxacl.c b/source3/modules/vfs_hpuxacl.c index 55a68946517..df27c89f948 100644 --- a/source3/modules/vfs_hpuxacl.c +++ b/source3/modules/vfs_hpuxacl.c @@ -221,7 +221,7 @@ int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle, DEBUG(10, ("hpuxacl_sys_acl_set_file called for file '%s'\n", name)); - smb_fname = synthetic_smb_fname(talloc_tos(), name, NULL, NULL); + smb_fname = synthetic_smb_fname(talloc_tos(), name, NULL, NULL, 0); if (smb_fname == NULL) { status = NT_STATUS_NO_MEMORY; goto done; diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c index 2ae6c4a96a1..8f802216771 100644 --- a/source3/modules/vfs_media_harmony.c +++ b/source3/modules/vfs_media_harmony.c @@ -783,7 +783,8 @@ static DIR *mh_opendir(vfs_handle_struct *handle, synthetic_smb_fname(talloc_tos(), dirInfo->clientPath, NULL, - NULL); + NULL, + smb_fname->flags); if (smb_fname_clientpath == NULL) { goto err; } @@ -2045,7 +2046,8 @@ static NTSTATUS mh_get_nt_acl(vfs_handle_struct *handle, client_smb_fname = synthetic_smb_fname(talloc_tos(), clientPath, NULL, - NULL); + NULL, + smb_fname->flags); if (client_smb_fname == NULL) { TALLOC_FREE(clientPath); return NT_STATUS_NO_MEMORY; diff --git a/source3/modules/vfs_nfs4acl_xattr.c b/source3/modules/vfs_nfs4acl_xattr.c index af84b8bb71a..9ab7238e0ac 100644 --- a/source3/modules/vfs_nfs4acl_xattr.c +++ b/source3/modules/vfs_nfs4acl_xattr.c @@ -417,7 +417,7 @@ static struct SMB4ACL_T *nfs4acls_inheritacl(vfs_handle_struct *handle, TALLOC_CTX *frame = talloc_stackframe(); DEBUG(10, ("nfs4acls_inheritacl invoked for %s\n", path)); - smb_fname = synthetic_smb_fname(frame, path, NULL, NULL); + smb_fname = synthetic_smb_fname(frame, path, NULL, NULL, 0); if (smb_fname == NULL) { TALLOC_FREE(frame); errno = ENOMEM; diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c index 4981f558a82..ca3fc2ee5f4 100644 --- a/source3/modules/vfs_recycle.c +++ b/source3/modules/vfs_recycle.c @@ -299,7 +299,8 @@ static bool recycle_create_dir(vfs_handle_struct *handle, const char *dname) smb_fname = synthetic_smb_fname(talloc_tos(), new_dir, NULL, - NULL); + NULL, + 0); if (smb_fname == NULL) { goto done; } @@ -587,8 +588,11 @@ static int recycle_unlink(vfs_handle_struct *handle, } /* Create smb_fname with final base name and orig stream name. */ - smb_fname_final = synthetic_smb_fname(talloc_tos(), final_name, - smb_fname->stream_name, NULL); + smb_fname_final = synthetic_smb_fname(talloc_tos(), + final_name, + smb_fname->stream_name, + NULL, + smb_fname->flags); if (smb_fname_final == NULL) { rc = SMB_VFS_NEXT_UNLINK(handle, smb_fname); goto done; diff --git a/source3/modules/vfs_shadow_copy.c b/source3/modules/vfs_shadow_copy.c index 77dc1636c91..9b43e85af63 100644 --- a/source3/modules/vfs_shadow_copy.c +++ b/source3/modules/vfs_shadow_copy.c @@ -230,7 +230,8 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle, struct smb_filename *smb_fname = synthetic_smb_fname(talloc_tos(), fsp->conn->connectpath, NULL, - NULL); + NULL, + 0); if (smb_fname == NULL) { errno = ENOMEM; return -1; diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index c63d67603d3..43bc89d3126 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -719,7 +719,8 @@ static DIR *shadow_copy2_opendir(vfs_handle_struct *handle, conv_smb_fname = synthetic_smb_fname(talloc_tos(), conv, NULL, - NULL); + NULL, + smb_fname->flags); if (conv_smb_fname == NULL) { TALLOC_FREE(conv); return NULL; @@ -998,7 +999,8 @@ static int shadow_copy2_chmod(vfs_handle_struct *handle, conv_smb_fname = synthetic_smb_fname(talloc_tos(), conv, NULL, - NULL); + NULL, + smb_fname->flags); if (conv_smb_fname == NULL) { TALLOC_FREE(conv); errno = ENOMEM; @@ -1042,7 +1044,8 @@ static int shadow_copy2_chown(vfs_handle_struct *handle, conv_smb_fname = synthetic_smb_fname(talloc_tos(), conv, NULL, - NULL); + NULL, + smb_fname->flags); if (conv_smb_fname == NULL) { TALLOC_FREE(conv); errno = ENOMEM; @@ -1442,7 +1445,8 @@ static int shadow_copy2_get_shadow_copy_data( snapdir_smb_fname = synthetic_smb_fname(talloc_tos(), snapdir, NULL, - NULL); + NULL, + fsp->fsp_name->flags); if (snapdir_smb_fname == NULL) { errno = ENOMEM; talloc_free(tmp_ctx); @@ -1543,7 +1547,8 @@ static NTSTATUS shadow_copy2_fget_nt_acl(vfs_handle_struct *handle, smb_fname = synthetic_smb_fname(talloc_tos(), conv, NULL, - NULL); + NULL, + fsp->fsp_name->flags); if (smb_fname == NULL) { TALLOC_FREE(conv); return NT_STATUS_NO_MEMORY; @@ -1587,7 +1592,8 @@ static NTSTATUS shadow_copy2_get_nt_acl(vfs_handle_struct *handle, conv_smb_fname = synthetic_smb_fname(talloc_tos(), conv, NULL, - NULL); + NULL, + smb_fname->flags); if (conv_smb_fname == NULL) { TALLOC_FREE(conv); return NT_STATUS_NO_MEMORY; @@ -1627,7 +1633,8 @@ static int shadow_copy2_mkdir(vfs_handle_struct *handle, conv_smb_fname = synthetic_smb_fname(talloc_tos(), conv, NULL, - NULL); + NULL, + smb_fname->flags); if (conv_smb_fname == NULL) { TALLOC_FREE(conv); return -1; @@ -1667,7 +1674,8 @@ static int shadow_copy2_rmdir(vfs_handle_struct *handle, conv_smb_fname = synthetic_smb_fname(talloc_tos(), conv, NULL, - NULL); + NULL, + smb_fname->flags); if (conv_smb_fname == NULL) { TALLOC_FREE(conv); return -1; @@ -1853,7 +1861,8 @@ static int shadow_copy2_chmod_acl(vfs_handle_struct *handle, conv_smb_fname = synthetic_smb_fname(talloc_tos(), conv, NULL, - NULL); + NULL, + smb_fname->flags); if (conv_smb_fname == NULL) { TALLOC_FREE(conv); errno = ENOMEM; diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c index 11a99d97b79..64a83bdfe91 100644 --- a/source3/modules/vfs_snapper.c +++ b/source3/modules/vfs_snapper.c @@ -1972,7 +1972,8 @@ static DIR *snapper_gmt_opendir(vfs_handle_struct *handle, conv_smb_fname = synthetic_smb_fname(talloc_tos(), conv, NULL, - NULL); + NULL, + smb_fname->flags); if (conv_smb_fname == NULL) { TALLOC_FREE(conv); errno = ENOMEM; @@ -2244,7 +2245,8 @@ static int snapper_gmt_chmod(vfs_handle_struct *handle, conv_smb_fname = synthetic_smb_fname(talloc_tos(), conv, NULL, - NULL); + NULL, + smb_fname->flags); if (conv_smb_fname == NULL) { TALLOC_FREE(conv); errno = ENOMEM; @@ -2289,7 +2291,8 @@ static int snapper_gmt_chown(vfs_handle_struct *handle, conv_smb_fname = synthetic_smb_fname(talloc_tos(), conv, NULL, - NULL); + NULL, + smb_fname->flags); if (conv_smb_fname == NULL) { TALLOC_FREE(conv); errno = ENOMEM; @@ -2485,7 +2488,8 @@ static NTSTATUS snapper_gmt_fget_nt_acl(vfs_handle_struct *handle, smb_fname = synthetic_smb_fname(talloc_tos(), conv, NULL, - NULL); + NULL, + fsp->fsp_name->flags); TALLOC_FREE(conv); if (smb_fname == NULL) { return NT_STATUS_NO_MEMORY; @@ -2525,7 +2529,8 @@ static NTSTATUS snapper_gmt_get_nt_acl(vfs_handle_struct *handle, smb_fname = synthetic_smb_fname(talloc_tos(), conv, NULL, - NULL); + NULL, + fname->flags); TALLOC_FREE(conv); if (smb_fname == NULL) { return NT_STATUS_NO_MEMORY; @@ -2562,7 +2567,8 @@ static int snapper_gmt_mkdir(vfs_handle_struct *handle, smb_fname = synthetic_smb_fname(talloc_tos(), conv, NULL, - NULL); + NULL, + fname->flags); TALLOC_FREE(conv); if (smb_fname == NULL) { errno = ENOMEM; @@ -2600,7 +2606,8 @@ static int snapper_gmt_rmdir(vfs_handle_struct *handle, smb_fname = synthetic_smb_fname(talloc_tos(), conv, NULL, - NULL); + NULL, + fname->flags); TALLOC_FREE(conv); if (smb_fname == NULL) { errno = ENOMEM; @@ -2786,7 +2793,8 @@ static int snapper_gmt_chmod_acl(vfs_handle_struct *handle, conv_smb_fname = synthetic_smb_fname(talloc_tos(), conv, NULL, - NULL); + NULL, + smb_fname->flags); if (conv_smb_fname == NULL) { TALLOC_FREE(conv); errno = ENOMEM; diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c index 5a974445e31..2b80b9dcf7b 100644 --- a/source3/modules/vfs_streams_depot.c +++ b/source3/modules/vfs_streams_depot.c @@ -148,7 +148,8 @@ static char *stream_dir(vfs_handle_struct *handle, rootdir_fname = synthetic_smb_fname(talloc_tos(), rootdir, NULL, - NULL); + NULL, + smb_fname->flags); if (rootdir_fname == NULL) { errno = ENOMEM; goto fail; @@ -159,7 +160,11 @@ static char *stream_dir(vfs_handle_struct *handle, struct smb_filename *smb_fname_base; smb_fname_base = synthetic_smb_fname( - talloc_tos(), smb_fname->base_name, NULL, NULL); + talloc_tos(), + smb_fname->base_name, + NULL, + NULL, + smb_fname->flags); if (smb_fname_base == NULL) { errno = ENOMEM; goto fail; @@ -200,7 +205,11 @@ static char *stream_dir(vfs_handle_struct *handle, return NULL; } - smb_fname_hash = synthetic_smb_fname(talloc_tos(), result, NULL, NULL); + smb_fname_hash = synthetic_smb_fname(talloc_tos(), + result, + NULL, + NULL, + smb_fname->flags); if (smb_fname_hash == NULL) { errno = ENOMEM; goto fail; @@ -251,7 +260,11 @@ static char *stream_dir(vfs_handle_struct *handle, } smb_fname_new = synthetic_smb_fname( - talloc_tos(), newname, NULL, NULL); + talloc_tos(), + newname, + NULL, + NULL, + smb_fname->flags); TALLOC_FREE(newname); if (smb_fname_new == NULL) { errno = ENOMEM; @@ -287,7 +300,11 @@ static char *stream_dir(vfs_handle_struct *handle, goto fail; } - tmp_fname = synthetic_smb_fname(talloc_tos(), tmp, NULL, NULL); + tmp_fname = synthetic_smb_fname(talloc_tos(), + tmp, + NULL, + NULL, + smb_fname->flags); if (tmp_fname == NULL) { errno = ENOMEM; goto fail; @@ -308,7 +325,11 @@ static char *stream_dir(vfs_handle_struct *handle, goto fail; } - tmp_fname = synthetic_smb_fname(talloc_tos(), tmp, NULL, NULL); + tmp_fname = synthetic_smb_fname(talloc_tos(), + tmp, + NULL, + NULL, + smb_fname->flags); if (tmp_fname == NULL) { errno = ENOMEM; goto fail; @@ -403,8 +424,11 @@ static NTSTATUS stream_smb_fname(vfs_handle_struct *handle, DEBUG(10, ("stream filename = %s\n", stream_fname)); /* Create an smb_filename with stream_name == NULL. */ - *smb_fname_out = synthetic_smb_fname( - talloc_tos(), stream_fname, NULL, NULL); + *smb_fname_out = synthetic_smb_fname(talloc_tos(), + stream_fname, + NULL, + NULL, + smb_fname->flags); if (*smb_fname_out == NULL) { return NT_STATUS_NO_MEMORY; } @@ -449,7 +473,8 @@ static NTSTATUS walk_streams(vfs_handle_struct *handle, dir_smb_fname = synthetic_smb_fname(talloc_tos(), dirname, NULL, - NULL); + NULL, + smb_fname_base->flags); if (dir_smb_fname == NULL) { TALLOC_FREE(dirname); return NT_STATUS_NO_MEMORY; @@ -615,8 +640,11 @@ static int streams_depot_open(vfs_handle_struct *handle, } /* Ensure the base file still exists. */ - smb_fname_base = synthetic_smb_fname( - talloc_tos(), smb_fname->base_name, NULL, NULL); + smb_fname_base = synthetic_smb_fname(talloc_tos(), + smb_fname->base_name, + NULL, + NULL, + smb_fname->flags); if (smb_fname_base == NULL) { ret = -1; errno = ENOMEM; @@ -676,8 +704,11 @@ static int streams_depot_unlink(vfs_handle_struct *handle, * We potentially need to delete the per-inode streams directory */ - smb_fname_base = synthetic_smb_fname( - talloc_tos(), smb_fname->base_name, NULL, NULL); + smb_fname_base = synthetic_smb_fname(talloc_tos(), + smb_fname->base_name, + NULL, + NULL, + smb_fname->flags); if (smb_fname_base == NULL) { errno = ENOMEM; return -1; @@ -704,7 +735,8 @@ static int streams_depot_unlink(vfs_handle_struct *handle, synthetic_smb_fname(talloc_tos(), dirname, NULL, - NULL); + NULL, + smb_fname->flags); if (smb_fname_dir == NULL) { TALLOC_FREE(smb_fname_base); TALLOC_FREE(dirname); @@ -737,7 +769,8 @@ static int streams_depot_rmdir(vfs_handle_struct *handle, smb_fname_base = synthetic_smb_fname(talloc_tos(), smb_fname->base_name, NULL, - NULL); + NULL, + smb_fname->flags); if (smb_fname_base == NULL) { errno = ENOMEM; return -1; @@ -764,7 +797,8 @@ static int streams_depot_rmdir(vfs_handle_struct *handle, synthetic_smb_fname(talloc_tos(), dirname, NULL, - NULL); + NULL, + smb_fname->flags); if (smb_fname_dir == NULL) { TALLOC_FREE(smb_fname_base); TALLOC_FREE(dirname); @@ -884,7 +918,7 @@ static bool collect_one_stream(const char *dirname, goto out; } - smb_fname = synthetic_smb_fname(talloc_tos(), sname, NULL, NULL); + smb_fname = synthetic_smb_fname(talloc_tos(), sname, NULL, NULL, 0); if (smb_fname == NULL) { state->status = NT_STATUS_NO_MEMORY; ret = false; @@ -930,7 +964,8 @@ static NTSTATUS streams_depot_streaminfo(vfs_handle_struct *handle, smb_fname_base = synthetic_smb_fname(talloc_tos(), smb_fname->base_name, NULL, - NULL); + NULL, + smb_fname->flags); if (smb_fname_base == NULL) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index 0d547346b14..b3b800264fb 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -242,8 +242,11 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp, } /* Create an smb_filename with stream_name == NULL. */ - smb_fname_base = synthetic_smb_fname(talloc_tos(), io->base, - NULL, NULL); + smb_fname_base = synthetic_smb_fname(talloc_tos(), + io->base, + NULL, + NULL, + fsp->fsp_name->flags); if (smb_fname_base == NULL) { errno = ENOMEM; return -1; @@ -427,8 +430,11 @@ static int streams_xattr_open(vfs_handle_struct *handle, } /* Create an smb_filename with stream_name == NULL. */ - smb_fname_base = synthetic_smb_fname( - talloc_tos(), smb_fname->base_name, NULL, NULL); + smb_fname_base = synthetic_smb_fname(talloc_tos(), + smb_fname->base_name, + NULL, + NULL, + smb_fname->flags); if (smb_fname_base == NULL) { errno = ENOMEM; goto fail; diff --git a/source3/modules/vfs_unityed_media.c b/source3/modules/vfs_unityed_media.c index 4bbb8fb3a23..3b3493d013f 100644 --- a/source3/modules/vfs_unityed_media.c +++ b/source3/modules/vfs_unityed_media.c @@ -571,7 +571,8 @@ static DIR *um_opendir(vfs_handle_struct *handle, synthetic_smb_fname(talloc_tos(), dirInfo->clientPath, NULL, - NULL); + NULL, + smb_fname->flags); if (client_smb_fname == NULL) { goto err; } @@ -1561,7 +1562,8 @@ static NTSTATUS um_get_nt_acl(vfs_handle_struct *handle, client_smb_fname = synthetic_smb_fname(talloc_tos(), client_path, NULL, - NULL); + NULL, + smb_fname->flags); if (client_smb_fname == NULL) { TALLOC_FREE(client_path); return NT_STATUS_NO_MEMORY; diff --git a/source3/modules/vfs_vxfs.c b/source3/modules/vfs_vxfs.c index 4bfbef3530b..bcd7ae3a91f 100644 --- a/source3/modules/vfs_vxfs.c +++ b/source3/modules/vfs_vxfs.c @@ -421,7 +421,7 @@ static bool vxfs_compare(connection_struct *conn, char *name, SMB_ACL_T the_acl, goto out; } - smb_fname = synthetic_smb_fname(mem_ctx, name, NULL, NULL); + smb_fname = synthetic_smb_fname(mem_ctx, name, NULL, NULL, 0); if (smb_fname == NULL) { DEBUG(10, ("vfs_vxfs: Failed to create smb_fname\n")); goto out; diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c index a22192bcdf0..aac824523b9 100644 --- a/source3/modules/vfs_xattr_tdb.c +++ b/source3/modules/vfs_xattr_tdb.c @@ -37,7 +37,7 @@ static int xattr_tdb_get_file_id(struct vfs_handle_struct *handle, TALLOC_CTX *frame = talloc_stackframe(); struct smb_filename *smb_fname; - smb_fname = synthetic_smb_fname(frame, path, NULL, NULL); + smb_fname = synthetic_smb_fname(frame, path, NULL, NULL, 0); if (smb_fname == NULL) { TALLOC_FREE(frame); errno = ENOMEM; diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 3d6cfb13309..36e7324520b 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -1585,7 +1585,7 @@ static NTSTATUS driver_unlink_internals(connection_struct *conn, goto err_out; } - smb_fname = synthetic_smb_fname(tmp_ctx, print_dlr_path, NULL, NULL); + smb_fname = synthetic_smb_fname(tmp_ctx, print_dlr_path, NULL, NULL, 0); if (smb_fname == NULL) { goto err_out; } diff --git a/source3/printing/printspoolss.c b/source3/printing/printspoolss.c index 883e81f38e6..ebf6d39505f 100644 --- a/source3/printing/printspoolss.c +++ b/source3/printing/printspoolss.c @@ -212,7 +212,7 @@ NTSTATUS print_spool_open(files_struct *fsp, } /* setup a full fsp */ - fsp->fsp_name = synthetic_smb_fname(fsp, pf->filename, NULL, NULL); + fsp->fsp_name = synthetic_smb_fname(fsp, pf->filename, NULL, NULL, 0); if (fsp->fsp_name == NULL) { status = NT_STATUS_NO_MEMORY; goto done; diff --git a/source3/rpc_server/fss/srv_fss_agent.c b/source3/rpc_server/fss/srv_fss_agent.c index 68a51439c25..2a1f770fd94 100644 --- a/source3/rpc_server/fss/srv_fss_agent.c +++ b/source3/rpc_server/fss/srv_fss_agent.c @@ -173,7 +173,7 @@ static bool snap_path_exists(TALLOC_CTX *ctx, struct messaging_context *msg_ctx, goto out; } - smb_fname = synthetic_smb_fname(service, sc->sc_path, NULL, NULL); + smb_fname = synthetic_smb_fname(service, sc->sc_path, NULL, NULL, 0); if (smb_fname == NULL) { goto out; } diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 3b887c86385..0302c67ce84 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -204,7 +204,8 @@ NTSTATUS delete_all_streams(connection_struct *conn, smb_fname_stream = synthetic_smb_fname(talloc_tos(), smb_fname->base_name, stream_info[i].name, - NULL); + NULL, + smb_fname->flags); if (smb_fname_stream == NULL) { DEBUG(0, ("talloc_aprintf failed\n")); @@ -833,8 +834,11 @@ bool recursive_rmdir(TALLOC_CTX *ctx, goto err_break; } - smb_dname_full = synthetic_smb_fname(talloc_tos(), fullname, - NULL, NULL); + smb_dname_full = synthetic_smb_fname(talloc_tos(), + fullname, + NULL, + NULL, + smb_dname->flags); if (smb_dname_full == NULL) { errno = ENOMEM; goto err_break; @@ -984,8 +988,11 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, files_struct *fsp) goto err_break; } - smb_dname_full = synthetic_smb_fname( - talloc_tos(), fullname, NULL, NULL); + smb_dname_full = synthetic_smb_fname(talloc_tos(), + fullname, + NULL, + NULL, + smb_dname->flags); if (smb_dname_full == NULL) { errno = ENOMEM; goto err_break; diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 82841ebc5e7..3c6f00096fa 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -413,8 +413,11 @@ static struct smb_Dir *open_dir_with_privilege(connection_struct *conn, } /* Now check the stat value is the same. */ - smb_fname_cwd = synthetic_smb_fname(talloc_tos(), ".", NULL, NULL); - + smb_fname_cwd = synthetic_smb_fname(talloc_tos(), + ".", + NULL, + NULL, + smb_dname->flags); if (smb_fname_cwd == NULL) { goto out; } @@ -1545,8 +1548,11 @@ bool is_visible_file(connection_struct *conn, const char *dir_path, } /* Create an smb_filename with stream_name == NULL. */ - smb_fname_base = synthetic_smb_fname(talloc_tos(), entry, NULL, - pst); + smb_fname_base = synthetic_smb_fname(talloc_tos(), + entry, + NULL, + pst, + 0); if (smb_fname_base == NULL) { ret = false; goto out; diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 638299dbf15..60f2f6810a0 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -135,8 +135,11 @@ mode_t unix_mode(connection_struct *conn, int dosmode, smb_fname_str_dbg(smb_fname), inherit_from_dir)); - smb_fname_parent = synthetic_smb_fname( - talloc_tos(), inherit_from_dir, NULL, NULL); + smb_fname_parent = synthetic_smb_fname(talloc_tos(), + inherit_from_dir, + NULL, + NULL, + smb_fname->flags); if (smb_fname_parent == NULL) { DEBUG(1,("unix_mode(%s) failed, [dir %s]: No memory\n", smb_fname_str_dbg(smb_fname), @@ -1022,8 +1025,11 @@ NTSTATUS set_create_timespec_ea(connection_struct *conn, return NT_STATUS_OK; } - smb_fname = synthetic_smb_fname(talloc_tos(), psmb_fname->base_name, - NULL, &psmb_fname->st); + smb_fname = synthetic_smb_fname(talloc_tos(), + psmb_fname->base_name, + NULL, + &psmb_fname->st, + psmb_fname->flags); if (smb_fname == NULL) { return NT_STATUS_NO_MEMORY; diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c index d9b88a859a4..f39a365242c 100644 --- a/source3/smbd/durable.c +++ b/source3/smbd/durable.c @@ -598,8 +598,11 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn, } /* Create an smb_filename with stream_name == NULL. */ - smb_fname = synthetic_smb_fname(talloc_tos(), cookie.base_name, - NULL, NULL); + smb_fname = synthetic_smb_fname(talloc_tos(), + cookie.base_name, + NULL, + NULL, + 0); if (smb_fname == NULL) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/smbd/file_access.c b/source3/smbd/file_access.c index 0a6d6b154a4..66c9ed3add7 100644 --- a/source3/smbd/file_access.c +++ b/source3/smbd/file_access.c @@ -54,7 +54,11 @@ bool can_delete_file_in_directory(connection_struct *conn, return False; } - smb_fname_parent = synthetic_smb_fname(ctx, dname, NULL, NULL); + smb_fname_parent = synthetic_smb_fname(ctx, + dname, + NULL, + NULL, + smb_fname->flags); if (smb_fname_parent == NULL) { ret = false; goto out; @@ -155,7 +159,8 @@ bool directory_has_default_acl(connection_struct *conn, const char *fname) struct smb_filename *smb_fname = synthetic_smb_fname(talloc_tos(), fname, NULL, - NULL); + NULL, + 0); if (smb_fname == NULL) { return false; diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index a1920c32207..72714666cf3 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -1202,7 +1202,8 @@ static int get_real_filename_full_scan(connection_struct *conn, smb_fname = synthetic_smb_fname(talloc_tos(), path, NULL, - NULL); + NULL, + 0); if (smb_fname == NULL) { TALLOC_FREE(unmangled_name); return -1; diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 3e2b3d79054..a3cce138e02 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -118,7 +118,7 @@ NTSTATUS file_new(struct smb_request *req, connection_struct *conn, * few NULL checks, so make sure it's initialized with something. to * be safe until an audit can be done. */ - fsp->fsp_name = synthetic_smb_fname(fsp, "", NULL, NULL); + fsp->fsp_name = synthetic_smb_fname(fsp, "", NULL, NULL, 0); if (fsp->fsp_name == NULL) { file_free(NULL, fsp); return NT_STATUS_NO_MEMORY; diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index fe95877fe8d..647ac3b80be 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -1311,8 +1311,11 @@ bool create_msdfs_link(const struct junction_map *jucn) if (errno == EEXIST) { struct smb_filename *smb_fname; - smb_fname = synthetic_smb_fname(talloc_tos(), path, - NULL, NULL); + smb_fname = synthetic_smb_fname(talloc_tos(), + path, + NULL, + NULL, + 0); if (smb_fname == NULL) { errno = ENOMEM; goto out; @@ -1353,7 +1356,11 @@ bool remove_msdfs_link(const struct junction_map *jucn) return false; } - smb_fname = synthetic_smb_fname(talloc_tos(), path, NULL, NULL); + smb_fname = synthetic_smb_fname(talloc_tos(), + path, + NULL, + NULL, + 0); if (smb_fname == NULL) { errno = ENOMEM; return false; @@ -1417,7 +1424,8 @@ static int count_dfs_links(TALLOC_CTX *ctx, int snum) smb_fname = synthetic_smb_fname(talloc_tos(), ".", NULL, - NULL); + NULL, + 0); if (smb_fname == NULL) { goto out; } @@ -1534,7 +1542,8 @@ static int form_junctions(TALLOC_CTX *ctx, smb_fname = synthetic_smb_fname(talloc_tos(), ".", NULL, - NULL); + NULL, + 0); if (smb_fname == NULL) { goto out; } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index e5503f57f36..d111254b9cb 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -255,7 +255,8 @@ static NTSTATUS check_parent_access(struct connection_struct *conn, parent_smb_fname = synthetic_smb_fname(talloc_tos(), parent_dir, NULL, - NULL); + NULL, + smb_fname->flags); if (parent_smb_fname == NULL) { return NT_STATUS_NO_MEMORY; } @@ -457,8 +458,11 @@ void change_file_owner_to_parent(connection_struct *conn, struct smb_filename *smb_fname_parent; int ret; - smb_fname_parent = synthetic_smb_fname(talloc_tos(), inherit_from_dir, - NULL, NULL); + smb_fname_parent = synthetic_smb_fname(talloc_tos(), + inherit_from_dir, + NULL, + NULL, + 0); if (smb_fname_parent == NULL) { return; } @@ -515,8 +519,11 @@ NTSTATUS change_dir_owner_to_parent(connection_struct *conn, NTSTATUS status = NT_STATUS_OK; int ret; - smb_fname_parent = synthetic_smb_fname(ctx, inherit_from_dir, - NULL, NULL); + smb_fname_parent = synthetic_smb_fname(ctx, + inherit_from_dir, + NULL, + NULL, + 0); if (smb_fname_parent == NULL) { return NT_STATUS_NO_MEMORY; } @@ -556,7 +563,7 @@ NTSTATUS change_dir_owner_to_parent(connection_struct *conn, goto chdir; } - smb_fname_cwd = synthetic_smb_fname(ctx, ".", NULL, NULL); + smb_fname_cwd = synthetic_smb_fname(ctx, ".", NULL, NULL, 0); if (smb_fname_cwd == NULL) { status = NT_STATUS_NO_MEMORY; goto chdir; @@ -3812,8 +3819,11 @@ void msg_file_was_renamed(struct messaging_context *msg, stream_name = NULL; } - smb_fname = synthetic_smb_fname(talloc_tos(), base_name, - stream_name, NULL); + smb_fname = synthetic_smb_fname(talloc_tos(), + base_name, + stream_name, + NULL, + 0); if (smb_fname == NULL) { return; } @@ -3911,7 +3921,8 @@ static NTSTATUS open_streams_for_delete(connection_struct *conn, smb_fname_cp = synthetic_smb_fname(talloc_tos(), smb_fname->base_name, stream_info[i].name, - NULL); + NULL, + smb_fname->flags); if (smb_fname_cp == NULL) { status = NT_STATUS_NO_MEMORY; goto fail; @@ -4009,7 +4020,8 @@ static NTSTATUS inherit_new_acl(files_struct *fsp) parent_smb_fname = synthetic_smb_fname(talloc_tos(), parent_name, NULL, - NULL); + NULL, + fsp->fsp_name->flags); if (parent_smb_fname == NULL) { TALLOC_FREE(frame); @@ -4564,8 +4576,10 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, /* Create an smb_filename with stream_name == NULL. */ smb_fname_base = synthetic_smb_fname(talloc_tos(), - smb_fname->base_name, - NULL, NULL); + smb_fname->base_name, + NULL, + NULL, + smb_fname->flags); if (smb_fname_base == NULL) { status = NT_STATUS_NO_MEMORY; goto fail; diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c index 455dbf0cf49..2c9516d0756 100644 --- a/source3/smbd/pipes.c +++ b/source3/smbd/pipes.c @@ -51,7 +51,7 @@ NTSTATUS open_np_file(struct smb_request *smb_req, const char *name, fsp->can_lock = false; fsp->access_mask = FILE_READ_DATA | FILE_WRITE_DATA; - smb_fname = synthetic_smb_fname(talloc_tos(), name, NULL, NULL); + smb_fname = synthetic_smb_fname(talloc_tos(), name, NULL, NULL, 0); if (smb_fname == NULL) { file_free(smb_req, fsp); return NT_STATUS_NO_MEMORY; diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index c4eeb9c4bd9..8fc7cbae3fa 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -4642,7 +4642,8 @@ NTSTATUS get_nt_acl_no_snum(TALLOC_CTX *ctx, const char *fname, struct smb_filename *smb_fname = synthetic_smb_fname(talloc_tos(), fname, NULL, - NULL); + NULL, + 0); if (smb_fname == NULL) { TALLOC_FREE(frame); @@ -4809,7 +4810,7 @@ int posix_sys_acl_blob_get_file(vfs_handle_struct *handle, }; struct smb_filename *smb_fname; - smb_fname = synthetic_smb_fname(frame, path_p, NULL, NULL); + smb_fname = synthetic_smb_fname(frame, path_p, NULL, NULL, 0); if (smb_fname == NULL) { TALLOC_FREE(frame); errno = ENOMEM; diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c index 4d95bcff01b..fca8f108b57 100644 --- a/source3/smbd/pysmbd.c +++ b/source3/smbd/pysmbd.c @@ -199,9 +199,11 @@ static NTSTATUS get_nt_acl_conn(TALLOC_CTX *mem_ctx, TALLOC_CTX *frame = talloc_stackframe(); NTSTATUS status; struct smb_filename *smb_fname = synthetic_smb_fname(talloc_tos(), - fname, - NULL, - NULL); + fname, + NULL, + NULL, + lp_posix_pathnames() ? + SMB_FILENAME_POSIX_PATH : 0); if (smb_fname == NULL) { TALLOC_FREE(frame); @@ -398,7 +400,9 @@ static PyObject *py_smbd_chown(PyObject *self, PyObject *args, PyObject *kwargs) smb_fname = synthetic_smb_fname(talloc_tos(), fname, NULL, - NULL); + NULL, + lp_posix_pathnames() ? + SMB_FILENAME_POSIX_PATH : 0); if (smb_fname == NULL) { umask(saved_umask); TALLOC_FREE(frame); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index c18eb38722a..cbe15a38c35 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1825,7 +1825,8 @@ void reply_search(struct smb_request *req) smb_dname = synthetic_smb_fname(talloc_tos(), directory, NULL, - NULL); + NULL, + smb_fname->flags); if (smb_dname == NULL) { reply_nterror(req, NT_STATUS_NO_MEMORY); goto out; @@ -3088,7 +3089,8 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req, smb_fname_dir = synthetic_smb_fname(talloc_tos(), fname_dir, NULL, - NULL); + NULL, + smb_fname->flags); if (smb_fname_dir == NULL) { status = NT_STATUS_NO_MEMORY; goto out; @@ -7064,7 +7066,8 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx, smb_fname_src_dir = synthetic_smb_fname(talloc_tos(), fname_src_dir, NULL, - NULL); + NULL, + smb_fname_src->flags); if (smb_fname_src_dir == NULL) { status = NT_STATUS_NO_MEMORY; goto out; @@ -7779,7 +7782,8 @@ void reply_copy(struct smb_request *req) smb_fname_src_dir = synthetic_smb_fname(talloc_tos(), fname_src_dir, NULL, - NULL); + NULL, + smb_fname_src->flags); if (smb_fname_src_dir == NULL) { reply_nterror(req, NT_STATUS_NO_MEMORY); goto out; diff --git a/source3/smbd/service.c b/source3/smbd/service.c index ba8946d5d2f..2777a09e8e2 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -814,8 +814,11 @@ static NTSTATUS make_connection_snum(struct smbXsrv_connection *xconn, set_namearray( &conn->aio_write_behind_list, lp_aio_write_behind(talloc_tos(), snum)); } - smb_fname_cpath = synthetic_smb_fname(talloc_tos(), conn->connectpath, - NULL, NULL); + smb_fname_cpath = synthetic_smb_fname(talloc_tos(), + conn->connectpath, + NULL, + NULL, + 0); if (smb_fname_cpath == NULL) { status = NT_STATUS_NO_MEMORY; goto err_root_exit; diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index e23b8932948..a76b2df70d8 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -5764,8 +5764,11 @@ static void call_trans2qfilepathinfo(connection_struct *conn, /* Create an smb_filename with stream_name == NULL. */ smb_fname_base = synthetic_smb_fname( - talloc_tos(), smb_fname->base_name, - NULL, NULL); + talloc_tos(), + smb_fname->base_name, + NULL, + NULL, + smb_fname->flags); if (smb_fname_base == NULL) { reply_nterror(req, NT_STATUS_NO_MEMORY); return; @@ -6163,8 +6166,11 @@ static NTSTATUS smb_set_file_dosmode(connection_struct *conn, } /* Always operate on the base_name, even if a stream was passed in. */ - smb_fname_base = synthetic_smb_fname( - talloc_tos(), smb_fname->base_name, NULL, &smb_fname->st); + smb_fname_base = synthetic_smb_fname(talloc_tos(), + smb_fname->base_name, + NULL, + &smb_fname->st, + smb_fname->flags); if (smb_fname_base == NULL) { return NT_STATUS_NO_MEMORY; } @@ -6666,9 +6672,11 @@ static NTSTATUS smb2_file_rename_information(connection_struct *conn, } /* Create an smb_fname to call rename_internals_fsp() with. */ - smb_fname_dst = synthetic_smb_fname( - talloc_tos(), fsp->base_fsp->fsp_name->base_name, - newname, NULL); + smb_fname_dst = synthetic_smb_fname(talloc_tos(), + fsp->base_fsp->fsp_name->base_name, + newname, + NULL, + fsp->base_fsp->fsp_name->flags); if (smb_fname_dst == NULL) { status = NT_STATUS_NO_MEMORY; goto out; @@ -6872,9 +6880,11 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn, } /* Create an smb_fname to call rename_internals_fsp() with. */ - smb_fname_dst = synthetic_smb_fname( - talloc_tos(), fsp->base_fsp->fsp_name->base_name, - newname, NULL); + smb_fname_dst = synthetic_smb_fname(talloc_tos(), + fsp->base_fsp->fsp_name->base_name, + newname, + NULL, + fsp->base_fsp->fsp_name->flags); if (smb_fname_dst == NULL) { status = NT_STATUS_NO_MEMORY; goto out; @@ -6944,8 +6954,11 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn, goto out; } /* Create an smb_fname to call rename_internals_fsp() */ - smb_fname_dst = synthetic_smb_fname( - ctx, base_name, NULL, NULL); + smb_fname_dst = synthetic_smb_fname(ctx, + base_name, + NULL, + NULL, + smb_fname_src->flags); if (smb_fname_dst == NULL) { status = NT_STATUS_NO_MEMORY; goto out; diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index a1154aee784..972cea42117 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -876,7 +876,7 @@ char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn) goto nocache; } - smb_fname_dot = synthetic_smb_fname(ctx, ".", NULL, NULL); + smb_fname_dot = synthetic_smb_fname(ctx, ".", NULL, NULL, 0); if (smb_fname_dot == NULL) { errno = ENOMEM; goto out; @@ -904,7 +904,7 @@ char *vfs_GetWd(TALLOC_CTX *ctx, connection_struct *conn) && (cache_value.data[cache_value.length-1] == '\0')); smb_fname_full = synthetic_smb_fname(ctx, (char *)cache_value.data, - NULL, NULL); + NULL, NULL, 0); if (smb_fname_full == NULL) { errno = ENOMEM; goto out; @@ -1044,7 +1044,7 @@ NTSTATUS check_reduced_name_with_privilege(connection_struct *conn, resolved_name)); /* Now check the stat value is the same. */ - smb_fname_cwd = synthetic_smb_fname(talloc_tos(), ".", NULL, NULL); + smb_fname_cwd = synthetic_smb_fname(talloc_tos(), ".", NULL, NULL, 0); if (smb_fname_cwd == NULL) { status = NT_STATUS_NO_MEMORY; goto err; @@ -1968,7 +1968,8 @@ NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid) local_smb_fname = synthetic_smb_fname(talloc_tos(), final_component, NULL, - NULL); + NULL, + fsp->fsp_name->flags); if (local_smb_fname == NULL) { status = NT_STATUS_NO_MEMORY; goto out; diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index 7c49ce78db8..12610cf8f3c 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -30,6 +30,11 @@ static const char *null_string = ""; +static uint32_t ssf_flags(void) +{ + return lp_posix_pathnames() ? SMB_FILENAME_POSIX_PATH : 0; +} + static NTSTATUS cmd_load_module(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv) { int i; @@ -139,7 +144,8 @@ static NTSTATUS cmd_opendir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc smb_fname = synthetic_smb_fname(talloc_tos(), argv[1], NULL, - NULL); + NULL, + ssf_flags()); if (smb_fname == NULL) { return NT_STATUS_NO_MEMORY; } @@ -222,7 +228,8 @@ static NTSTATUS cmd_mkdir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, smb_fname = synthetic_smb_fname(talloc_tos(), argv[1], NULL, - NULL); + NULL, + ssf_flags()); if (smb_fname == NULL) { return NT_STATUS_NO_MEMORY; @@ -424,7 +431,8 @@ static NTSTATUS cmd_pathfunc(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int arg smb_fname = synthetic_smb_fname(talloc_tos(), argv[1], NULL, - NULL); + NULL, + ssf_flags()); if (smb_fname == NULL) { return NT_STATUS_NO_MEMORY; @@ -859,7 +867,8 @@ static NTSTATUS cmd_chmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, smb_fname = synthetic_smb_fname(talloc_tos(), argv[1], NULL, - NULL); + NULL, + ssf_flags()); if (smb_fname == NULL) { return NT_STATUS_NO_MEMORY; } @@ -918,7 +927,8 @@ static NTSTATUS cmd_chmod_acl(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int ar smb_fname = synthetic_smb_fname(talloc_tos(), argv[1], NULL, - NULL); + NULL, + ssf_flags()); if (smb_fname == NULL) { return NT_STATUS_NO_MEMORY; } @@ -979,7 +989,8 @@ static NTSTATUS cmd_chown(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, smb_fname = synthetic_smb_fname(talloc_tos(), argv[1], NULL, - NULL); + NULL, + ssf_flags()); if (smb_fname == NULL) { return NT_STATUS_NO_MEMORY; } @@ -1459,7 +1470,8 @@ static NTSTATUS cmd_get_nt_acl(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, smb_fname = synthetic_smb_fname(talloc_tos(), argv[1], NULL, - NULL); + NULL, + ssf_flags()); if (smb_fname == NULL) { return NT_STATUS_NO_MEMORY; @@ -1796,7 +1808,8 @@ static NTSTATUS cmd_translate_name(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, smb_fname = synthetic_smb_fname(talloc_tos(), ".", NULL, - NULL); + NULL, + ssf_flags()); if (smb_fname == NULL) { return NT_STATUS_NO_MEMORY; } -- 2.34.1