From: Frank Lahm Date: Sat, 6 Apr 2013 15:08:37 +0000 (+0200) Subject: Fix an issue with filenames containing non-ASCII characters X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=commitdiff_plain;h=1e787cd52b5d7327d180af76ca7e4ab071683313 Fix an issue with filenames containing non-ASCII characters Fix an issue with filenames containing non-ASCII characters that lead to a failure setting the size of a files ressource fork. This affected application like Adobe Photoshop where saving files may fail. Fixes bug #511. --- diff --git a/NEWS b/NEWS index 5d6ff9cf..65c6c1e0 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,10 @@ Changes in 3.0.4 * FIX: Opening files without metadata EA may result in an invalid metadata EA. Check for malformed metadata EAs and delete them. Fixes bug #510. +* FIX: Fix an issue with filenames containing non-ASCII characters that + lead to a failure setting the size of a files ressource fork. + This affected application like Adobe Photoshop where saving + files may fail. Fixes bug #511. Changes in 3.0.3 ================ diff --git a/etc/afpd/fork.c b/etc/afpd/fork.c index 0d050b32..0c988828 100644 --- a/etc/afpd/fork.c +++ b/etc/afpd/fork.c @@ -583,7 +583,7 @@ int afp_setforkparams(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf _U_, s goto afp_setfork_err; } - err = ad_rtruncate(ofork->of_ad, size); + err = ad_rtruncate(ofork->of_ad, mtoupath(ofork->of_vol, of_name(ofork), ofork->of_did, utf8_encoding(obj)), size); if (st_size > size) ad_tmplock(ofork->of_ad, eid, ADLOCK_CLR, size, st_size -size, ofork->of_refnum); if (err < 0) diff --git a/include/atalk/adouble.h b/include/atalk/adouble.h index de0598b5..b0d803b2 100644 --- a/include/atalk/adouble.h +++ b/include/atalk/adouble.h @@ -423,7 +423,7 @@ extern ssize_t ad_write(struct adouble *, uint32_t, off_t, int, const char *, si extern ssize_t adf_pread(struct ad_fd *, void *, size_t, off_t); extern ssize_t adf_pwrite(struct ad_fd *, const void *, size_t, off_t); extern int ad_dtruncate(struct adouble *, off_t); -extern int ad_rtruncate(struct adouble *, off_t); +extern int ad_rtruncate(struct adouble *, const char *, off_t); extern int copy_fork(int eid, struct adouble *add, struct adouble *ads); /* ad_size.c */ diff --git a/libatalk/adouble/ad_write.c b/libatalk/adouble/ad_write.c index a807c1de..5cd3742d 100644 --- a/libatalk/adouble/ad_write.c +++ b/libatalk/adouble/ad_write.c @@ -157,13 +157,13 @@ char c = 0; } /* ------------------------ */ -int ad_rtruncate( struct adouble *ad, const off_t size) +int ad_rtruncate(struct adouble *ad, const char *uname, const off_t size) { EC_INIT; #ifndef HAVE_EAFD if (ad->ad_vers == AD_VERSION_EA && size == 0) - EC_NEG1( unlink(ad->ad_ops->ad_path(ad->ad_name, 0)) ); + EC_NEG1( unlink(ad->ad_ops->ad_path(uname, 0)) ); else #endif EC_NEG1( sys_ftruncate(ad_reso_fileno(ad), size + ad->ad_eid[ ADEID_RFORK ].ade_off) ); @@ -173,7 +173,7 @@ EC_CLEANUP: ad->ad_rlen = size; else LOG(log_error, logtype_ad, "ad_rtruncate(\"%s\"): %s", - fullpathname(ad->ad_name), strerror(errno)); + fullpathname(uname), strerror(errno)); EC_EXIT; }