#ifdef HAVE_SOLARIS_ACLS
#include <sys/acl.h>
#endif
+#ifdef HAVE_FREEBSD_SUNACL
+#include <sunacl.h>
+#endif
#ifdef HAVE_POSIX_ACLS
#include <sys/acl.h>
#endif
* Solaris funcs
********************************************************/
-#ifdef HAVE_SOLARIS_ACLS
+#ifdef HAVE_NFSV4_ACLS
/*!
* Compile access rights for a user to one file-system object
free(name);
EC_EXIT;
}
-#endif /* HAVE_SOLARIS_ACLS */
+#endif /* HAVE_NFSV4_ACLS */
/********************************************************
* POSIX 1e funcs
switch (type & MAP_MASK) {
-#ifdef HAVE_SOLARIS_ACLS
+#ifdef HAVE_NFSV4_ACLS
case SOLARIS_2_DARWIN:
mapped_aces = map_aces_solaris_to_darwin( acl, buf, ace_count);
break;
case DARWIN_2_SOLARIS:
mapped_aces = map_aces_darwin_to_solaris( buf, acl, ace_count);
break;
-#endif /* HAVE_SOLARIS_ACLS */
+#endif /* HAVE_NFSV4_ACLS */
#ifdef HAVE_POSIX_ACLS
case POSIX_DEFAULT_2_DARWIN:
int mapped_aces = 0;
int dirflag;
char *darwin_ace_count = rbuf;
-#ifdef HAVE_SOLARIS_ACLS
+#ifdef HAVE_NFSV4_ACLS
int ace_count = 0;
ace_t *aces = NULL;
#endif
*rbuf = 0;
rbuf += 4;
-#ifdef HAVE_SOLARIS_ACLS
+#ifdef HAVE_NFSV4_ACLS
EC_NEG1(ace_count = get_nfsv4_acl(name, &aces));
EC_NEG1(mapped_aces = map_acl(SOLARIS_2_DARWIN, aces, (darwin_ace_t *)rbuf, ace_count));
-#endif /* HAVE_SOLARIS_ACLS */
+#endif /* HAVE_NFSV4_ACLS */
#ifdef HAVE_POSIX_ACLS
acl_t defacl = NULL , accacl = NULL;
EC_STATUS(0);
EC_CLEANUP:
-#ifdef HAVE_SOLARIS_ACLS
+#ifdef HAVE_NFSV4_ACLS
if (aces) free(aces);
#endif
#ifdef HAVE_POSIX_ACLS
{
int ret = AFP_OK;
-#if (defined HAVE_SOLARIS_ACLS || defined HAVE_POSIX_ACLS)
+#if (defined HAVE_NFSV4_ACLS || defined HAVE_POSIX_ACLS)
/* Ressource etc. first */
if ((ret = vol->vfs->vfs_remove_acl(vol, path, dir)) != AFP_OK)
return ret;
We will store inherited ACEs first, which is Darwins canonical order.
- returns AFPerror code
*/
-#ifdef HAVE_SOLARIS_ACLS
+#ifdef HAVE_NFSV4_ACLS
static int set_acl(const struct vol *vol,
char *name,
int inherit,
if ((ret = (vol->vfs->vfs_acl(vol, name, ACE_SETACL, new_aces_count, new_aces))) != 0) {
LOG(log_debug, logtype_afpd, "set_acl: error setting acl: %s", strerror(errno));
switch (errno) {
- case EACCES:
- case EPERM:
- EC_STATUS(AFPERR_ACCESS);
- break;
case ENOENT:
- EC_STATUS(AFP_OK);
break;
+ case EACCES:
+ case EPERM:
+ EC_EXIT_STATUS(AFPERR_ACCESS);
default:
- EC_STATUS(AFPERR_MISC);
- break;
+ EC_EXIT_STATUS(AFPERR_MISC);
}
- goto EC_CLEANUP;
}
+
if ((ret = (acl(name, ACE_SETACL, new_aces_count, new_aces))) != 0) {
LOG(log_error, logtype_afpd, "set_acl: error setting acl: %s", strerror(errno));
- if (errno == (EACCES | EPERM))
- EC_STATUS(AFPERR_ACCESS);
- else if (errno == ENOENT)
- EC_STATUS(AFPERR_NOITEM);
- else
- EC_STATUS(AFPERR_MISC);
- goto EC_CLEANUP;
+ switch (errno) {
+ case EACCES:
+ case EPERM:
+ EC_EXIT_STATUS(AFPERR_ACCESS);
+ case ENOENT:
+ EC_EXIT_STATUS(AFPERR_NOITEM);
+ default:
+ EC_EXIT_STATUS(AFPERR_MISC);
+ }
}
EC_STATUS(AFP_OK);
LOG(log_debug9, logtype_afpd, "set_acl: END");
EC_EXIT;
}
-#endif /* HAVE_SOLARIS_ACLS */
+#endif /* HAVE_NFSV4_ACLS */
#ifdef HAVE_POSIX_ACLS
#ifndef HAVE_ACL_FROM_MODE
allowed_rights = curdir->d_rights_cache;
LOG(log_debug, logtype_afpd, "check_access: allowed rights from dircache: 0x%08x", allowed_rights);
} else {
-#ifdef HAVE_SOLARIS_ACLS
+#ifdef HAVE_NFSV4_ACLS
EC_ZERO_LOG(solaris_acl_rights(obj, path, &st, NULL, &allowed_rights));
#endif
#ifdef HAVE_POSIX_ACLS
LOG(log_debug, logtype_afpd,"parent: %s", cfrombstr(parent));
EC_ZERO_LOG_ERR(lstat(cfrombstr(parent), &st), AFPERR_MISC);
-#ifdef HAVE_SOLARIS_ACLS
+#ifdef HAVE_NFSV4_ACLS
EC_ZERO_LOG(solaris_acl_rights(obj, cfrombstr(parent), &st, NULL, &parent_rights));
#endif
#ifdef HAVE_POSIX_ACLS
LOG(log_maxdebug, logtype_afpd, "acltoownermode(\"%s/%s\", 0x%02x)",
getcwdpath(), path, ma->ma_user);
-#ifdef HAVE_SOLARIS_ACLS
+#ifdef HAVE_NFSV4_ACLS
EC_ZERO_LOG(solaris_acl_rights(obj, path, st, ma, NULL));
#endif