From: Ralph Boehme Date: Fri, 5 Oct 2018 13:12:44 +0000 (+0200) Subject: vfs_fruit: store filler bytes from AppleDouble file header in struct adouble X-Git-Tag: samba-4.8.8~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27d84625129bbe97599792f061050080661641f5;p=thirdparty%2Fsamba.git vfs_fruit: store filler bytes from AppleDouble file header in struct adouble This can later be used to distinguish between macOS created AppleDouble files and AppleDouble files created by Samba or Netatalk. macOS: "Mac OS X " Samba: "Netatalk " Netatalk: "Netatalk " Bug: https://bugzilla.samba.org/show_bug.cgi?id=13649 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison (cherry picked from commit 8ee7e6135e39520f486e8f8f4ba36009c9113229) --- diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index 4ad41da46a3..45937969d4e 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -262,6 +262,7 @@ typedef enum {ADOUBLE_META, ADOUBLE_RSRC} adouble_type_t; #define ADEDLEN_VERSION 4 #define ADEDLEN_FILLER 16 #define AD_FILLER_TAG "Netatalk " /* should be 16 bytes */ +#define AD_FILLER_TAG_OSX "Mac OS X " /* should be 16 bytes */ #define ADEDLEN_NENTRIES 2 #define AD_HEADER_LEN (ADEDLEN_MAGIC + ADEDLEN_VERSION + \ ADEDLEN_FILLER + ADEDLEN_NENTRIES) /* 26 */ @@ -414,6 +415,7 @@ struct adouble { adouble_type_t ad_type; uint32_t ad_magic; uint32_t ad_version; + uint8_t ad_filler[ADEDLEN_FILLER]; struct ad_entry ad_eid[ADEID_MAX]; char *ad_data; struct ad_xattr_header adx_header; @@ -837,6 +839,8 @@ static bool ad_unpack(struct adouble *ad, const size_t nentries, return false; } + memcpy(ad->ad_filler, ad->ad_data + ADEDOFF_FILLER, ADEDLEN_FILLER); + adentries = RSVAL(ad->ad_data, ADEDOFF_NENTRIES); if (adentries != nentries) { DEBUG(1, ("invalid number of entries: %zu\n",