X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fcreate.c;h=36ca30ec6a31487d22ba0fe67fd1399e48ae17a3;hb=085cace1805308589c6211429068f68047be0b0e;hp=37a58089d6ffcfb6385e5d5c7384e1b9f9765f18;hpb=d36f5a3cc3280d6c4a58367bf51b527d5c14ac04;p=chaz%2Ftar diff --git a/src/create.c b/src/create.c index 37a5808..36ca30e 100644 --- a/src/create.c +++ b/src/create.c @@ -953,6 +953,8 @@ start_header (struct tar_stat_info *st) if (st->acls_d_ptr) xheader_store ("SCHILY.acl.default", st, NULL); } + if ((selinux_context_option > 0) && st->cntx_name) + xheader_store ("RHT.security.selinux", st, NULL); if (xattrs_option > 0) { size_t scan_xattr = 0; @@ -1742,6 +1744,7 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p) struct stat final_stat; xattrs_acls_get (parentfd, name, st, 0, !is_dir); + xattrs_selinux_get (parentfd, name, st, fd); xattrs_xattrs_get (parentfd, name, st, fd); if (is_dir) @@ -1862,6 +1865,7 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p) if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT) < size) write_long_link (st); + xattrs_selinux_get (parentfd, name, st, 0); xattrs_xattrs_get (parentfd, name, st, 0); block_ordinal = current_block_ordinal (); @@ -1885,18 +1889,21 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p) { type = CHRTYPE; xattrs_acls_get (parentfd, name, st, 0, true); + xattrs_selinux_get (parentfd, name, st, 0); xattrs_xattrs_get (parentfd, name, st, 0); } else if (S_ISBLK (st->stat.st_mode)) { type = BLKTYPE; xattrs_acls_get (parentfd, name, st, 0, true); + xattrs_selinux_get (parentfd, name, st, 0); xattrs_xattrs_get (parentfd, name, st, 0); } else if (S_ISFIFO (st->stat.st_mode)) { type = FIFOTYPE; xattrs_acls_get (parentfd, name, st, 0, true); + xattrs_selinux_get (parentfd, name, st, 0); xattrs_xattrs_get (parentfd, name, st, 0); } else if (S_ISSOCK (st->stat.st_mode))