diff options
Diffstat (limited to 'source3/modules/vfs_solarisacl.c')
-rw-r--r-- | source3/modules/vfs_solarisacl.c | 26 |
1 files changed, 16 insertions, 10 deletions
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; } |