]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Add archive_entry_acl_types() to check ACL types in an entry's ACL
authorMartin Matuska <martin@matuska.org>
Wed, 23 Nov 2016 23:17:17 +0000 (00:17 +0100)
committerMartin Matuska <martin@matuska.org>
Wed, 23 Nov 2016 23:36:02 +0000 (00:36 +0100)
libarchive/archive_entry.c
libarchive/archive_entry.h
libarchive/archive_entry_acl.3

index 4ac19660893881eb21024909539254f8f47ddf20..88ce3976d99540455b01a3969fd58ca625301219 100644 (file)
@@ -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".
  */
index 71b1e87e8d57adc8b28a040004ef1bbfb4ee5159..b6a5d89c5d6fa721708c73594e394fb2463fbf0a 100644 (file)
@@ -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 */);
 
index 5aff996823520f00d554e16589a6525e6cf6f6b6..e85c4ded162781e701e13d2fa16b64f1a2d6271a 100644 (file)
@@ -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 ,