From: Martin Matuska Date: Wed, 23 Nov 2016 23:17:17 +0000 (+0100) Subject: Add archive_entry_acl_types() to check ACL types in an entry's ACL X-Git-Tag: v3.3.0~113 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=412c186d1498378969b160c6dbbfcc3956570879;p=thirdparty%2Flibarchive.git Add archive_entry_acl_types() to check ACL types in an entry's ACL --- diff --git a/libarchive/archive_entry.c b/libarchive/archive_entry.c index 4ac196608..88ce3976d 100644 --- a/libarchive/archive_entry.c +++ b/libarchive/archive_entry.c @@ -1441,6 +1441,15 @@ archive_entry_acl_add_entry_w(struct archive_entry *entry, type, permset, tag, id, name, wcslen(name)); } +/* + * Return a bitmask of ACL types in an archive entry ACL list + */ +int +archive_entry_acl_types(struct archive_entry *entry) +{ + return ((&entry->acl)->acl_types); +} + /* * Return a count of entries matching "want_type". */ diff --git a/libarchive/archive_entry.h b/libarchive/archive_entry.h index 71b1e87e8..b6a5d89c5 100644 --- a/libarchive/archive_entry.h +++ b/libarchive/archive_entry.h @@ -508,6 +508,9 @@ __LA_DECL const wchar_t *archive_entry_acl_text_w(struct archive_entry *, __LA_DECL const char *archive_entry_acl_text(struct archive_entry *, int /* flags */); +/* Return bitmask of ACL types in an archive entry */ +__LA_DECL int archive_entry_acl_types(struct archive_entry *); + /* Return a count of entries matching 'want_type' */ __LA_DECL int archive_entry_acl_count(struct archive_entry *, int /* want_type */); diff --git a/libarchive/archive_entry_acl.3 b/libarchive/archive_entry_acl.3 index 5aff99682..e85c4ded1 100644 --- a/libarchive/archive_entry_acl.3 +++ b/libarchive/archive_entry_acl.3 @@ -33,7 +33,8 @@ .Nm archive_entry_acl_next , .Nm archive_entry_acl_next_w , .Nm archive_entry_acl_reset , -.Nm archive_entry_acl_text_w +.Nm archive_entry_acl_text_w , +.Nm archive_entry_acl_types .Nd functions for manipulating Access Control Lists in archive entry descriptions .Sh LIBRARY Streaming Archive Library (libarchive, -larchive) @@ -85,6 +86,8 @@ Streaming Archive Library (libarchive, -larchive) .Fn archive_entry_acl_reset "struct archive_entry *a" "int type" .Ft const wchar_t * .Fn archive_entry_acl_text_w "struct archive_entry *a" "int flags" +.Ft int +.Fn archive_entry_acl_types "struct archive_entry *a" .\" enum? .Sh DESCRIPTION An @@ -192,6 +195,11 @@ The returned long string is valid until the next call to .Fn archive_entry_acl_add_entry_w or .Fn archive_entry_acl_text_w . +.Pp +.Fn archive_entry_acl_types +get ACL entry types contained in an archive entry's ACL. As POSIX.1e and NFSv4 +ACL entries cannot be mixed, this function is a very efficient way to detect if +an ACL already contains POSIX.1e or NFSv4 ACL entries. .Sh RETURN VALUES .Fn archive_entry_acl_count and @@ -225,6 +233,9 @@ The returned long string is valid until the next call to .Fn archive_entry_acl_add_entry_w or .Fn archive_entry_acl_text_w . +.Pp +.Fn archive_entry_acl_types +returns a bitmask of ACL entry types or 0 if archive entry has no ACL entries. .Sh SEE ALSO .Xr archive_entry 3 .Xr libarchive 3 ,