X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=blobdiff_plain;f=etc%2Fafpd%2Fdesktop.c;h=7a513b6a3cd760d9469364a6524546954c02c7e7;hp=8b6efd7e1bdac95dc73170d0ab6c0bdc4940b42c;hb=130bd309fce50f29e1fac305a0ba64b0b5a20cf3;hpb=5ecacc30626d9f4bfac435a7df79a0b54ae7742d diff --git a/etc/afpd/desktop.c b/etc/afpd/desktop.c index 8b6efd7e..7a513b6a 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