return ret;
}
+/********************************************************************
+ * ACL funcs interfacing with other parts
+ ********************************************************************/
+
/*!
* map ACL to user maccess
*
EC_CLEANUP:
EC_EXIT;
}
+
+/*!
+ * Check whether a volume supports ACLs
+ *
+ * @param vol (r) volume
+ *
+ * @returns 0 if not, 1 if yes
+ */
+int check_vol_acl_support(const struct vol *vol)
+{
+ int ret = 1;
+
+#ifdef HAVE_SOLARIS_ACLS
+ ace_t *aces = NULL;
+ if (get_nfsv4_acl(vol->v_path, &aces) == -1)
+ ret = 0;
+#endif
+#ifdef HAVE_POSIX_ACLS
+ acl_t acl = NULL;
+ if ((acl = acl_get_file(vol->v_path, ACL_TYPE_ACCESS)) == NULL)
+ ret = 0;
+#endif
+
+#ifdef HAVE_SOLARIS_ACLS
+ if (aces) free(aces);
+#endif
+#ifdef HAVE_POSIX_ACLS
+ if (acl) acl_free(acl);
+#endif /* HAVE_POSIX_ACLS */
+
+ LOG(log_debug, logtype_afpd, "Volume \"%s\" ACL support: %s",
+ vol->v_path, ret ? "yes" : "no");
+ return ret;
+}
/* Misc funcs */
extern int acltoownermode(char *path, struct stat *st,uid_t uid, struct maccess *ma);
+extern int check_vol_acl_support(const struct vol *vol);
#endif
#include "mangle.h"
#include "fork.h"
#include "hash.h"
+#include "acls.h"
extern int afprun(int root, char *cmd, int *outfd);
volume->v_vid = ++lastvid;
volume->v_vid = htons(volume->v_vid);
#ifdef HAVE_ACLS
- volume->v_flags |= AFPVOL_ACLS;
+ if (check_vol_acl_support(volume))
+ volume->v_flags |= AFPVOL_ACLS;
#endif
/* handle options */