]> arthur.barton.de Git - netatalk.git/commitdiff
mtoupath: Patch by Hans-Peter Jansen:
authorsrittau <srittau>
Fri, 4 Oct 2002 23:51:22 +0000 (23:51 +0000)
committersrittau <srittau>
Fri, 4 Oct 2002 23:51:22 +0000 (23:51 +0000)
When conversion of a character fails, the character is hex-encoded.

Debug output.

etc/afpd/desktop.c

index ba800ddcc74ee7953f54bcdca5d0a3a464939e6f..65aaa7cc5bdfe7bc0f1fb93c8071c6d29d8ac80a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: desktop.c,v 1.16 2002-09-09 01:21:59 didg Exp $
+ * $Id: desktop.c,v 1.17 2002-10-04 23:51:22 srittau Exp $
  *
  * See COPYRIGHT.
  */
@@ -633,6 +633,17 @@ char *mtoupath(const struct vol *vol, char *mpath)
         if (vol->v_mtoupage && ((*m & 0x80) ||
                                 vol->v_flags & AFPVOL_MAPASCII)) {
             *u = vol->v_mtoupage->map[(unsigned char) *m].value;
+            if (!*u && *m) {
+                /* if conversion failed, encode in hex
+                 * to prevent silly truncation
+                 * H.P. Jansen <hpj@urpla.net> */
+#ifdef DEBUG
+                LOG(log_debug, logtype_afpd, "mtoupath: hex encode: 0x%x", (unsigned char) *m);
+#endif /* DEBUG */
+                *u++ = ':';
+                *u++ = hexdig[ ( *m & 0xf0 ) >> 4 ];
+                *u = hexdig[ *m & 0x0f ];
+            }
         } else
 #endif /* 1 */
 #if AD_VERSION == AD_VERSION1
@@ -658,6 +669,10 @@ char *mtoupath(const struct vol *vol, char *mpath)
     }
     *u = '\0';
 
+#ifdef DEBUG
+    LOG(log_debug, logtype_afpd, "mtoupath: '%s':'%s'", mpath, upath);
+#endif /* DEBUG */
+
     return( upath );
 }
 
@@ -706,6 +721,10 @@ char *utompath(const struct vol *vol, char *upath)
     strcpy(mpath,mangle(vol, mpath));
 #endif /* FILE_MANGLING */
 
+#ifdef DEBUG
+    LOG(log_debug, logtype_afpd, "utompath: '%s':'%s'", upath, mpath);
+#endif /* DEBUG */
+
     return( mpath );
 }