-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -711,15 +711,34 @@ import_one_libarchive_entry_to_ostree (RpmOstreeUnpacker *self, | |
|
||
cap_t_to_vfs (caps, &vfscap, &vfscap_size); | ||
vfsbytes = g_bytes_new (&vfscap, vfscap_size); | ||
|
||
g_variant_builder_add (&xattr_builder, "(@ay@ay)", | ||
g_variant_new_bytestring ("security.capability"), | ||
g_variant_new_from_bytes ((GVariantType*)"ay", | ||
vfsbytes, | ||
FALSE)); | ||
FALSE)); | ||
} | ||
} | ||
|
||
// fetch the selinux label | ||
if (sepolicy) | ||
{ | ||
g_autofree char *label = NULL; | ||
g_autoptr(GFileInfo) file_info = | ||
_rpmostree_libarchive_to_file_info (entry); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
g_autofree char *fullpath = g_strdup_printf ("/%s", pathname); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
if (!ostree_sepolicy_get_label (sepolicy, fullpath, | ||
g_file_info_get_attribute_uint32 (file_info, "unix::mode"), | ||
&label, cancellable, error)) | ||
goto out; | ||
|
||
if (label) | ||
g_variant_builder_add (&xattr_builder, "(@ay@ay)", | ||
g_variant_new_bytestring ("security.selinux"), | ||
g_variant_new_bytestring (label)); | ||
} | ||
|
||
if (!pathname[0]) | ||
{ | ||
parent = NULL; | ||
|
@@ -917,7 +936,7 @@ rpmostree_unpacker_unpack_to_ostree (RpmOstreeUnpacker *self, | |
g_autoptr(GHashTable) rpmfi_overrides = NULL; | ||
g_autoptr(GHashTable) hardlinks = | ||
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); | ||
g_autofree char *default_dir_checksum = NULL; | ||
g_autofree char *default_dir_checksum = NULL; | ||
g_autoptr(GFile) root = NULL; | ||
glnx_unref_object OstreeMutableTree *mtree = NULL; | ||
g_autoptr(GBytes) header_bytes = NULL; | ||
|
@@ -928,17 +947,17 @@ rpmostree_unpacker_unpack_to_ostree (RpmOstreeUnpacker *self, | |
|
||
rpmfi_overrides = build_rpmfi_overrides (self); | ||
|
||
g_assert (sepolicy == NULL); | ||
|
||
/* Default directories are 0/0/0755, and right now we're ignoring | ||
* SELinux. (This might be a problem for /etc, but in practice | ||
* anything with nontrivial perms should be in the packages) | ||
*/ | ||
/* Default directories are 0/0/0755. We're not ignoring SELinux, but we still | ||
* need to create any parent dirs as they come since we don't have a proper | ||
* rootfs tree. A better solution might be to just copy from e.g. the current | ||
* deployment. In practice, this won't make a difference when we're overlaying | ||
* over an existing rootfs. | ||
This comment has been minimized.
Sorry, something went wrong.
cgwalters
|
||
* */ | ||
{ glnx_unref_object GFileInfo *default_dir_perms = g_file_info_new (); | ||
g_file_info_set_attribute_uint32 (default_dir_perms, "unix::uid", 0); | ||
g_file_info_set_attribute_uint32 (default_dir_perms, "unix::gid", 0); | ||
g_file_info_set_attribute_uint32 (default_dir_perms, "unix::mode", 0755 | S_IFDIR); | ||
|
||
if (!write_directory_meta (repo, default_dir_perms, NULL, | ||
&default_dir_checksum, cancellable, error)) | ||
goto out; | ||
|
@@ -951,18 +970,23 @@ rpmostree_unpacker_unpack_to_ostree (RpmOstreeUnpacker *self, | |
ostree_mutable_tree_set_metadata_checksum (mtree, default_dir_checksum); | ||
|
||
{ g_autoptr(GBytes) metadata = NULL; | ||
|
||
if (!get_lead_sig_header_as_bytes (self, &metadata, cancellable, error)) | ||
goto out; | ||
|
||
g_variant_builder_add (&metadata_builder, "{sv}", "rpmostree.metadata", | ||
g_variant_new_from_bytes ((GVariantType*)"ay", metadata, TRUE)); | ||
} | ||
|
||
|
||
if (sepolicy) | ||
g_variant_builder_add (&metadata_builder, "{sv}", "rpmostree.sepolicy", | ||
g_variant_new_string | ||
(ostree_sepolicy_get_csum (sepolicy))); | ||
|
||
while (TRUE) | ||
{ | ||
struct archive_entry *entry; | ||
|
||
if (!next_archive_entry (self->archive, &entry, error)) | ||
goto out; | ||
if (entry == NULL) | ||
|
Can't we just get
archive_entry_stat (entry)->st_mode
?