]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix id handling in archive_acl_(from|to)_text* for NFSv4 ACLs
authorMartin Matuska <martin@matuska.org>
Mon, 9 Jan 2017 23:36:58 +0000 (00:36 +0100)
committerMartin Matuska <martin@matuska.org>
Mon, 9 Jan 2017 23:48:20 +0000 (00:48 +0100)
Always append id if ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID flag is set.
Try interpreting the name field as a numeric id.

This matches behavior of the "star" archiver.

libarchive/archive_acl.c

index b8e8ba40d2ec48e8b7d4bb3f399a4f73b0a44ab1..7c682095962a9f84603fd5135119e600b527b75a 100644 (file)
@@ -786,7 +786,8 @@ append_entry_w(wchar_t **wp, const wchar_t *prefix, int type,
                } else if (tag == ARCHIVE_ENTRY_ACL_USER
                    || tag == ARCHIVE_ENTRY_ACL_GROUP) {
                        append_id_w(wp, id);
-                       id = -1;
+                       if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) == 0)
+                               id = -1;
                }
                /* Solaris style has no second colon after other and mask */
                if (((flags & ARCHIVE_ENTRY_ACL_STYLE_SOLARIS) == 0)
@@ -1042,7 +1043,8 @@ append_entry(char **p, const char *prefix, int type,
                } else if (tag == ARCHIVE_ENTRY_ACL_USER
                    || tag == ARCHIVE_ENTRY_ACL_GROUP) {
                        append_id(p, id);
-                       id = -1;
+                       if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) == 0)
+                               id = -1;
                }
                /* Solaris style has no second colon after other and mask */
                if (((flags & ARCHIVE_ENTRY_ACL_STYLE_SOLARIS) == 0)
@@ -1328,6 +1330,7 @@ archive_acl_from_text_w(struct archive_acl *acl, const wchar_t *text,
                            tag == ARCHIVE_ENTRY_ACL_GROUP) {
                                n = 1;
                                name = field[1];
+                               isint_w(name.start, name.end, &id);
                        } else
                                n = 0;
 
@@ -1799,6 +1802,7 @@ archive_acl_from_text_l(struct archive_acl *acl, const char *text,
                            tag == ARCHIVE_ENTRY_ACL_GROUP) {
                                n = 1;
                                name = field[1];
+                               isint(name.start, name.end, &id);
                        } else
                                n = 0;