X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Fextattrs.c;h=649cc6a30f3044b96533412751f850acee8a10be;hb=4054f4b3c85ecab060dafd46c0d3632cadbb5803;hp=1e415c9341bfdefdfb864b60d2a8a8bb430b973d;hpb=c3a8052701ca317ac07d2b71f0a2a2fe8083e242;p=netatalk.git diff --git a/etc/afpd/extattrs.c b/etc/afpd/extattrs.c index 1e415c93..649cc6a3 100644 --- a/etc/afpd/extattrs.c +++ b/etc/afpd/extattrs.c @@ -1,5 +1,5 @@ /* - $Id: extattrs.c,v 1.25 2009-11-13 13:47:54 didg Exp $ + $Id: extattrs.c,v 1.29 2010-01-05 12:06:33 franklahm Exp $ Copyright (c) 2009 Frank Lahm This program is free software; you can redistribute it and/or modify @@ -140,7 +140,8 @@ int afp_listextattr(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf, } adp = of_ad(vol, s_path, &ad); - uname = s_path->u_name; /* + uname = s_path->u_name; + /* We have to check the FinderInfo for the file, because if they aren't all 0 we must return the synthetic attribute "com.apple.FinderInfo". Note: the client will never (never seen in traces) request that attribute @@ -188,9 +189,9 @@ int afp_listextattr(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf, } /* Now check for Ressource fork and add virtual EA "com.apple.ResourceFork" if size > 0 */ - LOG(log_debug7, logtype_afpd, "afp_listextattr(%s): Ressourcefork size: %u", uname, adp->ad_eid[ADEID_RFORK].ade_len); + LOG(log_debug7, logtype_afpd, "afp_listextattr(%s): Ressourcefork size: %llu", uname, adp->ad_rlen); - if (adp->ad_eid[ADEID_RFORK].ade_len > 0) { + if (adp->ad_rlen > 0) { LOG(log_debug7, logtype_afpd, "afp_listextattr(%s): sending com.apple.RessourceFork.", uname); strcpy(attrnamebuf + attrbuflen, ea_resourcefork); attrbuflen += strlen(ea_resourcefork) + 1; @@ -249,12 +250,12 @@ static char *to_stringz(char *ibuf, uint16_t len) { static char attrmname[256]; - if (len > 256) + if (len > 255) /* dont fool with us */ - len = 256; + len = 255; /* we must copy the name as its not 0-terminated and I DONT WANT TO WRITE to ibuf */ - strlcpy(attrmname, ibuf, len); + strlcpy(attrmname, ibuf, len + 1); return attrmname; }