X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Fvolume.c;h=81981e01c6604a3d219459f88cad896491f94f62;hb=b51fd284f832491044798e610263a5c622d02d1f;hp=f9e0b2257b4e008bb1a49898f67c6aa021e0899f;hpb=123f72768fc8f3991cdd99bb82518e6464273423;p=netatalk.git diff --git a/etc/afpd/volume.c b/etc/afpd/volume.c index f9e0b225..81981e01 100644 --- a/etc/afpd/volume.c +++ b/etc/afpd/volume.c @@ -1,5 +1,5 @@ /* - * $Id: volume.c,v 1.99 2009-11-06 04:28:25 didg Exp $ + * $Id: volume.c,v 1.102 2009-11-13 00:27:36 didg Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -770,7 +770,32 @@ static int creatvol(AFPObj *obj, struct passwd *pwd, else volume->v_adouble = AD_VERSION; + /* Mac to Unix conversion flags*/ + volume->v_mtou_flags = 0; + if (!(volume->v_flags & AFPVOL_NOHEX)) + volume->v_mtou_flags |= CONV_ESCAPEHEX; + if (!(volume->v_flags & AFPVOL_USEDOTS)) + volume->v_mtou_flags |= CONV_ESCAPEDOTS; + if ((volume->v_flags & AFPVOL_EILSEQ)) + volume->v_mtou_flags |= CONV__EILSEQ; + + if ((volume->v_casefold & AFPVOL_MTOUUPPER)) + volume->v_mtou_flags |= CONV_TOUPPER; + else if ((volume->v_casefold & AFPVOL_MTOULOWER)) + volume->v_mtou_flags |= CONV_TOLOWER; + + /* Unix to Mac conversion flags*/ + volume->v_utom_flags = CONV_IGNORE | CONV_UNESCAPEHEX; + if ((volume->v_casefold & AFPVOL_UTOMUPPER)) + volume->v_utom_flags |= CONV_TOUPPER; + else if ((volume->v_casefold & AFPVOL_UTOMLOWER)) + volume->v_utom_flags |= CONV_TOLOWER; + + if ((volume->v_flags & AFPVOL_EILSEQ)) + volume->v_utom_flags |= CONV__EILSEQ; + initvol_vfs(volume); + #ifdef FORCE_UIDGID if (options[VOLOPT_FORCEUID].c_value) { volume->v_forceuid = strdup(options[VOLOPT_FORCEUID].c_value); @@ -1786,7 +1811,8 @@ int afp_openvol(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t char *vol_uname; char *vol_mname; char *volname_tmp; - + struct charset_functions *charset; + ibuf += 2; memcpy(&bitmap, ibuf, sizeof( bitmap )); bitmap = ntohs( bitmap ); @@ -1924,6 +1950,7 @@ int afp_openvol(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t dir->d_color = DIRTREE_COLOR_BLACK; /* root node is black */ dir->d_m_name_ucs2 = strdup_w(volume->v_name); volume->v_dir = volume->v_root = dir; + volume->v_curdir = NULL; volume->v_hash = dirhash(); curdir = volume->v_dir; @@ -1953,7 +1980,7 @@ int afp_openvol(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t goto openvol_err; } - if ( NULL == ( volume->v_vol = find_charset_functions(volume->v_volcodepage)) || volume->v_vol->flags & CHARSET_ICONV ) { + if ( NULL == (charset = find_charset_functions(volume->v_volcodepage)) || charset->flags & CHARSET_ICONV ) { LOG (log_warning, logtype_afpd, "WARNING: volume encoding %s is *not* supported by netatalk, expect problems !!!!", volume->v_volcodepage); } @@ -1966,11 +1993,12 @@ int afp_openvol(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t goto openvol_err; } - if ( NULL == ( volume->v_mac = find_charset_functions(volume->v_maccodepage)) || ! (volume->v_mac->flags & CHARSET_CLIENT) ) { + if ( NULL == ( charset = find_charset_functions(volume->v_maccodepage)) || ! (charset->flags & CHARSET_CLIENT) ) { LOG (log_error, logtype_afpd, "Fatal error: mac charset %s not supported", volume->v_maccodepage); ret = AFPERR_MISC; goto openvol_err; - } + } + volume->v_kTextEncoding = htonl(charset->kTextEncoding); ret = stat_vol(bitmap, volume, rbuf, rbuflen); if (ret == AFP_OK) {