X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=blobdiff_plain;f=etc%2Fafpd%2Fdesktop.c;h=da39e9b124e4df74be91592d3c0a81a35221e5f1;hp=8446a848b26baed169f915f280ef4f88e3b97b5d;hb=9480b301ae3cd89122e7100f0ae052f3d6eaabf8;hpb=b362b6f7b22b6e4e9e74760989f389149677917b diff --git a/etc/afpd/desktop.c b/etc/afpd/desktop.c index 8446a848..da39e9b1 100644 --- a/etc/afpd/desktop.c +++ b/etc/afpd/desktop.c @@ -39,6 +39,20 @@ #include "mangle.h" +typedef struct _U2MMAP { + char *mname; + char *uname; +} U2MMAP; + +U2MMAP u2mmap[] = { + { "Network Trash Folder", ".AppleTrash" }, + { "Temporary Items", ".AppleTemp" }, + { "TheVolumeSettingsFolder", ".AppleVolumeSettings" }, + { "TheFindByContentFolder", ".AppleFindByContent" }, + { 0L, 0L } /* end of list */ +}; + + int afp_opendt(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbuflen) { struct vol *vol; @@ -598,6 +612,7 @@ char *mtoupath(const struct vol *vol, char *mpath, cnid_t did, int utf8) size_t inplen; size_t outlen; u_int16_t flags; + U2MMAP *u2m; if ( *mpath == '\0' ) { strcpy(upath, "."); @@ -615,6 +630,14 @@ char *mtoupath(const struct vol *vol, char *mpath, cnid_t did, int utf8) m = mpath; u = upath; + u2m = u2mmap; + while(u2m->mname) { + if (strcmp(m, u2m->mname) == 0) { + m = u2m->uname; + } + u2m++; + } + inplen = strlen(m); outlen = MAXPATHLEN; @@ -638,6 +661,7 @@ char *utompath(const struct vol *vol, char *upath, cnid_t id, int utf8) char *m, *u; u_int16_t flags; size_t outlen; + U2MMAP *u2m; m = mpath; outlen = strlen(upath); @@ -651,12 +675,21 @@ char *utompath(const struct vol *vol, char *upath, cnid_t id, int utf8) LOG(log_error, logtype_afpd, "Conversion from %s to %s for %s (%u) failed.", vol->v_volcodepage, vol->v_maccodepage, u, ntohl(id)); goto utompath_error; } + mpath[outlen] = 0; flags = !!(flags & CONV_REQMANGLE); if (utf8) flags |= 2; + u2m = u2mmap; + while(u2m->mname) { + if (strcmp(mpath, u2m->uname) == 0) { + strcpy(mpath, u2m->mname); + } + u2m++; + } + m = mangle(vol, mpath, outlen, upath, id, flags); #ifdef DEBUG