* NEW: afpd: delete empty resource forks, from FR #92
* FIX: afpd: fix a crash when accessing ._ AppleDouble files created
by OS X via SMB, bug #564
+* FIX: afpd and dbd: Converting from AppleDouble v2 to ea may corrupt
+ the resource fork. In some circumstances an offset calculation
+ is wrong resulting in corrupt resource forks after the
+ conversion. Bug #568.
Changes in 3.1.2
================
EC_NEG1_LOG( ad_tmplock(&adv2, ADEID_RFORK, ADLOCK_WR | ADLOCK_FILELOCK, 0, 0, 0) );
/* Create a adouble:ea resource fork */
- EC_ZERO_LOG( ad_open(&adea, path, ADFLAGS_HF | ADFLAGS_RF | ADFLAGS_RDWR | ADFLAGS_CREATE, 0666) );
+ EC_ZERO_LOG( ad_open(&adea, path, ADFLAGS_RF|ADFLAGS_RDWR|ADFLAGS_CREATE|ADFLAGS_SETSHRMD, 0666) );
EC_ZERO_LOG( copy_fork(ADEID_RFORK, &adea, &adv2) );
adea.ad_rlen = adv2.ad_rlen;
continue;
len = ads->ad_eid[ eid ].ade_len;
- if (!len || len != add->ad_eid[ eid ].ade_len)
+ if (len == 0)
continue;
switch (eid) {
case ADEID_COMMENT:
- case ADEID_PRIVDEV:
- case ADEID_PRIVINO:
- case ADEID_PRIVSYN:
- case ADEID_PRIVID:
+ case ADEID_RFORK:
continue;
default:
ad_setentrylen( add, eid, len );
eid++;
}
+ /*
+ * Ensure the resource fork offset is always set
+ */
+#ifndef HAVE_EAFD
+ if (ad->ad_vers == AD_VERSION_EA)
+ ad_setentryoff(ad, ADEID_RFORK, ADEDOFF_RFORK_OSX);
+#endif
+
return 0;
}
EC_FAIL;
}
+ /*
+ * Ensure the resource fork offset is always set
+ */
+#ifndef HAVE_EAFD
+ if (ad->ad_vers == AD_VERSION_EA)
+ ad_setentryoff(ad, ADEID_RFORK, ADEDOFF_RFORK_OSX);
+#endif
+
EC_CLEANUP:
if (ret != 0 && errno == EINVAL) {
become_root();
* - we remember open fds for files because me must avoid a single close releasing fcntl locks for other
* fds of the same file
*
+ * BUGS:
+ *
+ * * on Solaris (HAVE_EAFD) ADFLAGS_RF doesn't work without
+ * ADFLAGS_HF, because it checks whether ad_meta_fileno() is already
+ * openend. As a workaround pass ADFLAGS_SETSHRMD.
+ *
* @returns 0 on success, any other value indicates an error
*/
int ad_open(struct adouble *ad, const char *path, int adflags, ...)