From: Ralph Boehme Date: Fri, 2 Dec 2016 08:02:27 +0000 (+0100) Subject: vfs_fruit: fix fruit_chmod() for the fruit:resource!=file case X-Git-Tag: tdb-1.3.13~725 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=22b509f52ed4de0856432327b3bf78fedcde141b;p=thirdparty%2Fsamba.git vfs_fruit: fix fruit_chmod() 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 Reviewed-by: Uri Simchoni --- diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index 8ca60af028a..5ad0e9c86b7 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -2993,7 +2993,6 @@ static int fruit_chmod(vfs_handle_struct *handle, int rc = -1; char *adp = NULL; struct fruit_config_data *config = NULL; - SMB_STRUCT_STAT sb; const char *path = smb_fname->base_name; struct smb_filename *smb_fname_adp = NULL; @@ -3005,14 +3004,16 @@ static int fruit_chmod(vfs_handle_struct *handle, SMB_VFS_HANDLE_GET_DATA(handle, config, struct fruit_config_data, return -1); - if (config->rsrc == FRUIT_RSRC_XATTR) { + if (config->rsrc != FRUIT_RSRC_ADFILE) { return 0; } - /* FIXME: direct sys_lstat(), missing smb_fname */ - rc = sys_lstat(path, &sb, false); - if (rc != 0 || !S_ISREG(sb.st_ex_mode)) { - return rc; + if (!VALID_STAT(smb_fname->st)) { + return 0; + } + + if (!S_ISREG(smb_fname->st.st_ex_mode)) { + return 0; } rc = adouble_path(talloc_tos(), path, &adp);