From: Ralph Boehme Date: Fri, 2 Dec 2016 10:44:53 +0000 (+0100) Subject: vfs_fruit: add fruit_stat_rsrc_xattr() implementation X-Git-Tag: tdb-1.3.13~718 X-Git-Url: http://git.samba.org/samba.git/?a=commitdiff_plain;h=72325d946aacc1beec0eb411f4c7209e06850e91;p=metze%2Fsamba-autobuild%2F.git vfs_fruit: add fruit_stat_rsrc_xattr() implementation This fixes fruit_stat_rsrc for the fruit:resource=xattr case. 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 c0202afbf68..50d06528022 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -3634,6 +3634,48 @@ static int fruit_stat_rsrc_stream(vfs_handle_struct *handle, return ret; } +static int fruit_stat_rsrc_xattr(vfs_handle_struct *handle, + struct smb_filename *smb_fname, + bool follow_links) +{ +#ifdef HAVE_ATTROPEN + int ret; + int fd = -1; + + /* Populate the stat struct with info from the base file. */ + ret = fruit_stat_base(handle, smb_fname, follow_links); + if (ret != 0) { + return -1; + } + + fd = attropen(smb_fname->base_name, + AFPRESOURCE_EA_NETATALK, + O_RDONLY); + if (fd == -1) { + return 0; + } + + ret = sys_fstat(fd, &smb_fname->st, false); + if (ret != 0) { + close(fd); + DBG_ERR("fstat [%s:%s] failed\n", smb_fname->base_name, + AFPRESOURCE_EA_NETATALK); + return -1; + } + close(fd); + fd = -1; + + smb_fname->st.st_ex_ino = fruit_inode(&smb_fname->st, + smb_fname->stream_name); + + return ret; + +#else + errno = ENOSYS; + return -1; +#endif +} + static int fruit_stat_rsrc(vfs_handle_struct *handle, struct smb_filename *smb_fname, bool follow_links) @@ -3652,6 +3694,9 @@ static int fruit_stat_rsrc(vfs_handle_struct *handle, break; case FRUIT_RSRC_XATTR: + ret = fruit_stat_rsrc_xattr(handle, smb_fname, follow_links); + break; + case FRUIT_RSRC_ADFILE: ret = fruit_stat_rsrc_netatalk(handle, smb_fname, follow_links); break;