X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Fextattrs.c;h=f6b1cf66178a585c5475aa9f781c8e21ea939612;hb=15da22106694bff9f2fc58da86f0554abb810837;hp=40298b50737ccfa62000ac1469c2e4749a4ef511;hpb=f1c0e462cdfe8d19a14bb4e296ed005e3f14bd56;p=netatalk.git diff --git a/etc/afpd/extattrs.c b/etc/afpd/extattrs.c index 40298b50..f6b1cf66 100644 --- a/etc/afpd/extattrs.c +++ b/etc/afpd/extattrs.c @@ -1,5 +1,4 @@ /* - $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 @@ -29,6 +28,7 @@ #include #include #include +#include #include "volume.h" #include "desktop.h" @@ -139,7 +139,6 @@ int afp_listextattr(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf, return( AFPERR_NOOBJ ); } - adp = of_ad(vol, s_path, &ad); uname = s_path->u_name; /* We have to check the FinderInfo for the file, because if they aren't all 0 @@ -151,10 +150,11 @@ int afp_listextattr(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf, if (S_ISDIR(st->st_mode)) adflags = ADFLAGS_DIR; - if ( ad_metadata( uname, adflags, adp) < 0 ) { + adp = &ad; + ad_init(adp, vol); + if (ad_metadata(uname, adflags, adp) != 0 ) { switch (errno) { case ENOENT: - adp = NULL; break; case EACCES: LOG(log_error, logtype_afpd, "afp_listextattr(%s): %s: check resource fork permission?", @@ -164,22 +164,8 @@ int afp_listextattr(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf, LOG(log_error, logtype_afpd, "afp_listextattr(%s): error getting metadata: %s", uname, strerror(errno)); return AFPERR_MISC; } - } - - if (adp) { + } else { FinderInfo = ad_entry(adp, ADEID_FINDERI); - -#ifdef DEBUG - LOG(log_maxdebug, logtype_afpd, "afp_listextattr(%s): FinderInfo:", uname); - hexdump( FinderInfo, 32); -#endif - - if ((adflags & ADFLAGS_DIR)) { - /* set default view */ - uint16 = htons(FINDERINFO_CLOSEDVIEW); - memcpy(emptyFinderInfo + FINDERINFO_FRVIEWOFF, &uint16, 2); - } - /* Check if FinderInfo equals default and empty FinderInfo*/ if (memcmp(FinderInfo, emptyFinderInfo, 32) != 0) { /* FinderInfo contains some non 0 bytes -> include "com.apple.FinderInfo" */ @@ -214,7 +200,7 @@ int afp_listextattr(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf, default: buf_valid = 1; } - } + } /* if ((maxreply == 0) || (buf_valid == 0)) */ /* Start building reply packet */ bitmap = htons(bitmap); @@ -240,8 +226,9 @@ int afp_listextattr(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf, exit: if (ret != AFP_OK) buf_valid = 0; + if (adp) - ad_close_metadata( adp); + ad_close(adp, ADFLAGS_HF); return ret; }