]> arthur.barton.de Git - netatalk.git/commitdiff
Fix an issue with filenames containing non-ASCII characters
authorFrank Lahm <franklahm@googlemail.com>
Sat, 6 Apr 2013 15:08:37 +0000 (17:08 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Sat, 6 Apr 2013 15:08:37 +0000 (17:08 +0200)
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.

NEWS
etc/afpd/fork.c
include/atalk/adouble.h
libatalk/adouble/ad_write.c

diff --git a/NEWS b/NEWS
index 5d6ff9cf8240f415c9d3abb4560c2ff40baed9ec..65c6c1e0001e8a8f825eb775383ed6251f6d3481 100644 (file)
--- 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
 ================
index 0d050b3259e30f8a5e818cdcfc972210f1f9a688..0c988828d609660bc096c8cf01c944f6f8e633dc 100644 (file)
@@ -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)
index de0598b5a9f2b279eedb71dd01cc24700d20a495..b0d803b2218f1bcaa1be1ecc281b91298fb952ed 100644 (file)
@@ -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 */
index a807c1de748e7ae0da06f93f9643654cee0dbbac..5cd3742d69f9890f3fa01a5148fc23fda7ae1e6f 100644 (file)
@@ -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;
 }