Mac OS X ZIP archives may contain split AppleDouble forks named "._XXX".
The client needs to be able to fully access these files but we currently
prevent access to any valid AppleDouble file whose name starts with "._".
In order to distinguish our own ._ files from the one created by OS X,
we look at the filler bytes: luckily OS X stores a string "Mac OS X" there
which can be used to detect them.
memcpy(buf, &temp, sizeof( temp ));
buf += sizeof( temp );
memcpy(buf, &temp, sizeof( temp ));
buf += sizeof( temp );
- memset(buf, 0, sizeof(ad->ad_filler));
+ memcpy(buf, "Netatalk ", 16);
buf += sizeof( ad->ad_filler );
nent = htons(ADEID_NUM_OSX);
buf += sizeof( ad->ad_filler );
nent = htons(ADEID_NUM_OSX);
adosx.ad_version = ntohl(adosx.ad_version);
if ((adosx.ad_magic != AD_MAGIC) || (adosx.ad_version != AD_VERSION2)) {
adosx.ad_version = ntohl(adosx.ad_version);
if ((adosx.ad_magic != AD_MAGIC) || (adosx.ad_version != AD_VERSION2)) {
- LOG(log_error, logtype_afpd, "ad_valid_header_osx: not an adouble:ox file");
+ LOG(log_warning, logtype_afpd, "ad_valid_header_osx: not an adouble:osx file");
+ if (strncmp(buf + ADEDOFF_FILLER, "Mac OS X", strlen("Mac OS X")) == 0)
+ /*
+ * It's a split fork created by OS X, it's not our "own" ._ file
+ * and thus not a valid header in this context.
+ * We allow enumeration and access.
+ */
+ EC_FAIL;
+
EC_CLEANUP:
LOG(log_debug, logtype_afpd, "ad_valid_header_osx(\"%s\"): END: %d", fullpathname(path), ret);
if (fd != -1)
EC_CLEANUP:
LOG(log_debug, logtype_afpd, "ad_valid_header_osx(\"%s\"): END: %d", fullpathname(path), ret);
if (fd != -1)