From e6b251426c1061adc716f95b938bb7c53f3bc54a Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Mon, 14 Jan 2013 15:13:12 +0100 Subject: [PATCH] Automatic AppleDouble conversion to EAs failing for directories of_stat() need be called before calling ad_convert() in order to have a valid struct stat of the element to be converted. Fixes bug #486. --- NEWS | 2 ++ etc/afpd/enumerate.c | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 08481d64..c2572250 100644 --- a/NEWS +++ b/NEWS @@ -27,6 +27,8 @@ Changes in 3.0.2 Setting the option to true causes afpd to follow symlinks on the server. symlinks may point outside of the AFP volume, currently afpd doesn't do any checks for "wide symlinks". +* FIX: Automatic AppleDouble conversion to EAs failing for directories. + Fixes bug #486. Changes in 3.0.1 ================ diff --git a/etc/afpd/enumerate.c b/etc/afpd/enumerate.c index 80141e80..0c3c0576 100644 --- a/etc/afpd/enumerate.c +++ b/etc/afpd/enumerate.c @@ -346,15 +346,9 @@ static int enumerate(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, sd.sd_last += len + 1; continue; } - memset(&s_path, 0, sizeof(s_path)); - /* conversions on the fly */ - const char *convname; + memset(&s_path, 0, sizeof(s_path)); s_path.u_name = sd.sd_last; - if (ad_convert(sd.sd_last, &s_path.st, vol, &convname) == 0 && convname) { - s_path.u_name = (char *)convname; - } - if (of_stat(vol, &s_path) < 0 ) { /* so the next time it won't try to stat it again * another solution would be to invalidate the cache with @@ -366,6 +360,12 @@ static int enumerate(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, continue; } + /* conversions on the fly */ + const char *convname; + if (ad_convert(sd.sd_last, &s_path.st, vol, &convname) == 0 && convname) { + s_path.u_name = (char *)convname; + } + /* Fixup CNID db if ad_convert resulted in a rename (then convname != NULL) */ if (convname) { s_path.id = cnid_lookup(vol->v_cdb, &s_path.st, curdir->d_did, sd.sd_last, strlen(sd.sd_last)); -- 2.39.2