summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2015-08-24 17:43:40 +0200
committerKarolin Seeger <kseeger@samba.org>2016-01-06 10:07:18 +0100
commit73dac61aeb87d7a18b7465abf76c053d2138efe9 (patch)
tree20906cbdb2cb1337467063306b4d87ba3c65411e
parent9bedefbe7814ddd8e8213767ea73abbe5eea8450 (diff)
downloadsamba-73dac61aeb87d7a18b7465abf76c053d2138efe9.tar.gz
vfs_fruit: hide the Netatalk metadata xattr in streaminfo
Bug: https://bugzilla.samba.org/show_bug.cgi?id=11466 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit fedd09662c889fb796135d86836c160171fac68d)
-rw-r--r--source3/modules/vfs_fruit.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 885b5f05c58..9803fe213f5 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -1531,6 +1531,37 @@ static bool add_fruit_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams,
return true;
}
+static bool del_fruit_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams,
+ struct stream_struct **streams,
+ const char *name)
+{
+ struct stream_struct *tmp = *streams;
+ int i;
+
+ if (*num_streams == 0) {
+ return true;
+ }
+
+ for (i = 0; i < *num_streams; i++) {
+ if (strequal_m(tmp[i].name, name)) {
+ break;
+ }
+ }
+
+ if (i == *num_streams) {
+ return true;
+ }
+
+ TALLOC_FREE(tmp[i].name);
+ if (*num_streams - 1 > i) {
+ memmove(&tmp[i], &tmp[i+1],
+ (*num_streams - i - 1) * sizeof(struct stream_struct));
+ }
+
+ *num_streams -= 1;
+ return true;
+}
+
static bool empty_finderinfo(const struct adouble *ad)
{
@@ -3125,6 +3156,7 @@ static NTSTATUS fruit_streaminfo(vfs_handle_struct *handle,
struct fruit_config_data *config = NULL;
struct smb_filename *smb_fname = NULL;
struct adouble *ad = NULL;
+ NTSTATUS status;
SMB_VFS_HANDLE_GET_DATA(handle, config, struct fruit_config_data,
return NT_STATUS_UNSUCCESSFUL);
@@ -3173,8 +3205,23 @@ static NTSTATUS fruit_streaminfo(vfs_handle_struct *handle,
TALLOC_FREE(smb_fname);
- return SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx,
- pnum_streams, pstreams);
+ status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx,
+ pnum_streams, pstreams);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ if (config->meta == FRUIT_META_NETATALK) {
+ /* Remove the Netatalk xattr from the list */
+ if (!del_fruit_stream(mem_ctx, pnum_streams, pstreams,
+ ":" NETATALK_META_XATTR ":$DATA")) {
+ TALLOC_FREE(ad);
+ TALLOC_FREE(smb_fname);
+ return NT_STATUS_NO_MEMORY;
+ }
+ }
+
+ return NT_STATUS_OK;
}
static int fruit_ntimes(vfs_handle_struct *handle,