From: srittau Date: Fri, 4 Oct 2002 23:51:22 +0000 (+0000) Subject: mtoupath: Patch by Hans-Peter Jansen: X-Git-Tag: root-netatalk-1-6~9 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=commitdiff_plain;h=a3ebec1959c8cc4d47c112d2e17da65771928f64 mtoupath: Patch by Hans-Peter Jansen: When conversion of a character fails, the character is hex-encoded. Debug output. --- diff --git a/etc/afpd/desktop.c b/etc/afpd/desktop.c index ba800ddc..65aaa7cc 100644 --- a/etc/afpd/desktop.c +++ b/etc/afpd/desktop.c @@ -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 */ +#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 ); }