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;
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,
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,
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
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);
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,
#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))
}
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,
}
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,
}
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,
}
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,
}
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,
}
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;
}
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)
{
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,
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);
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;
*********************************************************************/
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;
}
/*********************************************************************
*********************************************************************/
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) {
}
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;
}
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;
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);
}
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;
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;
);
if (rc) {
DEBUG(2, ("aclx_put failed with %s for %s\n",
- strerror(errno), name));
+ strerror(errno), smb_fname->base_name));
return -1;
}
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,
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;
}
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)
}
-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;
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;
}
}
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;
}
}
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)
{
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);
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);
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)
{
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;
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);
* 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;
}
}
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)
{
}
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)
{
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:
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)));
}
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);
}
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;
* 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;
? 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;
}
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;
}
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);
}
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)
{
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;
}
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)
{
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:
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)));
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);
}
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;
}
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,
}
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)
{
*/
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
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) {
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:
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) ));
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;
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);
SMB_ACL_T theacl, connection_struct *conn)
{
int ret;
+ struct smb_filename *smb_fname = NULL;
mode_t saved_umask;
TALLOC_CTX *frame = talloc_stackframe();
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);
}
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,