X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Fextattrs.c;h=3be452ed962c4c0eb1d9b34433ccc2510a5116cd;hb=b0bcb8f6b0571592a50ce039882c9319e012a270;hp=5a8bdad66b6eaf4e4035ffd7d037055aa6069dea;hpb=2964d3483041ae1abab1c9c560ae07c8eba0e7f0;p=netatalk.git diff --git a/etc/afpd/extattrs.c b/etc/afpd/extattrs.c index 5a8bdad6..3be452ed 100644 --- a/etc/afpd/extattrs.c +++ b/etc/afpd/extattrs.c @@ -1,5 +1,4 @@ /* - $Id: extattrs.c,v 1.27 2009-11-17 18:10:48 franklahm Exp $ Copyright (c) 2009 Frank Lahm This program is free software; you can redistribute it and/or modify @@ -28,8 +27,8 @@ #include #include #include +#include -#include "globals.h" #include "volume.h" #include "desktop.h" #include "directory.h" @@ -139,8 +138,8 @@ 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; /* + 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 @@ -150,10 +149,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->v_adouble, vol->v_ad_options); + 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?", @@ -163,16 +163,9 @@ 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); @@ -213,7 +206,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); @@ -239,8 +232,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_metadata(adp); return ret; }