summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/acl-internal.c7
-rw-r--r--lib/acl-internal.h6
-rw-r--r--lib/get-permissions.c6
-rw-r--r--lib/set-permissions.c12
4 files changed, 30 insertions, 1 deletions
diff --git a/lib/acl-internal.c b/lib/acl-internal.c
index 1a2f8c44bf..1eaa671bd3 100644
--- a/lib/acl-internal.c
+++ b/lib/acl-internal.c
@@ -115,6 +115,13 @@ acl_access_nontrivial (acl_t acl)
# endif
}
+int
+acl_default_nontrivial (acl_t acl)
+{
+ /* acl is non-trivial if it is non-empty. */
+ return (acl_entries (acl) > 0);
+}
+
# endif
#elif USE_ACL && HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
diff --git a/lib/acl-internal.h b/lib/acl-internal.h
index 4f042adc96..38a4ab2eb3 100644
--- a/lib/acl-internal.h
+++ b/lib/acl-internal.h
@@ -155,6 +155,12 @@ extern int acl_extended_nontrivial (acl_t);
Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.
Return -1 and set errno upon failure to determine it. */
extern int acl_access_nontrivial (acl_t);
+
+/* ACL is an ACL, from a file, stored as type ACL_TYPE_DEFAULT.
+ Return 1 if the given ACL is non-trivial.
+ Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.
+ Return -1 and set errno upon failure to determine it. */
+extern int acl_default_nontrivial (acl_t);
# endif
# elif HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
diff --git a/lib/get-permissions.c b/lib/get-permissions.c
index 6c6618df98..459513c925 100644
--- a/lib/get-permissions.c
+++ b/lib/get-permissions.c
@@ -60,6 +60,12 @@ get_permissions (const char *name, int desc, mode_t mode,
return -1;
}
+# if HAVE_ACL_TYPE_NFS4 /* FreeBSD */
+
+ /* TODO (see set_permissions). */
+
+# endif
+
# else /* HAVE_ACL_TYPE_EXTENDED */
/* Mac OS X */
diff --git a/lib/set-permissions.c b/lib/set-permissions.c
index 25c463d966..1aa5b4941c 100644
--- a/lib/set-permissions.c
+++ b/lib/set-permissions.c
@@ -530,7 +530,8 @@ set_acls (struct permission_context *ctx, const char *name, int desc,
*acls_set = true;
if (S_ISDIR(ctx->mode))
{
- if (! from_mode && ctx->default_acl)
+ if (! from_mode && ctx->default_acl &&
+ acl_default_nontrivial (ctx->default_acl))
ret = acl_set_file (name, ACL_TYPE_DEFAULT,
ctx->default_acl);
else
@@ -540,6 +541,15 @@ set_acls (struct permission_context *ctx, const char *name, int desc,
}
}
+# if HAVE_ACL_TYPE_NFS4 /* FreeBSD */
+
+ /* File systems either support POSIX ACLs (for example, ufs) or NFS4 ACLs
+ (for example, zfs). */
+
+ /* TODO: Implement setting ACLs once get_permissions() reads them. */
+
+# endif
+
# else /* HAVE_ACL_TYPE_EXTENDED */
/* Mac OS X */