/*
- $Id: extattrs.c,v 1.28 2009-11-27 12:37:24 didg Exp $
Copyright (c) 2009 Frank Lahm <franklahm@gmail.com>
This program is free software; you can redistribute it and/or modify
#include <atalk/afp.h>
#include <atalk/logger.h>
#include <atalk/ea.h>
+#include <atalk/globals.h>
+#include <atalk/netatalk_conf.h>
-#include "globals.h"
#include "volume.h"
#include "desktop.h"
#include "directory.h"
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
if (S_ISDIR(st->st_mode))
adflags = ADFLAGS_DIR;
- if ( ad_metadata( uname, vol_noadouble(vol) | 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?",
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);
default:
buf_valid = 1;
}
- }
+ } /* if ((maxreply == 0) || (buf_valid == 0)) */
/* Start building reply packet */
bitmap = htons(bitmap);
exit:
if (ret != AFP_OK)
buf_valid = 0;
+
if (adp)
- ad_close_metadata( adp);
+ ad_close(adp, ADFLAGS_HF);
return ret;
}