aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Marcus Clarke <marcus@FreeBSD.org>2024-01-02 07:48:52 +0000
committerJoe Marcus Clarke <marcus@FreeBSD.org>2024-01-02 07:48:52 +0000
commit57f92b10c34cccaa7285d639707294c50daa8aa3 (patch)
tree281a8db996f3ea4ee6e5a55e41368836fe07e9ba
parent1f9a2281547e7eaf64dde7e374aa0f84a18374a9 (diff)
downloadports-57f92b10c34cccaa7285d639707294c50daa8aa3.tar.gz
ports-57f92b10c34cccaa7285d639707294c50daa8aa3.zip
net/netatalk3: fix parsing of macOS created AppleDouble files
-rw-r--r--net/netatalk3/Makefile1
-rw-r--r--net/netatalk3/files/patch-libatalk_adouble_ad__open.c43
2 files changed, 44 insertions, 0 deletions
diff --git a/net/netatalk3/Makefile b/net/netatalk3/Makefile
index acacf59363ea..a297d24722ee 100644
--- a/net/netatalk3/Makefile
+++ b/net/netatalk3/Makefile
@@ -1,5 +1,6 @@
PORTNAME= netatalk
PORTVERSION= 3.1.18
+PORTREVISION= 1
PORTEPOCH= 1
CATEGORIES= net
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}-${PORTVERSION:S/./-/g}
diff --git a/net/netatalk3/files/patch-libatalk_adouble_ad__open.c b/net/netatalk3/files/patch-libatalk_adouble_ad__open.c
new file mode 100644
index 000000000000..05102b8d34df
--- /dev/null
+++ b/net/netatalk3/files/patch-libatalk_adouble_ad__open.c
@@ -0,0 +1,43 @@
+--- libatalk/adouble/ad_open.c.orig 2024-01-02 07:44:09 UTC
++++ libatalk/adouble/ad_open.c
+@@ -668,6 +668,11 @@ reread:
+ int retry_read = 0;
+
+ reread:
++ if (hst == NULL) {
++ hst = &st;
++ EC_NEG1( fstat(ad_reso_fileno(ad), hst) );
++ }
++
+ LOG(log_debug, logtype_ad, "ad_header_read_osx: %s", path ? fullpathname(path) : "");
+ ad_init_old(&adosx, AD_VERSION_EA, ad->ad_options);
+ buf = &adosx.ad_data[0];
+@@ -707,7 +712,7 @@ reread:
+ return -1;
+ }
+
+- if (parse_entries(&adosx, nentries, header_len) != 0) {
++ if (parse_entries(&adosx, nentries, hst->st_size) != 0) {
+ LOG(log_warning, logtype_ad, "ad_header_read(%s): malformed AppleDouble",
+ path ? fullpathname(path) : "");
+ errno = EIO;
+@@ -725,6 +730,7 @@ reread:
+ }
+ retry_read++;
+ if (ad_convert_osx(path, &adosx) == 1) {
++ hst = NULL;
+ goto reread;
+ }
+ errno = EIO;
+@@ -738,11 +744,6 @@ reread:
+ LOG(log_error, logtype_ad, "ad_header_read_osx: problem with rfork entry offset.");
+ errno = EIO;
+ return -1;
+- }
+-
+- if (hst == NULL) {
+- hst = &st;
+- EC_NEG1( fstat(ad_reso_fileno(ad), &st) );
+ }
+
+ ad_setentryoff(ad, ADEID_RFORK, ad_getentryoff(&adosx, ADEID_RFORK));