summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/VFS/skel_opaque.c6
-rw-r--r--examples/VFS/skel_transparent.c9
-rw-r--r--source3/include/smb_acls.h4
-rw-r--r--source3/include/vfs.h12
-rw-r--r--source3/include/vfs_macros.h8
-rw-r--r--source3/lib/sysacls.c34
-rw-r--r--source3/modules/posixacl_xattr.c5
-rw-r--r--source3/modules/posixacl_xattr.h2
-rw-r--r--source3/modules/vfs_acl_tdb.c37
-rw-r--r--source3/modules/vfs_acl_xattr.c11
-rw-r--r--source3/modules/vfs_aixacl.c8
-rw-r--r--source3/modules/vfs_aixacl2.c11
-rw-r--r--source3/modules/vfs_cap.c32
-rw-r--r--source3/modules/vfs_catia.c34
-rw-r--r--source3/modules/vfs_default.c7
-rw-r--r--source3/modules/vfs_fake_acls.c8
-rw-r--r--source3/modules/vfs_full_audit.c10
-rw-r--r--source3/modules/vfs_gpfs.c7
-rw-r--r--source3/modules/vfs_hpuxacl.c4
-rw-r--r--source3/modules/vfs_hpuxacl.h2
-rw-r--r--source3/modules/vfs_media_harmony.c26
-rw-r--r--source3/modules/vfs_nfs4acl_xattr.c2
-rw-r--r--source3/modules/vfs_posixacl.c8
-rw-r--r--source3/modules/vfs_posixacl.h2
-rw-r--r--source3/modules/vfs_solarisacl.c26
-rw-r--r--source3/modules/vfs_solarisacl.h2
-rw-r--r--source3/modules/vfs_time_audit.c7
-rw-r--r--source3/modules/vfs_tru64acl.c7
-rw-r--r--source3/modules/vfs_tru64acl.h2
-rw-r--r--source3/modules/vfs_unityed_media.c25
-rw-r--r--source3/modules/vfs_vxfs.c12
-rw-r--r--source3/modules/vfs_zfsacl.c2
-rw-r--r--source3/smbd/posix_acls.c16
-rw-r--r--source3/smbd/pysmbd.c12
-rw-r--r--source3/smbd/vfs.c8
35 files changed, 270 insertions, 138 deletions
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 8ecd0bef473..e7158203c50 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -774,8 +774,10 @@ static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
return -1;
}
-static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name,
- SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
+static int skel_sys_acl_set_file(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T acltype,
+ SMB_ACL_T theacl)
{
errno = ENOSYS;
return -1;
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 82d3c37408c..05d67234845 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -912,10 +912,13 @@ static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
blob_description, blob);
}
-static int skel_sys_acl_set_file(vfs_handle_struct *handle, const char *name,
- SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
+static int skel_sys_acl_set_file(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T acltype,
+ SMB_ACL_T theacl)
{
- return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl);
+ return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname,
+ acltype, theacl);
}
static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
diff --git a/source3/include/smb_acls.h b/source3/include/smb_acls.h
index f5603f3f38b..73b67af020e 100644
--- a/source3/include/smb_acls.h
+++ b/source3/include/smb_acls.h
@@ -59,7 +59,9 @@ SMB_ACL_T sys_acl_get_file(struct vfs_handle_struct *handle,
SMB_ACL_T sys_acl_get_fd(struct vfs_handle_struct *handle, struct files_struct *fsp,
TALLOC_CTX *mem_ctx);
int sys_acl_set_file(struct vfs_handle_struct *handle,
- const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d);
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T type,
+ SMB_ACL_T acl_d);
int sys_acl_set_fd(struct vfs_handle_struct *handle, struct files_struct *fsp,
SMB_ACL_T acl_d);
int sys_acl_delete_def_file(struct vfs_handle_struct *handle,
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index e32952a582a..f3a0b323923 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -203,6 +203,8 @@
to const struct smb_filename * */
/* Version 37 - Change sys_acl_blob_get_file from const char *
to const struct smb_filename * */
+/* Version 37 - Change sys_acl_set_file from const char *
+ to const struct smb_filename * */
#define SMB_VFS_INTERFACE_VERSION 37
@@ -876,7 +878,10 @@ struct vfs_fn_pointers {
int (*sys_acl_blob_get_fd_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp,
TALLOC_CTX *mem_ctx, char **blob_description,
DATA_BLOB *blob);
- int (*sys_acl_set_file_fn)(struct vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
+ int (*sys_acl_set_file_fn)(struct vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T acltype,
+ SMB_ACL_T theacl);
int (*sys_acl_set_fd_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_ACL_T theacl);
int (*sys_acl_delete_def_file_fn)(struct vfs_handle_struct *handle,
const struct smb_filename *smb_fname);
@@ -1335,8 +1340,9 @@ int smb_vfs_call_sys_acl_blob_get_fd(struct vfs_handle_struct *handle,
char **blob_description,
DATA_BLOB *blob);
int smb_vfs_call_sys_acl_set_file(struct vfs_handle_struct *handle,
- const char *name, SMB_ACL_TYPE_T acltype,
- SMB_ACL_T theacl);
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T acltype,
+ SMB_ACL_T theacl);
int smb_vfs_call_sys_acl_set_fd(struct vfs_handle_struct *handle,
struct files_struct *fsp, SMB_ACL_T theacl);
int smb_vfs_call_sys_acl_delete_def_file(struct vfs_handle_struct *handle,
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index 0ca601a89ab..ac04093b108 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -500,10 +500,10 @@
#define SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx, blob_description, blob) \
smb_vfs_call_sys_acl_blob_get_fd((handle)->next, (fsp), mem_ctx, (blob_description), (blob))
-#define SMB_VFS_SYS_ACL_SET_FILE(conn, name, acltype, theacl) \
- smb_vfs_call_sys_acl_set_file((conn)->vfs_handles, (name), (acltype), (theacl))
-#define SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl) \
- smb_vfs_call_sys_acl_set_file((handle)->next, (name), (acltype), (theacl))
+#define SMB_VFS_SYS_ACL_SET_FILE(conn, smb_fname, acltype, theacl) \
+ smb_vfs_call_sys_acl_set_file((conn)->vfs_handles, (smb_fname), (acltype), (theacl))
+#define SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, acltype, theacl) \
+ smb_vfs_call_sys_acl_set_file((handle)->next, (smb_fname), (acltype), (theacl))
#define SMB_VFS_SYS_ACL_SET_FD(fsp, theacl) \
smb_vfs_call_sys_acl_set_fd((fsp)->conn->vfs_handles, (fsp), (theacl))
diff --git a/source3/lib/sysacls.c b/source3/lib/sysacls.c
index 8016773110a..0bf3c37edfa 100644
--- a/source3/lib/sysacls.c
+++ b/source3/lib/sysacls.c
@@ -375,9 +375,11 @@ SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp, TALLOC_CT
}
int sys_acl_set_file(vfs_handle_struct *handle,
- const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d)
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T type,
+ SMB_ACL_T acl_d)
{
- return posixacl_sys_acl_set_file(handle, name, type, acl_d);
+ return posixacl_sys_acl_set_file(handle, smb_fname, type, acl_d);
}
int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
@@ -409,9 +411,11 @@ SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp,
}
int sys_acl_set_file(vfs_handle_struct *handle,
- const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d)
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T type,
+ SMB_ACL_T acl_d)
{
- return aixacl_sys_acl_set_file(handle, name, type, acl_d);
+ return aixacl_sys_acl_set_file(handle, smb_fname, type, acl_d);
}
int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
@@ -444,9 +448,11 @@ SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp,
}
int sys_acl_set_file(vfs_handle_struct *handle,
- const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d)
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T type,
+ SMB_ACL_T acl_d)
{
- return tru64acl_sys_acl_set_file(handle, name, type, acl_d);
+ return tru64acl_sys_acl_set_file(handle, smb_fname, type, acl_d);
}
int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
@@ -480,9 +486,11 @@ SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp,
}
int sys_acl_set_file(vfs_handle_struct *handle,
- const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d)
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T type,
+ SMB_ACL_T acl_d)
{
- return solarisacl_sys_acl_set_file(handle, name, type, acl_d);
+ return solarisacl_sys_acl_set_file(handle, smb_fname, type, acl_d);
}
int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
@@ -514,9 +522,11 @@ SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp,
}
int sys_acl_set_file(vfs_handle_struct *handle,
- const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d)
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T type,
+ SMB_ACL_T acl_d)
{
- return hpuxacl_sys_acl_set_file(handle, name, type, acl_d);
+ return hpuxacl_sys_acl_set_file(handle, smb_fname, type, acl_d);
}
int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
@@ -558,7 +568,9 @@ SMB_ACL_T sys_acl_get_fd(vfs_handle_struct *handle, files_struct *fsp,
}
int sys_acl_set_file(vfs_handle_struct *handle,
- const char *name, SMB_ACL_TYPE_T type, SMB_ACL_T acl_d)
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T type,
+ SMB_ACL_T acl_d)
{
#ifdef ENOTSUP
errno = ENOTSUP;
diff --git a/source3/modules/posixacl_xattr.c b/source3/modules/posixacl_xattr.c
index ded16a0bfba..416295fc6a8 100644
--- a/source3/modules/posixacl_xattr.c
+++ b/source3/modules/posixacl_xattr.c
@@ -444,7 +444,7 @@ SMB_ACL_T posixacl_xattr_acl_get_fd(vfs_handle_struct *handle,
}
int posixacl_xattr_acl_set_file(vfs_handle_struct *handle,
- const char *path_p,
+ const struct smb_filename *smb_fname,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
@@ -474,7 +474,8 @@ int posixacl_xattr_acl_set_file(vfs_handle_struct *handle,
return -1;
}
- return SMB_VFS_SETXATTR(handle->conn, path_p, name, buf, size, 0);
+ return SMB_VFS_SETXATTR(handle->conn, smb_fname->base_name,
+ name, buf, size, 0);
}
int posixacl_xattr_acl_set_fd(vfs_handle_struct *handle,
diff --git a/source3/modules/posixacl_xattr.h b/source3/modules/posixacl_xattr.h
index 8751692f571..70962dd3115 100644
--- a/source3/modules/posixacl_xattr.h
+++ b/source3/modules/posixacl_xattr.h
@@ -31,7 +31,7 @@ SMB_ACL_T posixacl_xattr_acl_get_fd(vfs_handle_struct *handle,
TALLOC_CTX *mem_ctx);
int posixacl_xattr_acl_set_file(vfs_handle_struct *handle,
- const char *name,
+ const struct smb_filename *smb_fname,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl);
diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c
index 68abc33012c..817add71fb9 100644
--- a/source3/modules/vfs_acl_tdb.c
+++ b/source3/modules/vfs_acl_tdb.c
@@ -246,7 +246,7 @@ static int unlink_acl_tdb(vfs_handle_struct *handle,
struct db_context *db = acl_db;
int ret = -1;
- smb_fname_tmp = cp_smb_filename(talloc_tos(), smb_fname);
+ smb_fname_tmp = cp_smb_filename_nostream(talloc_tos(), smb_fname);
if (smb_fname_tmp == NULL) {
errno = ENOMEM;
goto out;
@@ -383,31 +383,44 @@ static int connect_acl_tdb(struct vfs_handle_struct *handle,
*********************************************************************/
static int sys_acl_set_file_tdb(vfs_handle_struct *handle,
- const char *path,
- SMB_ACL_TYPE_T type,
- SMB_ACL_T theacl)
+ const struct smb_filename *smb_fname_in,
+ SMB_ACL_TYPE_T type,
+ SMB_ACL_T theacl)
{
struct db_context *db = acl_db;
int ret = -1;
- struct smb_filename smb_fname = {
- .base_name = discard_const_p(char, path)
+ int saved_errno = 0;
+ struct smb_filename *smb_fname = NULL;
+
+ smb_fname = cp_smb_filename_nostream(talloc_tos(), smb_fname_in);
+ if (smb_fname == NULL) {
+ return -1;
};
- ret = SMB_VFS_STAT(handle->conn, &smb_fname);
+ ret = SMB_VFS_STAT(handle->conn, smb_fname);
if (ret == -1) {
- return -1;
+ saved_errno = errno;
+ goto fail;
}
ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle,
- path,
+ smb_fname,
type,
theacl);
if (ret == -1) {
- return -1;
+ saved_errno = errno;
+ goto fail;
}
- acl_tdb_delete(handle, db, &smb_fname.st);
- return 0;
+ acl_tdb_delete(handle, db, &smb_fname->st);
+
+fail:
+ TALLOC_FREE(smb_fname);
+
+ if (saved_errno != 0) {
+ errno = saved_errno;
+ }
+ return ret;
}
/*********************************************************************
diff --git a/source3/modules/vfs_acl_xattr.c b/source3/modules/vfs_acl_xattr.c
index 96bd0166655..1dc70824bf5 100644
--- a/source3/modules/vfs_acl_xattr.c
+++ b/source3/modules/vfs_acl_xattr.c
@@ -168,12 +168,12 @@ static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle,
*********************************************************************/
static int sys_acl_set_file_xattr(vfs_handle_struct *handle,
- const char *name,
- SMB_ACL_TYPE_T type,
- SMB_ACL_T theacl)
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T type,
+ SMB_ACL_T theacl)
{
int ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle,
- name,
+ smb_fname,
type,
theacl);
if (ret == -1) {
@@ -181,7 +181,8 @@ static int sys_acl_set_file_xattr(vfs_handle_struct *handle,
}
become_root();
- SMB_VFS_REMOVEXATTR(handle->conn, name, XATTR_NTACL_NAME);
+ SMB_VFS_REMOVEXATTR(handle->conn, smb_fname->base_name,
+ XATTR_NTACL_NAME);
unbecome_root();
return ret;
diff --git a/source3/modules/vfs_aixacl.c b/source3/modules/vfs_aixacl.c
index 024c9aa2691..f6c42cb40b5 100644
--- a/source3/modules/vfs_aixacl.c
+++ b/source3/modules/vfs_aixacl.c
@@ -134,9 +134,9 @@ SMB_ACL_T aixacl_sys_acl_get_fd(vfs_handle_struct *handle,
}
int aixacl_sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
- SMB_ACL_TYPE_T type,
- SMB_ACL_T theacl)
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T type,
+ SMB_ACL_T theacl)
{
struct acl *file_acl = NULL;
unsigned int rc;
@@ -145,7 +145,7 @@ int aixacl_sys_acl_set_file(vfs_handle_struct *handle,
if (!file_acl)
return -1;
- rc = chacl((char *)name,file_acl,file_acl->acl_len);
+ rc = chacl((char *)smb_fname->base_name,file_acl,file_acl->acl_len);
DEBUG(10,("errno is %d\n",errno));
DEBUG(10,("return code is %d\n",rc));
SAFE_FREE(file_acl);
diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c
index 8613b59ccc6..2e4b61e369d 100644
--- a/source3/modules/vfs_aixacl2.c
+++ b/source3/modules/vfs_aixacl2.c
@@ -468,9 +468,9 @@ NTSTATUS aixjfs2_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint3
}
int aixjfs2_sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
- SMB_ACL_TYPE_T type,
- SMB_ACL_T theacl)
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T type,
+ SMB_ACL_T theacl)
{
struct acl *acl_aixc;
acl_type_t acl_type_info;
@@ -478,7 +478,8 @@ int aixjfs2_sys_acl_set_file(vfs_handle_struct *handle,
DEBUG(10, ("aixjfs2_sys_acl_set_file invoked for %s", name));
- rc = aixjfs2_query_acl_support((char *)name, ACL_AIXC, &acl_type_info);
+ rc = aixjfs2_query_acl_support((char *)smb_fname->base_name,
+ ACL_AIXC, &acl_type_info);
if (rc) {
DEBUG(8, ("jfs2_set_nt_acl: AIXC support not found\n"));
return -1;
@@ -498,7 +499,7 @@ int aixjfs2_sys_acl_set_file(vfs_handle_struct *handle,
);
if (rc) {
DEBUG(2, ("aclx_put failed with %s for %s\n",
- strerror(errno), name));
+ strerror(errno), smb_fname->base_name));
return -1;
}
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index 8aba4314fcb..8d621ccec5e 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -581,15 +581,41 @@ static SMB_ACL_T cap_sys_acl_get_file(vfs_handle_struct *handle,
return ret;
}
-static int cap_sys_acl_set_file(vfs_handle_struct *handle, const char *path, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
+static int cap_sys_acl_set_file(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T acltype,
+ SMB_ACL_T theacl)
{
- char *cappath = capencode(talloc_tos(), path);
+ struct smb_filename *cap_smb_fname = NULL;
+ char *cappath = capencode(talloc_tos(), smb_fname->base_name);
+ int ret;
+ int saved_errno = 0;
if (!cappath) {
errno = ENOMEM;
return -1;
}
- return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, cappath, acltype, theacl);
+ cap_smb_fname = synthetic_smb_fname(talloc_tos(),
+ cappath,
+ NULL,
+ NULL,
+ smb_fname->flags);
+ if (cap_smb_fname == NULL) {
+ TALLOC_FREE(cappath);
+ errno = ENOMEM;
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, cap_smb_fname,
+ acltype, theacl);
+ if (ret == -1) {
+ saved_errno = errno;
+ }
+ TALLOC_FREE(cappath);
+ TALLOC_FREE(cap_smb_fname);
+ if (saved_errno != 0) {
+ errno = saved_errno;
+ }
+ return ret;
}
static int cap_sys_acl_delete_def_file(vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index 18dbc80cd87..24fc26d122f 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -1291,24 +1291,46 @@ catia_sys_acl_get_file(vfs_handle_struct *handle,
static int
catia_sys_acl_set_file(vfs_handle_struct *handle,
- const char *path,
- SMB_ACL_TYPE_T type,
- SMB_ACL_T theacl)
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T type,
+ SMB_ACL_T theacl)
{
+ struct smb_filename *mapped_smb_fname = NULL;
+ int saved_errno = 0;
char *mapped_name = NULL;
NTSTATUS status;
int ret;
status = catia_string_replace_allocate(handle->conn,
- path, &mapped_name, vfs_translate_to_unix);
+ smb_fname->base_name,
+ &mapped_name,
+ vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
}
- ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, mapped_name, type, theacl);
- TALLOC_FREE(mapped_name);
+ mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
+ mapped_name,
+ NULL,
+ NULL,
+ smb_fname->flags);
+ if (mapped_smb_fname == NULL) {
+ TALLOC_FREE(mapped_name);
+ errno = ENOMEM;
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, mapped_smb_fname,
+ type, theacl);
+ if (ret == -1) {
+ saved_errno = errno;
+ }
+ TALLOC_FREE(mapped_smb_fname);
+ TALLOC_FREE(mapped_name);
+ if (saved_errno != 0) {
+ errno = saved_errno;
+ }
return ret;
}
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index c3de3d7572d..ad47f38105f 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -2724,9 +2724,12 @@ static SMB_ACL_T vfswrap_sys_acl_get_fd(vfs_handle_struct *handle,
return sys_acl_get_fd(handle, fsp, mem_ctx);
}
-static int vfswrap_sys_acl_set_file(vfs_handle_struct *handle, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
+static int vfswrap_sys_acl_set_file(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T acltype,
+ SMB_ACL_T theacl)
{
- return sys_acl_set_file(handle, name, acltype, theacl);
+ return sys_acl_set_file(handle, smb_fname, acltype, theacl);
}
static int vfswrap_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp, SMB_ACL_T theacl)
diff --git a/source3/modules/vfs_fake_acls.c b/source3/modules/vfs_fake_acls.c
index cb8d12395cc..fc655c874eb 100644
--- a/source3/modules/vfs_fake_acls.c
+++ b/source3/modules/vfs_fake_acls.c
@@ -316,7 +316,10 @@ static SMB_ACL_T fake_acls_sys_acl_get_fd(struct vfs_handle_struct *handle,
}
-static int fake_acls_sys_acl_set_file(vfs_handle_struct *handle, const char *path, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
+static int fake_acls_sys_acl_set_file(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T acltype,
+ SMB_ACL_T theacl)
{
int ret;
const char *name = NULL;
@@ -336,7 +339,8 @@ static int fake_acls_sys_acl_set_file(vfs_handle_struct *handle, const char *pat
name = FAKE_ACL_DEFAULT_XATTR;
break;
}
- ret = SMB_VFS_NEXT_SETXATTR(handle, path, name, blob.data, blob.length, 0);
+ ret = SMB_VFS_NEXT_SETXATTR(handle, smb_fname->base_name,
+ name, blob.data, blob.length, 0);
TALLOC_FREE(frame);
return ret;
}
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 6d281d88c90..07f01c27e99 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -2214,17 +2214,17 @@ static int smb_full_audit_sys_acl_blob_get_fd(vfs_handle_struct *handle,
}
static int smb_full_audit_sys_acl_set_file(vfs_handle_struct *handle,
-
- const char *name, SMB_ACL_TYPE_T acltype,
- SMB_ACL_T theacl)
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T acltype,
+ SMB_ACL_T theacl)
{
int result;
- result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype,
+ result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, acltype,
theacl);
do_log(SMB_VFS_OP_SYS_ACL_SET_FILE, (result >= 0), handle,
- "%s", name);
+ "%s", smb_fname->base_name);
return result;
}
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 87ddf5de413..4dc9f76a42d 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -1233,7 +1233,7 @@ static struct gpfs_acl *smb2gpfs_acl(const SMB_ACL_T pacl,
}
static int gpfsacl_sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
+ const struct smb_filename *smb_fname,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
@@ -1246,7 +1246,8 @@ static int gpfsacl_sys_acl_set_file(vfs_handle_struct *handle,
return -1);
if (!config->acl) {
- return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, type, theacl);
+ return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname,
+ type, theacl);
}
gpfs_acl = smb2gpfs_acl(theacl, type);
@@ -1254,7 +1255,7 @@ static int gpfsacl_sys_acl_set_file(vfs_handle_struct *handle,
return -1;
}
- result = gpfswrap_putacl(discard_const_p(char, name),
+ result = gpfswrap_putacl(discard_const_p(char, smb_fname->base_name),
GPFS_PUTACL_STRUCT|GPFS_ACL_SAMBA, gpfs_acl);
SAFE_FREE(gpfs_acl);
diff --git a/source3/modules/vfs_hpuxacl.c b/source3/modules/vfs_hpuxacl.c
index c344cb95fde..53e0ad6fe80 100644
--- a/source3/modules/vfs_hpuxacl.c
+++ b/source3/modules/vfs_hpuxacl.c
@@ -209,7 +209,7 @@ SMB_ACL_T hpuxacl_sys_acl_get_fd(vfs_handle_struct *handle,
int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
+ const struct smb_filename *smb_fname_in,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
@@ -222,7 +222,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, 0);
+ smb_fname = cp_smb_filename(talloc_tos(), smb_fname_in);
if (smb_fname == NULL) {
status = NT_STATUS_NO_MEMORY;
goto done;
diff --git a/source3/modules/vfs_hpuxacl.h b/source3/modules/vfs_hpuxacl.h
index b629c7d0b7f..b1b9ec3eccb 100644
--- a/source3/modules/vfs_hpuxacl.h
+++ b/source3/modules/vfs_hpuxacl.h
@@ -41,7 +41,7 @@ SMB_ACL_T hpuxacl_sys_acl_get_fd(vfs_handle_struct *handle,
files_struct *fsp);
int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
+ const struct smb_filename *smb_fname,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl);
diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c
index cad3d9fcfe8..6915fb0e21e 100644
--- a/source3/modules/vfs_media_harmony.c
+++ b/source3/modules/vfs_media_harmony.c
@@ -2138,36 +2138,32 @@ out:
* In this case, "name" is a path.
*/
static int mh_sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
+ const struct smb_filename *smb_fname,
SMB_ACL_TYPE_T acltype,
SMB_ACL_T theacl)
{
int status;
- char *clientPath;
- TALLOC_CTX *ctx;
+ struct smb_filename *clientFname = NULL;
DEBUG(MH_INFO_DEBUG, ("Entering mh_sys_acl_set_file\n"));
- if (!is_in_media_files(name))
- {
- status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name,
+ if (!is_in_media_files(smb_fname->base_name)) {
+ status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname,
acltype, theacl);
goto out;
}
- clientPath = NULL;
- ctx = talloc_tos();
-
- if ((status = alloc_get_client_path(handle, ctx,
- name,
- &clientPath)))
- {
+ status = alloc_get_client_smb_fname(handle,
+ talloc_tos(),
+ smb_fname,
+ &clientFname);
+ if (status != 0) {
goto err;
}
- status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, clientPath,
+ status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, clientFname,
acltype, theacl);
err:
- TALLOC_FREE(clientPath);
+ TALLOC_FREE(clientFname);
out:
return status;
}
diff --git a/source3/modules/vfs_nfs4acl_xattr.c b/source3/modules/vfs_nfs4acl_xattr.c
index a0c4af7ec6b..faf9f9b0597 100644
--- a/source3/modules/vfs_nfs4acl_xattr.c
+++ b/source3/modules/vfs_nfs4acl_xattr.c
@@ -600,7 +600,7 @@ static SMB_ACL_T nfs4acl_xattr_fail__sys_acl_get_fd(vfs_handle_struct *handle,
}
static int nfs4acl_xattr_fail__sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
+ const struct smb_filename *smb_fname,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
diff --git a/source3/modules/vfs_posixacl.c b/source3/modules/vfs_posixacl.c
index d99f538524c..0cad9b6ec68 100644
--- a/source3/modules/vfs_posixacl.c
+++ b/source3/modules/vfs_posixacl.c
@@ -81,7 +81,7 @@ SMB_ACL_T posixacl_sys_acl_get_fd(vfs_handle_struct *handle,
}
int posixacl_sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
+ const struct smb_filename *smb_fname,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
@@ -89,7 +89,9 @@ int posixacl_sys_acl_set_file(vfs_handle_struct *handle,
acl_type_t acl_type;
acl_t acl;
- DEBUG(10, ("Calling acl_set_file: %s, %d\n", name, type));
+ DEBUG(10, ("Calling acl_set_file: %s, %d\n",
+ smb_fname->base_name,
+ type));
switch(type) {
case SMB_ACL_TYPE_ACCESS:
@@ -106,7 +108,7 @@ int posixacl_sys_acl_set_file(vfs_handle_struct *handle,
if ((acl = smb_acl_to_posix(theacl)) == NULL) {
return -1;
}
- res = acl_set_file(name, acl_type, acl);
+ res = acl_set_file(smb_fname->base_name, acl_type, acl);
if (res != 0) {
DEBUG(10, ("acl_set_file failed: %s\n", strerror(errno)));
}
diff --git a/source3/modules/vfs_posixacl.h b/source3/modules/vfs_posixacl.h
index 8dd138e632d..9cd3160f345 100644
--- a/source3/modules/vfs_posixacl.h
+++ b/source3/modules/vfs_posixacl.h
@@ -31,7 +31,7 @@ SMB_ACL_T posixacl_sys_acl_get_fd(vfs_handle_struct *handle,
TALLOC_CTX *mem_ctx);
int posixacl_sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
+ const struct smb_filename *smb_fname,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl);
diff --git a/source3/modules/vfs_solarisacl.c b/source3/modules/vfs_solarisacl.c
index 4506274a99c..74086bd9fa7 100644
--- a/source3/modules/vfs_solarisacl.c
+++ b/source3/modules/vfs_solarisacl.c
@@ -136,19 +136,23 @@ SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle,
}
int solarisacl_sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
+ const struct smb_filename *smb_fname_in,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
int ret = -1;
SOLARIS_ACL_T solaris_acl = NULL;
int count;
- struct smb_filename smb_fname = {
- .base_name = discard_const_p(char, name)
- };
+ struct smb_filename *smb_fname = NULL;
+
+ smb_fname = cp_smb_filename_nostream(talloc_tos(), smb_fname_in);
+ if (smb_fname == NULL) {
+ errno = ENOMEM;
+ goto done;
+ }
DEBUG(10, ("solarisacl_sys_acl_set_file called for file '%s'\n",
- name));
+ smb_fname->base_name));
if ((type != SMB_ACL_TYPE_ACCESS) && (type != SMB_ACL_TYPE_DEFAULT)) {
errno = EINVAL;
@@ -176,12 +180,12 @@ int solarisacl_sys_acl_set_file(vfs_handle_struct *handle,
* For a Windows acl mapped call on a symlink, we want to follow
* it.
*/
- ret = SMB_VFS_STAT(handle->conn, &smb_fname);
+ ret = SMB_VFS_STAT(handle->conn, smb_fname);
if (ret != 0) {
DEBUG(10, ("Error in stat call: %s\n", strerror(errno)));
goto done;
}
- if (S_ISDIR(smb_fname.st.st_ex_mode)) {
+ if (S_ISDIR(smb_fname->st.st_ex_mode)) {
SOLARIS_ACL_T other_acl = NULL;
int other_count;
SMB_ACL_TYPE_T other_type;
@@ -190,7 +194,8 @@ int solarisacl_sys_acl_set_file(vfs_handle_struct *handle,
? SMB_ACL_TYPE_DEFAULT
: SMB_ACL_TYPE_ACCESS;
DEBUGADD(10, ("getting acl from filesystem\n"));
- if (!solaris_acl_get_file(name, &other_acl, &other_count)) {
+ if (!solaris_acl_get_file(smb_fname->base_name,
+ &other_acl, &other_count)) {
DEBUG(10, ("error getting acl from directory\n"));
goto done;
}
@@ -217,12 +222,13 @@ int solarisacl_sys_acl_set_file(vfs_handle_struct *handle,
goto done;
}
- ret = acl(name, SETACL, count, solaris_acl);
-
+ ret = acl(smb_fname->base_name, SETACL, count, solaris_acl);
+
done:
DEBUG(10, ("solarisacl_sys_acl_set_file %s.\n",
((ret != 0) ? "failed" : "succeeded")));
SAFE_FREE(solaris_acl);
+ TALLOC_FREE(smb_fname);
return ret;
}
diff --git a/source3/modules/vfs_solarisacl.h b/source3/modules/vfs_solarisacl.h
index 0ee4fa3131c..02bd3711da8 100644
--- a/source3/modules/vfs_solarisacl.h
+++ b/source3/modules/vfs_solarisacl.h
@@ -30,7 +30,7 @@ SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle,
TALLOC_CTX *mem_ctx);
int solarisacl_sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
+ const struct smb_filename *smb_fname,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl);
diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c
index d62df373269..2a2f084cdd8 100644
--- a/source3/modules/vfs_time_audit.c
+++ b/source3/modules/vfs_time_audit.c
@@ -2258,7 +2258,7 @@ static int smb_time_audit_sys_acl_blob_get_fd(vfs_handle_struct *handle,
}
static int smb_time_audit_sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
+ const struct smb_filename *smb_fname,
SMB_ACL_TYPE_T acltype,
SMB_ACL_T theacl)
{
@@ -2267,13 +2267,14 @@ static int smb_time_audit_sys_acl_set_file(vfs_handle_struct *handle,
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype,
+ result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, acltype,
theacl);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_fname("sys_acl_set_file", timediff, name);
+ smb_time_audit_log_fname("sys_acl_set_file", timediff,
+ smb_fname->base_name);
}
return result;
diff --git a/source3/modules/vfs_tru64acl.c b/source3/modules/vfs_tru64acl.c
index 69e5dfcaec4..d44e56a0df9 100644
--- a/source3/modules/vfs_tru64acl.c
+++ b/source3/modules/vfs_tru64acl.c
@@ -88,7 +88,7 @@ SMB_ACL_T tru64acl_sys_acl_get_fd(vfs_handle_struct *handle,
}
int tru64acl_sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
+ const struct smb_filename *smb_fname,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
@@ -97,7 +97,7 @@ int tru64acl_sys_acl_set_file(vfs_handle_struct *handle,
acl_t tru64_acl;
DEBUG(10, ("tru64acl_sys_acl_set_file called with name %s, type %d\n",
- name, type));
+ smb_fname->base_name, type));
switch(type) {
case SMB_ACL_TYPE_ACCESS:
@@ -120,7 +120,8 @@ int tru64acl_sys_acl_set_file(vfs_handle_struct *handle,
goto fail;
}
DEBUG(10, ("got tru64 acl...\n"));
- res = acl_set_file((char *)name, the_acl_type, tru64_acl);
+ res = acl_set_file((char *)smb_fname->base_name,
+ the_acl_type, tru64_acl);
acl_free(tru64_acl);
if (res != 0) {
DEBUG(10, ("acl_set_file failed: %s\n", strerror(errno)));
diff --git a/source3/modules/vfs_tru64acl.h b/source3/modules/vfs_tru64acl.h
index 0af0930b004..8dab1f0ec71 100644
--- a/source3/modules/vfs_tru64acl.h
+++ b/source3/modules/vfs_tru64acl.h
@@ -28,7 +28,7 @@ SMB_ACL_T tru64acl_sys_acl_get_fd(vfs_handle_struct *handle,
files_struct *fsp);
int tru64acl_sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
+ const struct smb_filename *smb_fname,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl);
diff --git a/source3/modules/vfs_unityed_media.c b/source3/modules/vfs_unityed_media.c
index 93d9ce68755..21d5416568e 100644
--- a/source3/modules/vfs_unityed_media.c
+++ b/source3/modules/vfs_unityed_media.c
@@ -1649,31 +1649,40 @@ err:
}
static int um_sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
+ const struct smb_filename *smb_fname,
SMB_ACL_TYPE_T acltype,
SMB_ACL_T theacl)
{
int status;
- char *client_path = NULL;
+ int saved_errno = 0;
+ struct smb_filename *client_fname = NULL;
DEBUG(10, ("Entering um_sys_acl_set_file\n"));
- if (!is_in_media_files(name)) {
- return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name,
+ if (!is_in_media_files(smb_fname->base_name)) {
+ return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname,
acltype, theacl);
}
- status = alloc_get_client_path(handle, talloc_tos(),
- name, &client_path);
+ status = alloc_get_client_smb_fname(handle,
+ talloc_tos(),
+ smb_fname,
+ &client_fname);
if (status != 0) {
goto err;
}
- status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, client_path,
+ status = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, client_fname,
acltype, theacl);
err:
- TALLOC_FREE(client_path);
+ if (status == -1) {
+ saved_errno = errno;
+ }
+ TALLOC_FREE(client_fname);
+ if (saved_errno != 0) {
+ errno = saved_errno;
+ }
return status;
}
diff --git a/source3/modules/vfs_vxfs.c b/source3/modules/vfs_vxfs.c
index 658649406e3..5dc9ba2cfe3 100644
--- a/source3/modules/vfs_vxfs.c
+++ b/source3/modules/vfs_vxfs.c
@@ -499,14 +499,18 @@ static int vxfs_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
}
-static int vxfs_sys_acl_set_file(vfs_handle_struct *handle, const char *name,
- SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl)
+static int vxfs_sys_acl_set_file(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T acltype,
+ SMB_ACL_T theacl)
{
- if (vxfs_compare(handle->conn, (char *)name, theacl, acltype)) {
+ if (vxfs_compare(handle->conn, (char *)smb_fname->base_name,
+ theacl, acltype)) {
return 0;
}
- return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype, theacl);
+ return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname,
+ acltype, theacl);
}
static int vxfs_set_xattr(struct vfs_handle_struct *handle, const char *path,
diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c
index cf341da371e..76cf5281af7 100644
--- a/source3/modules/vfs_zfsacl.c
+++ b/source3/modules/vfs_zfsacl.c
@@ -299,7 +299,7 @@ static SMB_ACL_T zfsacl_fail__sys_acl_get_fd(vfs_handle_struct *handle,
}
static int zfsacl_fail__sys_acl_set_file(vfs_handle_struct *handle,
- const char *name,
+ const struct smb_filename *smb_fname,
SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index 07e0584003c..2d12f1dfd9f 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -2970,7 +2970,7 @@ static bool set_canon_ace_list(files_struct *fsp,
*/
if(default_ace || fsp->is_directory || fsp->fh->fd == -1) {
- if (SMB_VFS_SYS_ACL_SET_FILE(conn, fsp->fsp_name->base_name,
+ if (SMB_VFS_SYS_ACL_SET_FILE(conn, fsp->fsp_name,
the_acl_type, the_acl) == -1) {
/*
* Some systems allow all the above calls and only fail with no ACL support
@@ -2990,7 +2990,7 @@ static bool set_canon_ace_list(files_struct *fsp,
become_root();
sret = SMB_VFS_SYS_ACL_SET_FILE(conn,
- fsp->fsp_name->base_name, the_acl_type,
+ fsp->fsp_name, the_acl_type,
the_acl);
unbecome_root();
if (sret == 0) {
@@ -4173,7 +4173,7 @@ static int copy_access_posix_acl(connection_struct *conn,
if ((ret = chmod_acl_internals(conn, posix_acl, mode)) == -1)
goto done;
- ret = SMB_VFS_SYS_ACL_SET_FILE(conn, smb_fname_to->base_name,
+ ret = SMB_VFS_SYS_ACL_SET_FILE(conn, smb_fname_to,
SMB_ACL_TYPE_ACCESS, posix_acl);
done:
@@ -4466,7 +4466,7 @@ bool set_unix_posix_default_acl(connection_struct *conn,
return False;
}
- if (SMB_VFS_SYS_ACL_SET_FILE(conn, smb_fname->base_name,
+ if (SMB_VFS_SYS_ACL_SET_FILE(conn, smb_fname,
SMB_ACL_TYPE_DEFAULT, def_acl) == -1) {
DEBUG(5,("set_unix_posix_default_acl: acl_set_file failed on directory %s (%s)\n",
smb_fname->base_name, strerror(errno) ));
@@ -4603,7 +4603,10 @@ static bool remove_posix_acl(connection_struct *conn,
goto done;
}
} else {
- if (SMB_VFS_SYS_ACL_SET_FILE(conn, fname, SMB_ACL_TYPE_ACCESS, new_file_acl) == -1) {
+ if (SMB_VFS_SYS_ACL_SET_FILE(conn,
+ smb_fname,
+ SMB_ACL_TYPE_ACCESS,
+ new_file_acl) == -1) {
DEBUG(5,("remove_posix_acl: acl_set_file failed on %s (%s)\n",
fname, strerror(errno) ));
goto done;
@@ -4657,7 +4660,8 @@ bool set_unix_posix_acl(connection_struct *conn, files_struct *fsp,
return False;
}
} else {
- if (SMB_VFS_SYS_ACL_SET_FILE(conn, fname, SMB_ACL_TYPE_ACCESS, file_acl) == -1) {
+ if (SMB_VFS_SYS_ACL_SET_FILE(conn, smb_fname,
+ SMB_ACL_TYPE_ACCESS, file_acl) == -1) {
DEBUG(5,("set_unix_posix_acl: acl_set_file failed on %s (%s)\n",
fname, strerror(errno) ));
TALLOC_FREE(file_acl);
diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c
index df6ab188e6b..63fc5d68c33 100644
--- a/source3/smbd/pysmbd.c
+++ b/source3/smbd/pysmbd.c
@@ -81,6 +81,7 @@ static int set_sys_acl_conn(const char *fname,
SMB_ACL_T theacl, connection_struct *conn)
{
int ret;
+ struct smb_filename *smb_fname = NULL;
mode_t saved_umask;
TALLOC_CTX *frame = talloc_stackframe();
@@ -89,7 +90,16 @@ static int set_sys_acl_conn(const char *fname,
so set our umask to 0 */
saved_umask = umask(0);
- ret = SMB_VFS_SYS_ACL_SET_FILE( conn, fname, acltype, theacl);
+ smb_fname = synthetic_smb_fname_split(frame,
+ fname,
+ lp_posix_pathnames());
+ if (smb_fname == NULL) {
+ TALLOC_FREE(frame);
+ umask(saved_umask);
+ return -1;
+ }
+
+ ret = SMB_VFS_SYS_ACL_SET_FILE( conn, smb_fname, acltype, theacl);
umask(saved_umask);
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 8dd84a21eda..fc0a519383b 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -2479,11 +2479,13 @@ int smb_vfs_call_sys_acl_blob_get_fd(struct vfs_handle_struct *handle,
}
int smb_vfs_call_sys_acl_set_file(struct vfs_handle_struct *handle,
- const char *name, SMB_ACL_TYPE_T acltype,
- SMB_ACL_T theacl)
+ const struct smb_filename *smb_fname,
+ SMB_ACL_TYPE_T acltype,
+ SMB_ACL_T theacl)
{
VFS_FIND(sys_acl_set_file);
- return handle->fns->sys_acl_set_file_fn(handle, name, acltype, theacl);
+ return handle->fns->sys_acl_set_file_fn(handle, smb_fname,
+ acltype, theacl);
}
int smb_vfs_call_sys_acl_set_fd(struct vfs_handle_struct *handle,