EC_CLEANUP:
EC_EXIT;
}
-
-/*
- We're being called at the end of afp_createdir. We're (hopefully) inside dir
- and ".AppleDouble" and ".AppleDouble/.Parent" should have already been created.
- We then inherit any explicit ACE from "." to ".AppleDouble" and ".AppleDouble/.Parent".
- FIXME: add to VFS layer ?
-*/
-int createdir_inherit_acl(const struct vol *vol)
-{
- EC_INIT;
-#ifdef HAVE_SOLARIS_ACLS
- ace_t *diraces = NULL, *adaces = NULL, *combinedaces = NULL;
- int diracecount, adacecount;
-#endif
-#ifdef HAVE_POSIX_ACLS
- acl_t def_acl = NULL;
- acl_t acc_acl = NULL;
-#endif
- LOG(log_debug9, logtype_afpd, "addir_inherit_acl: BEGIN");
-
- /* Check if ACLs are enabled for the volume */
- if (vol->v_flags & AFPVOL_ACLS) {
-#ifdef HAVE_SOLARIS_ACLS
- /* Get directory ACL */
- EC_NEG1_LOG(diracecount = get_nfsv4_acl(".", &diraces));
- EC_NEG1_LOG(diracecount = strip_trivial_aces(&diraces, diracecount));
-
- /* Inherit to .AppleDouble directory */
- EC_NEG1_LOG(adacecount = get_nfsv4_acl(".AppleDouble", &adaces));
- EC_NEG1_LOG(adacecount = strip_nontrivial_aces(&adaces, adacecount));
- EC_NULL_LOG(combinedaces = concat_aces(diraces, diracecount, adaces, adacecount));
- EC_ZERO_LOG(acl(".AppleDouble", ACE_SETACL, diracecount + adacecount, combinedaces));
- free(adaces);
- adaces = NULL;
- free(combinedaces);
- combinedaces = NULL;
-
- /* Inherit to ".AppleDouble/.Parent" */
- EC_NEG1_LOG(adacecount = get_nfsv4_acl(".AppleDouble/.Parent", &adaces));
- EC_NEG1_LOG(adacecount = strip_nontrivial_aces(&adaces, adacecount));
- EC_NULL_LOG(combinedaces = concat_aces(diraces, diracecount, adaces, adacecount));
- EC_ZERO_LOG(acl(".AppleDouble/.Parent",
- ACE_SETACL,
- diracecount + adacecount,
- combinedaces));
-#endif
-#ifdef HAVE_POSIX_ACLS
-#endif
- }
-
- LOG(log_debug9, logtype_afpd, "addir_inherit_acl: END");
-
-EC_CLEANUP:
-#ifdef HAVE_SOLARIS_ACLS
- if (diraces) free(diraces);
- if (adaces) free(adaces);
- if (combinedaces) free(combinedaces);
-#endif
-#ifdef HAVE_POSIX_ACLS
- acl_free(acc_acl);
- acl_free(def_acl);
-#endif
- EC_EXIT;
-}
-