summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2004-04-06 23:08:31 +0000
committerkientzle <kientzle@FreeBSD.org>2004-04-06 23:08:31 +0000
commita356af4fc799bfdc962b4e80af259fed267f5015 (patch)
tree2e6a6dbc7b0386d20d14ad18d24897719c8cb8b7
parent361a4ffcb75f1a067cea29dde079fd33e39a3a43 (diff)
downloadFreeBSD-src-a356af4fc799bfdc962b4e80af259fed267f5015.zip
FreeBSD-src-a356af4fc799bfdc962b4e80af259fed267f5015.tar.gz
Archive both access and default ACLs.
-rw-r--r--usr.bin/tar/write.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c
index 4ad1509..6455a20 100644
--- a/usr.bin/tar/write.c
+++ b/usr.bin/tar/write.c
@@ -796,10 +796,27 @@ record_hardlink(struct bsdtar *bsdtar, struct archive_entry *entry,
}
#ifdef HAVE_POSIX_ACL
+void setup_acl(struct bsdtar *bsdtar,
+ struct archive_entry *entry, const char *accpath,
+ int acl_type, int archive_entry_acl_type);
+
void
setup_acls(struct bsdtar *bsdtar, struct archive_entry *entry,
const char *accpath)
{
+ archive_entry_acl_clear(entry);
+
+ setup_acl(bsdtar, entry, accpath,
+ ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
+ /* XXX Don't bother with default for non-directories. XXX */
+ setup_acl(bsdtar, entry, accpath,
+ ACL_TYPE_DEFAULT, ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
+}
+
+void
+setup_acl(struct bsdtar *bsdtar, struct archive_entry *entry,
+ const char *accpath, int acl_type, int archive_entry_acl_type)
+{
acl_t acl;
acl_tag_t acl_tag;
acl_entry_t acl_entry;
@@ -807,10 +824,8 @@ setup_acls(struct bsdtar *bsdtar, struct archive_entry *entry,
int s, ae_id, ae_tag, ae_perm;
const char *ae_name;
- archive_entry_acl_clear(entry);
-
/* Retrieve access ACL from file. */
- acl = acl_get_file(accpath, ACL_TYPE_ACCESS);
+ acl = acl_get_file(accpath, acl_type);
if (acl != NULL) {
s = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_entry);
while (s == 1) {
@@ -849,15 +864,13 @@ setup_acls(struct bsdtar *bsdtar, struct archive_entry *entry,
ae_perm |= ARCHIVE_ENTRY_ACL_WRITE;
archive_entry_acl_add_entry(entry,
- ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ae_perm, ae_tag,
+ archive_entry_acl_type, ae_perm, ae_tag,
ae_id, ae_name);
s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
}
acl_free(acl);
}
-
- /* XXX TODO: Default acl ?? XXX */
}
#else
void
OpenPOWER on IntegriCloud