of->path = mfree(of->path);
}
xattr_done_many(of->xattr, of->n_xattr);
+#if HAVE_ACL
if (of->acl_access)
sym_acl_free(of->acl_access);
if (of->acl_default)
sym_acl_free(of->acl_default);
+#endif
}
static void open_inode_done_many(OpenInode *array, size_t n) {
return 0;
if (of->acl_access) {
+#if HAVE_ACL
if (sym_acl_set_fd(of->fd, of->acl_access) < 0)
RET_GATHER(r, log_error_errno(errno, "Failed to adjust ACLs of '%s': %m", of->path));
+#else
+ log_debug("The archive entry '%s' has ACLs, but ACL support is disabled.", of->path);
+#endif
}
if (of->filetype == S_IFDIR && of->acl_default) {
+#if HAVE_ACL
/* There's no API to set default ACLs by fd, hence go by /proc/self/fd/ path */
if (sym_acl_set_file(FORMAT_PROC_FD_PATH(of->fd), ACL_TYPE_DEFAULT, of->acl_default) < 0)
RET_GATHER(r, log_error_errno(errno, "Failed to adjust default ACLs of '%s': %m", of->path));
+#else
+ log_debug("The archive entry '%s' has default ACLs, but ACL support is disabled.", of->path);
+#endif
}
return r;
return 0;
assert(c > 0);
+#if HAVE_ACL
r = dlopen_libacl();
if (r < 0) {
log_debug_errno(r, "Not restoring ACL data on inode as libacl is not available: %m");
a = sym_acl_init(c);
if (!a)
return log_oom();
+#endif
for (;;) {
int rtype, permset, tag, qual;
if (ntag == ACL_UNDEFINED_TAG)
continue;
+#if HAVE_ACL
acl_entry_t e;
if (IN_SET(ntag, ACL_USER, ACL_GROUP)) {
id_t id = qual;
if (sym_acl_set_permset(e, p) < 0)
return log_error_errno(errno, "Failed to set ACL entry permission set: %m");
+#else
+ *acl = POINTER_MAX; /* Indicate the entry has valid ACLs. */
+ return 0;
+#endif
}
+#if HAVE_ACL
if (*acl)
sym_acl_free(*acl);
*acl = TAKE_PTR(a);
+#else
+ *acl = NULL; /* Indicate the entry has no ACL. */
+#endif
return 0;
}
gid_t gid = GID_INVALID;
struct timespec mtime = { .tv_nsec = UTIME_OMIT };
unsigned fflags = 0;
- _cleanup_(acl_freep) acl_t acl_access = NULL, acl_default = NULL;
+#if HAVE_ACL
+ _cleanup_(acl_freep)
+#endif
+ acl_t acl_access = NULL, acl_default = NULL;
XAttr *xa = NULL;
size_t n_xa = 0;
CLEANUP_ARRAY(xa, n_xa, xattr_done_many);
return 0;
}
+#if HAVE_ACL
static int archive_write_acl(
struct archive_entry *entry,
acl_type_t ntype,
return 0;
}
+#endif
static int archive_item(
RecurseDirEvent event,
sym_archive_entry_set_symlink(entry, s);
}
+#if HAVE_ACL
if (inode_type_can_acl(sx->stx_mode)) {
r = dlopen_libacl();
}
}
}
+#endif
_cleanup_free_ char *xattrs = NULL;
r = flistxattr_malloc(inode_fd, &xattrs);