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.
Ensure the resource fork AppleDouble entry offset is always set up and
we don't rely on the manual offset calculation.
Skip ADEID_RFORK in ad_copy_header() and allow copying of AppleDouble
entry that have an initial zero size in the destination adouble.
Signed-off-by: Ralph Boehme <rb@sernet.de>
* 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
* 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
================
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_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;
EC_ZERO_LOG( copy_fork(ADEID_RFORK, &adea, &adv2) );
adea.ad_rlen = adv2.ad_rlen;
continue;
len = ads->ad_eid[ eid ].ade_len;
continue;
len = ads->ad_eid[ eid ].ade_len;
- if (!len || len != add->ad_eid[ eid ].ade_len)
continue;
switch (eid) {
case ADEID_COMMENT:
continue;
switch (eid) {
case ADEID_COMMENT:
- case ADEID_PRIVDEV:
- case ADEID_PRIVINO:
- case ADEID_PRIVSYN:
- case ADEID_PRIVID:
continue;
default:
ad_setentrylen( add, eid, len );
continue;
default:
ad_setentrylen( add, eid, len );
+ /*
+ * 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
+
+ /*
+ * 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();
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
*
* - 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, ...)
* @returns 0 on success, any other value indicates an error
*/
int ad_open(struct adouble *ad, const char *path, int adflags, ...)