1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

vfs_fruit: fix fruit_chown() for the fruit:resource!=file case

The following code must only be executed for the fruit:resource=file
case.

While at it, remove an unnecessary lstat, use the stat info from
smb_fname.

Otherwise no change in behaviour for the fruit:resource=file case (the
default).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12427

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
This commit is contained in:
Ralph Boehme 2016-12-02 09:04:37 +01:00 committed by Uri Simchoni
parent 22b509f52e
commit 09c82a1ce1

View File

@ -3053,7 +3053,6 @@ static int fruit_chown(vfs_handle_struct *handle,
char *adp = NULL; char *adp = NULL;
struct fruit_config_data *config = NULL; struct fruit_config_data *config = NULL;
struct smb_filename *adp_smb_fname = NULL; struct smb_filename *adp_smb_fname = NULL;
SMB_STRUCT_STAT sb;
rc = SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid); rc = SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid);
if (rc != 0) { if (rc != 0) {
@ -3063,14 +3062,16 @@ static int fruit_chown(vfs_handle_struct *handle,
SMB_VFS_HANDLE_GET_DATA(handle, config, SMB_VFS_HANDLE_GET_DATA(handle, config,
struct fruit_config_data, return -1); struct fruit_config_data, return -1);
if (config->rsrc == FRUIT_RSRC_XATTR) { if (config->rsrc != FRUIT_RSRC_ADFILE) {
return rc; return 0;
} }
/* FIXME: direct sys_lstat(), need non-const smb_fname */ if (!VALID_STAT(smb_fname->st)) {
rc = sys_lstat(smb_fname->base_name, &sb, false); return 0;
if (rc != 0 || !S_ISREG(sb.st_ex_mode)) { }
return rc;
if (!S_ISREG(smb_fname->st.st_ex_mode)) {
return 0;
} }
rc = adouble_path(talloc_tos(), smb_fname->base_name, &adp); rc = adouble_path(talloc_tos(), smb_fname->base_name, &adp);