summaryrefslogtreecommitdiffstats
path: root/lib/libc/posix1e/acl_get.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/posix1e/acl_get.c')
-rw-r--r--lib/libc/posix1e/acl_get.c45
1 files changed, 32 insertions, 13 deletions
diff --git a/lib/libc/posix1e/acl_get.c b/lib/libc/posix1e/acl_get.c
index 6c98fe9..e8807c4 100644
--- a/lib/libc/posix1e/acl_get.c
+++ b/lib/libc/posix1e/acl_get.c
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "acl_support.h"
@@ -69,6 +70,9 @@ acl_get_file(const char *path_p, acl_type_t type)
return (NULL);
}
+ aclp->ats_acl.acl_maxcnt = ACL_MAX_ENTRIES;
+ _acl_brand_from_type(aclp, type);
+
return (aclp);
}
@@ -89,26 +93,19 @@ acl_get_link_np(const char *path_p, acl_type_t type)
return (NULL);
}
+ aclp->ats_acl.acl_maxcnt = ACL_MAX_ENTRIES;
+ _acl_brand_from_type(aclp, type);
+
return (aclp);
}
acl_t
acl_get_fd(int fd)
{
- acl_t aclp;
- int error;
-
- aclp = acl_init(ACL_MAX_ENTRIES);
- if (aclp == NULL)
- return (NULL);
+ if (fpathconf(fd, _PC_ACL_NFS4))
+ return (acl_get_fd_np(fd, ACL_TYPE_NFS4));
- error = ___acl_get_fd(fd, ACL_TYPE_ACCESS, &aclp->ats_acl);
- if (error) {
- acl_free(aclp);
- return (NULL);
- }
-
- return (aclp);
+ return (acl_get_fd_np(fd, ACL_TYPE_ACCESS));
}
acl_t
@@ -128,6 +125,9 @@ acl_get_fd_np(int fd, acl_type_t type)
return (NULL);
}
+ aclp->ats_acl.acl_maxcnt = ACL_MAX_ENTRIES;
+ _acl_brand_from_type(aclp, type);
+
return (aclp);
}
@@ -218,3 +218,22 @@ acl_get_tag_type(acl_entry_t entry_d, acl_tag_t *tag_type_p)
return (0);
}
+
+int
+acl_get_entry_type_np(acl_entry_t entry_d, acl_entry_type_t *entry_type_p)
+{
+
+ if (entry_d == NULL || entry_type_p == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (!_entry_brand_may_be(entry_d, ACL_BRAND_NFS4)) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ *entry_type_p = entry_d->ae_entry_type;
+
+ return (0);
+}
OpenPOWER on IntegriCloud