Compare commits

..

No commits in common. "c8s" and "c9" have entirely different histories.
c8s ... c9

18 changed files with 162 additions and 574 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
/star-1.5.3.tar.bz2
SOURCES/star-1.6.tar.bz2

1
.star.metadata Normal file
View File

@ -0,0 +1 @@
2ee419a1167a54701183b79e75ce3e11de9872a5 SOURCES/star-1.6.tar.bz2

View File

@ -0,0 +1,43 @@
diff --git a/star/spax.1 b/star/spax.1
index b9a77e0..c462fe3 100644
--- a/star/spax.1
+++ b/star/spax.1
@@ -4047,7 +4047,7 @@ Interfaces volume of IEEE Std 1003.1-2001,
.BR chown (2),
.BR creat (2),
.BR mkdir (2),
-.BR mkfifo (2),
+.BR mkfifo (3),
.BR stat (2),
.BR utime (2),
.BR write (2).
@@ -4099,7 +4099,7 @@ entry is added to the ENVIRONMENT VARIABLES section.
IEEE PASC Interpretation 1003.2 #168 is applied, clarifying that
.BR mkdir (2)
and
-.BR mkfifo (2)
+.BR mkfifo (3)
calls can ignore an [EEXIST] error when
extracting an archive.
.PP
diff --git a/star/star.1 b/star/star.1
index caed9f4..a24d619 100644
--- a/star/star.1
+++ b/star/star.1
@@ -5293,7 +5293,6 @@ cron script).
Is used for the interactive user interface.
.SH "SEE ALSO"
.BR spax (1),
-.BR suntar (1),
.BR scpio (1),
.BR tar (1),
.BR cpio (1),
@@ -5308,7 +5307,7 @@ Is used for the interactive user interface.
.BR ssh (1),
.BR star_sym (1),
.BR tartest (1),
-.BR star (4),
+.BR star (1),
.BR rcmd (3),
.BR fssnap (1m)
.SH DIAGNOSTICS

View File

@ -0,0 +1,66 @@
diff --git a/star/Makefile b/star/Makefile
index e868c62..c47e81d 100644
--- a/star/all.mk
+++ b/star/all.mk
@@ -12,7 +12,7 @@ include $(SRCROOT)/$(RULESDIR)/rules.top
# and copy star_fat.mk to Makefile.
#
-MK_FILES= star.mk pax.mk suntar.mk gnutar.mk cpio.mk
+MK_FILES= star.mk pax.mk cpio.mk
###########################################################################
include $(SRCROOT)/$(RULESDIR)/rules.mks
diff --git a/star/cpio.mk b/star/cpio.mk
index 37a6dd2..0391239 100644
--- a/star/cpio.mk
+++ b/star/cpio.mk
@@ -22,15 +22,16 @@ CPPOPTS += -DUSE_FFLAGS
CPPOPTS += -DSCHILY_PRINT
CFILES= cpio.c header.c cpiohdr.c xheader.c xattr.c \
list.c extract.c create.c append.c diff.c restore.c \
- remove.c star_unix.c acl_unix.c acltext.c fflags.c \
+ remove.c star_unix.c lpath_unix.c \
+ acl_unix.c acltext.c fflags.c \
buffer.c dirtime.c lhash.c \
hole.c longnames.c \
movearch.c table.c props.c \
unicode.c \
subst.c volhdr.c \
chdir.c match.c defaults.c dumpdate.c \
- fifo.c device.c checkerr.c \
- findinfo.c pathname.c
+ fifo.c device.c checkerr.c paxopts.c \
+ findinfo.c pathname.c version.c
HFILES= star.h starsubs.h dirtime.h xtab.h xutimes.h \
movearch.h table.h props.h fifo.h diff.h \
checkerr.h dumpdate.h bitstring.h pathname.h
diff --git a/star/pax.mk b/star/pax.mk
index 73c6bc1..bd71e9b 100644
--- a/star/pax.mk
+++ b/star/pax.mk
@@ -23,18 +23,19 @@ CPPOPTS += -DPAX
CPPOPTS += -DSCHILY_PRINT
CFILES= pax.c header.c cpiohdr.c xheader.c xattr.c \
list.c extract.c create.c append.c diff.c restore.c \
- remove.c star_unix.c acl_unix.c acltext.c fflags.c \
+ remove.c star_unix.c lpath_unix.c \
+ acl_unix.c acltext.c fflags.c \
buffer.c dirtime.c lhash.c \
hole.c longnames.c \
movearch.c table.c props.c \
unicode.c \
subst.c volhdr.c \
chdir.c match.c defaults.c dumpdate.c \
- fifo.c device.c checkerr.c \
- findinfo.c pathname.c
+ fifo.c device.c checkerr.c paxopts.c \
+ findinfo.c pathname.c version.c
HFILES= star.h starsubs.h dirtime.h xtab.h xutimes.h \
- movearch.h table.h props.h fifo.h diff.h \
- checkerr.h dumpdate.h bitstring.h pathname.h
+ movearch.h table.h props.h fifo.h diff.h restore.h \
+ checkerr.h dumpdate.h bitstring.h
LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_CAP)
XMK_FILE= spaxman.mk

View File

@ -1,56 +1,34 @@
%if %{?WITH_SELINUX:0}%{!?WITH_SELINUX:1}
%global WITH_SELINUX 1
%endif
%global ALTERNATIVES %{_sbindir}/alternatives
Summary: An archiving tool with ACL support
Name: star
Version: 1.5.3
Release: 13%{?dist}
Version: 1.6
Release: 6%{?dist}
License: CDDL
Group: Applications/Archiving
URL: http://freecode.com/projects/star
Source: http://downloads.sourceforge.net/s-tar/%{name}-%{version}.tar.bz2
Source: https://downloads.sourceforge.net/s-tar/%{name}-%{version}.tar.bz2
# add SELinux support to star(#)
Patch1: star-1.5.3-selinux.patch
# do not segfault with data-change-warn option (#255261)
Patch2: star-1.5-changewarnSegv.patch
# Fix broken all.mk
Patch1: star-1.6-star-mk.patch
# Prevent buffer overflow for filenames with length of 100 characters (#556664)
Patch3: star-1.5.2-bufferoverflow.patch
# # Prevent buffer overflow for filenames with length of 100 characters (#556664)
Patch2: star-1.5.2-bufferoverflow.patch
# Fix some invalid manpage references (#624612)
Patch4: star-1.5.1-manpagereferences.patch
# do not crash when xattrs are not set on all files (#861848)
Patch5: star-1.5.1-selinux-segfault.patch
# note that the H=crc format uses Sum32 algorithm, not CRC
Patch6: star-1.5.1-crc.patch
# # Fix some invalid manpage references (#624612)
Patch3: star-1.6-manpagereferences.patch
# Allow rmt to access all files.
# ~> downstream
# ~> #968980
Patch8: star-1.5.2-rmt-rh-access.patch
Patch4: star-1.5.2-rmt-rh-access.patch
# Use ssh rather than rsh by default
# ~> downstream
# ~> related to #968980
Patch9: star-1.5.2-use-ssh-by-default.patch
# Fix broken star.mk in 1.5.3 (included from all.mk)
Patch10: star-1.5.3-star-mk.patch
# Fix segfault for 'pax -X' (rhbz#1175009)
# ~> downstream
Patch11: star-1.5.3-pax-X-option.patch
# Fix segfault on restore default acl (rhbz#1567836)
Patch12: star-1.5.3-default-acl.patch
Patch5: star-1.5.2-use-ssh-by-default.patch
BuildRequires: make
BuildRequires: libattr-devel libacl-devel libtool libselinux-devel
BuildRequires: e2fsprogs-devel
@ -60,7 +38,6 @@ and can restore individual files from the archive. Star supports ACL.
%package -n spax
Summary: Portable archive exchange
Group: Applications/Archiving
Requires(post): %{ALTERNATIVES}
Requires(preun): %{ALTERNATIVES}
@ -71,7 +48,6 @@ archive files and copy directory hierarchies as is defined in IEEE Std 1003.1.
%package -n scpio
Summary: Copy file archives in and out (LEGACY)
Group: Applications/Archiving
%description -n scpio
The scpio utility, depending on the options used: copies files to an archive
@ -80,7 +56,6 @@ copies files from one directory tree to another.
%package -n rmt
Summary: Provides certain programs with access to remote tape devices
Group: Applications/Archiving
# we need to be greater than the version from 'dump' package
Epoch: 2
@ -100,20 +75,7 @@ restoring files from a backup), and tar (an archiving program).
%global ALT_SL1_PATH %{_mandir}/man1/spax.1.gz
%prep
%setup -q
%if %{WITH_SELINUX}
%patch1 -p1 -b .selinux
%endif
%patch2 -p1 -b .changewarnSegv
%patch3 -p1 -b .namesoverflow
%patch4 -p1 -b .references
%patch5 -p1 -b .selinux-segfault
%patch6 -p1 -b .crc
%patch8 -p1 -b .rmt-access-rules
%patch9 -p1 -b .ssh-by-default
%patch10 -p1 -b .bug-config-1.5.3
%patch11 -p1 -b .pax-X
%patch12 -p1 -b .default-acl
%autosetup -p1
# disable single "fat" binary
cp -a star/all.mk star/Makefile
@ -152,7 +114,7 @@ done
DEFCCOM=gcc
# Note: disable optimalisation by COPTX='-g3 -O0' LDOPTX='-g3 -O0'
make %{?_smp_mflags} %make_flags
make %make_flags
%install
make install -s %make_flags
@ -186,8 +148,6 @@ install -p -m 644 COPYING star/README CDDL.Schily.txt AN-* \
rm -rf .%{_docdir}/rmt
)
%clean
%global general_docs \
%dir %{_pkgdocdir} \
%doc %{_pkgdocdir}/COPYING \
@ -209,6 +169,7 @@ fi
%{_bindir}/star
%{_bindir}/ustar
%{_mandir}/man1/star.1*
%{_mandir}/man1/star_sym.1*
%{_mandir}/man1/ustar.1*
%{_mandir}/man5/star.5*
@ -237,9 +198,44 @@ fi
%{_sysconfdir}/rmt
%changelog
* Wed Aug 01 2018 Vaclav Danek - 1.5.3-13
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 1.6-6
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.6-5
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Mon Sep 23 2019 Pavel Raiskup <praiskup@redhat.com> - 1.6-1
- new upstream release
- drop WITH_SELINUX knob and selinux patches, there's built-in support now
- drop several patches which were incorporated upstream, except for
changewarnSegv patch (did not apply, and not needed nowadays)
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.3-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.3-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Wed Nov 28 2018 Pavel Raiskup <praiskup@redhat.com> - 1.5.3-15
- fix covscan issues which have upstream fix (rhbz#1602700)
- reorder patches so we can easily apply %%_rawbuild macro
* Wed Aug 01 2018 Vaclav Danek <vdanek@redhat.com> - 1.5.3-14
- Fix segfault on restore default acl (rhbz#1567836)
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.3-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Mon Apr 09 2018 Rafael Santos <rdossant@redhat.com> - 1.5.3-12
- Use standard Fedora linker flags (bug #1548670)

View File

@ -1,6 +0,0 @@
--- !Policy
product_versions:
- rhel-8
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

View File

@ -1 +0,0 @@
SHA512 (star-1.5.3.tar.bz2) = 622032a0e87f3df06ab1091af0af99d0362f478f70351cfe3d47195eec0fcc96f458fb6e50cae3531183984b1d390b598176ce008bcc5f29764795f66436efef

View File

@ -1,80 +0,0 @@
--- star-1.5/star/checkerr.c.orig-segv 2006-10-31 18:06:25.000000000 +0100
+++ star-1.5/star/checkerr.c 2007-08-27 11:42:39.000000000 +0200
@@ -183,39 +183,45 @@ LOCAL struct eflags {
*/
LOCAL UInt32_t
errflags(eflag, doexit)
- char *eflag;
- BOOL doexit;
+ char *eflag;
+ BOOL doexit;
{
- register char *p = eflag;
- char *ef = _endword(eflag);
- register struct eflags *ep;
- register int slen;
- register UInt32_t nflags = 0;
-
- do {
- for (ep = eflags; ep->fname; ep++) {
- slen = strlen(ep->fname);
- if ((strncmp(ep->fname, p, slen) == 0) &&
- (p[slen] == '|' || p[slen] == ' ' ||
- p[slen] == '\0')) {
- nflags |= ep->fval;
- break;
- }
- }
- if (ep->fname == NULL) {
- if (doexit)
- comerrno(EX_BAD, "Bad flag '%s'\n", p);
- return (0);
- }
- p = strchr(p, '|');
- } while (p < ef && p && *p++ == '|');
-
- if ((nflags & ~(UInt32_t)(E_ABORT|E_WARN)) == 0) {
- if (doexit)
- comerrno(EX_BAD, "Bad error condition '%s'.\n", eflag);
- return (0);
- }
- return (nflags);
+ register struct eflags *ep;
+ register int slen;
+ register UInt32_t nflags = 0;
+ char *curflags;
+ char *curflag;
+
+ curflags = strdup (eflag);
+ *_endword(curflags) = '\0';
+ curflag = strtok (curflags, "|");
+
+ while (curflag != NULL) {
+ for (ep = eflags; ep->fname; ep++) {
+ slen = strlen (ep->fname);
+ if ((strncmp (ep->fname, curflag, slen)) == 0) {
+ nflags |= ep->fval;
+ goto next;
+ }
+ }
+
+ if (doexit)
+ comerrno (EX_BAD, "Bad flag '%s' \n", curflag);
+
+ free (curflags);
+ return (0);
+ next:
+ curflag = strtok (NULL, "|");
+ }
+
+ free (curflags);
+
+ if ((nflags & ~(UInt32_t)(E_ABORT|E_WARN)) == 0) {
+ if (doexit)
+ comerrno(EX_BAD, "Bad error condition '%s'.\n", eflag);
+ return (0);
+ }
+ return (nflags);
}
LOCAL ec_t *

View File

@ -1,31 +0,0 @@
diff --git a/star/cpiohdr.c b/star/cpiohdr.c
index 9c7a774..2785661 100644
--- a/star/cpiohdr.c
+++ b/star/cpiohdr.c
@@ -536,7 +536,9 @@ cpio_checkswab(ptb)
}
/*
- * This simple sum is used for the SYSvr4 file content CRC
+ * This simple sum is used for the SYSvr4 file content checksum. This is
+ * implemented like Sum32 algorithm.
+ *
* Use Int32_t to implement the same behavior as the AT&T cpio command.
*/
LOCAL Int32_t
diff --git a/star/star.1 b/star/star.1
index 95b202c..a931a6f 100644
--- a/star/star.1
+++ b/star/star.1
@@ -913,9 +913,9 @@ archive format because of its limited portability.
.B crc
This format is similar to the
.B asc
-cpio format but in addition uses a simple byte based checksum called
+cpio format but in addition uses a simple byte based checksum called here as
.BR CRC .
-Try to avoid the
+This algorithm is simple Sum32 -- not a polynomial CRC. Try to avoid the
.B crc
archive format because of its limited portability.

View File

@ -1,56 +0,0 @@
diff -urNp star-1.5.1-orig/star/spax.1 star-1.5.1/star/spax.1
--- star-1.5.1-orig/star/spax.1 2009-04-10 23:51:50.000000000 +0200
+++ star-1.5.1/star/spax.1 2010-08-17 13:32:38.246788583 +0200
@@ -4043,7 +4043,7 @@ Interfaces volume of IEEE Std 1003.1-200
.BR chown (2),
.BR creat (2),
.BR mkdir (2),
-.BR mkfifo (2),
+.BR mkfifo (3),
.BR stat (2),
.BR utime (2),
.BR write (2).
@@ -4095,7 +4095,7 @@ entry is added to the ENVIRONMENT VARIAB
IEEE PASC Interpretation 1003.2 #168 is applied, clarifying that
.BR mkdir (2)
and
-.BR mkfifo (2)
+.BR mkfifo (3)
calls can ignore an [EEXIST] error when
extracting an archive.
.PP
diff -urNp star-1.5.1-orig/star/star.1 star-1.5.1/star/star.1
--- star-1.5.1-orig/star/star.1 2009-06-02 20:49:21.000000000 +0200
+++ star-1.5.1/star/star.1 2010-08-17 13:34:50.524789662 +0200
@@ -4615,20 +4615,18 @@ cron script).
Is used for the intercative user interface.
.SH "SEE ALSO"
.BR spax (1),
-.BR suntar (1),
-.BR scpio (1),
.BR tar (1),
.BR cpio (1),
.BR pax (1),
.BR rcp (1),
.BR mt (1),
-.BR rmt (1),
+.BR rmt (8),
.BR match (1),
.BR dd (1),
.BR sdd (1),
.BR rsh (1),
.BR ssh (1),
-.BR star (4/5),
+.BR star (4),
.BR rcmd (3),
.BR fssnap (1m)
.SH DIAGNOSTICS
@@ -4951,7 +4949,7 @@ is installed suid root,
.B star
is able to make connections to remote archives for non root users.
This is done by using the
-rcmd(3) interface to get a connection to a rmt(1) server.
+rcmd(3) interface to get a connection to a rmt(8) server.
.PP
.B Star
resets its effective uid back to the real user id immediately after setting up

View File

@ -1,13 +0,0 @@
diff --git a/star/xattr.c b/star/xattr.c
index 6493447..4034287 100644
--- a/star/xattr.c
+++ b/star/xattr.c
@@ -202,7 +202,7 @@ setselinux(info)
register FINFO *info;
{
#if defined(USE_XATTR) && defined(HAVE_SETXATTR) && defined(WITH_SELINUX)
- if (info->f_xattr) {
+ if (info->f_xflags & XF_XATTR) {
star_xattr_t *xap;
for (xap = info->f_xattr; xap->name != NULL; xap++) {
if (strcmp(xap->name, "security.selinux") == 0) {

View File

@ -1,13 +0,0 @@
--- acl_unix.c 2018-08-01 12:01:04.218237606 +0200
+++ star-1.5.3/star/acl_unix.c 2014-03-31 19:44:46.000000000 +0200
@@ -505,7 +505,7 @@
}
if (info->f_xflags & XF_ACL_DEFAULT) {
- ssize_t len = strlen(info->f_acl_access) + 2;
+ ssize_t len = strlen(info->f_acl_default) + 2;
if (len > aclps.ps_size) {
if (aclps.ps_path == acltext) {

View File

@ -1,26 +0,0 @@
From 68f6e16d7d2c8a6c91cd430b12a1a0c7b15672b4 Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <praiskup@redhat.com>
Date: Wed, 17 Dec 2014 12:57:37 +0100
Subject: [PATCH] pax: don't segfault with -X option
Pass a valid address of nomount variable into getallargs().
---
star/pax.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/star/pax.c b/star/pax.c
index 9abe3f8..c627a46 100644
--- a/star/pax.c
+++ b/star/pax.c
@@ -166,7 +166,7 @@ gargs(ac, av)
gethdr, &chdrtype, /* -x */
gethdr, &chdrtype, /* artype= */
#endif /* __old__lint */
- nomount) < 0) {
+ &nomount) < 0) {
errmsgno(EX_BAD, "Bad Option: %s.\n", av[0]);
susage(EX_BAD);
}
--
2.1.0

View File

@ -1,273 +0,0 @@
diff --git a/autoconf/configure.in b/autoconf/configure.in
index fc9f880..30383e4 100644
--- a/autoconf/configure.in
+++ b/autoconf/configure.in
@@ -906,6 +906,15 @@ LIBS="$LIBS $lib_cap"
AC_CHECK_FUNCS(cap_get_proc cap_set_proc cap_set_flag cap_clear_flag)
LIBS="$ac_save_LIBS"
+AC_CHECK_HEADERS(selinux/selinux.h)
+if test "$ac_cv_header_selinux_selinux_h" = yes; then
+ AC_CHECKING(for SELinux support)
+ AC_CHECK_LIB(selinux, is_selinux_enabled, lib_selinux="-lselinux -lattr")
+ ac_save_LIBS="$LIBS"
+ LIBS="$LIBS $lib_selinux"
+ AC_CHECK_FUNCS(is_selinux_enabled)
+fi
+
dnl Misc OS checks.
AC_CHECK_FILES(/dev/tty /dev/null /dev/zero)
AC_CHECK_FILES(/dev/stdin /dev/stdout /dev/stderr)
@@ -992,6 +1001,7 @@ AC_SUBST(lib_secdb)
AC_SUBST(lib_gen)
AC_SUBST(lib_pthread)
AC_SUBST(lib_rt)
+AC_SUBST(lib_selinux)
AC_SUBST(lib_dl)
AC_SUBST(lib_dir)
AC_SUBST(lib_cap)
diff --git a/autoconf/rules.cnf.in b/autoconf/rules.cnf.in
index affcb5c..2b7bff2 100644
--- a/autoconf/rules.cnf.in
+++ b/autoconf/rules.cnf.in
@@ -34,6 +34,7 @@ LIB_SECDB = @lib_secdb@
LIB_GEN = @lib_gen@
LIB_PTHREAD = @lib_pthread@
LIB_RT = @lib_rt@
+LIB_SELINUX = @lib_selinux@
LIB_DL= @lib_dl@
LIB_DIR= @lib_dir@
LIB_CAP= @lib_cap@
diff --git a/star/cpio.mk b/star/cpio.mk
index 37a6dd2..8bfc3bd 100644
--- a/star/cpio.mk
+++ b/star/cpio.mk
@@ -19,6 +19,7 @@ CPPOPTS += -DUSE_FIND
CPPOPTS += -DUSE_ACL
CPPOPTS += -DUSE_XATTR
CPPOPTS += -DUSE_FFLAGS
+CPPOPTS += -DWITH_SELINUX
CPPOPTS += -DSCHILY_PRINT
CFILES= cpio.c header.c cpiohdr.c xheader.c xattr.c \
list.c extract.c create.c append.c diff.c restore.c \
@@ -34,7 +35,7 @@ CFILES= cpio.c header.c cpiohdr.c xheader.c xattr.c \
HFILES= star.h starsubs.h dirtime.h xtab.h xutimes.h \
movearch.h table.h props.h fifo.h diff.h \
checkerr.h dumpdate.h bitstring.h pathname.h
-LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_CAP)
+LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_CAP) $(LIB_SELINUX)
XMK_FILE= scpioman.mk
###########################################################################
diff --git a/star/extract.c b/star/extract.c
index cf60154..98842e1 100644
--- a/star/extract.c
+++ b/star/extract.c
@@ -256,6 +256,17 @@ extern struct WALK walkstate;
continue;
}
#endif
+
+#ifdef WITH_SELINUX
+ if (!to_stdout && selinux_enabled) {
+ if (setselinux(&finfo) == FALSE) {
+ errmsgno(EX_BAD,
+ "Can not setup security context for '%s'. Not created.\n",
+ finfo.f_name);
+ }
+ }
+#endif
+
if (finfo.f_flags & F_BAD_META) {
if (!void_bad(&finfo))
break;
diff --git a/star/gnutar.mk b/star/gnutar.mk
index 1a296e1..6595aa2 100644
--- a/star/gnutar.mk
+++ b/star/gnutar.mk
@@ -19,6 +19,7 @@ CPPOPTS += -DUSE_FIND
CPPOPTS += -DUSE_ACL
CPPOPTS += -DUSE_XATTR
CPPOPTS += -DUSE_FFLAGS
+CPPOPTS += -DWITH_SELINUX
CPPOPTS += -DSCHILY_PRINT
CFILES= gnutar.c header.c cpiohdr.c xheader.c xattr.c \
list.c extract.c create.c append.c diff.c restore.c \
@@ -34,7 +35,7 @@ CFILES= gnutar.c header.c cpiohdr.c xheader.c xattr.c \
HFILES= star.h starsubs.h dirtime.h xtab.h xutimes.h \
movearch.h table.h props.h fifo.h diff.h \
checkerr.h dumpdate.h bitstring.h pathname.h
-LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_CAP)
+LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_CAP) $(LIB_SELINUX)
XMK_FILE= gnutarman.mk
###########################################################################
diff --git a/star/pax.mk b/star/pax.mk
index 73c6bc1..d2a52a9 100644
--- a/star/pax.mk
+++ b/star/pax.mk
@@ -19,6 +19,7 @@ CPPOPTS += -DUSE_FIND
CPPOPTS += -DUSE_ACL
CPPOPTS += -DUSE_XATTR
CPPOPTS += -DUSE_FFLAGS
+CPPOPTS += -DWITH_SELINUX
CPPOPTS += -DPAX
CPPOPTS += -DSCHILY_PRINT
CFILES= pax.c header.c cpiohdr.c xheader.c xattr.c \
@@ -35,7 +36,7 @@ CFILES= pax.c header.c cpiohdr.c xheader.c xattr.c \
HFILES= star.h starsubs.h dirtime.h xtab.h xutimes.h \
movearch.h table.h props.h fifo.h diff.h \
checkerr.h dumpdate.h bitstring.h pathname.h
-LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_CAP)
+LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_CAP) $(LIB_SELINUX)
XMK_FILE= spaxman.mk
###########################################################################
diff --git a/star/star.c b/star/star.c
index 9dfcef7..464c751 100644
--- a/star/star.c
+++ b/star/star.c
@@ -48,6 +48,10 @@ static UConst char sccsid[] =
#include "starsubs.h"
#include "checkerr.h"
+#ifdef WITH_SELINUX
+int selinux_enabled=0;
+#endif
+
EXPORT int main __PR((int ac, char **av));
LOCAL void star_create __PR((int ac, char *const *av));
LOCAL void checkdumptype __PR((GINFO *gp));
@@ -402,6 +406,10 @@ main(ac, av)
comerr("Panic cannot set back effective uid.\n");
}
my_uid = geteuid();
+
+#ifdef WITH_SELINUX
+ selinux_enabled=is_selinux_enabled()>0;
+#endif
/*
* WARNING: We now are no more able to open a new remote connection
* unless we have been called by root.
diff --git a/star/star.mk b/star/star.mk
index a6f6cff..68d3482 100644
--- a/star/star.mk
+++ b/star/star.mk
@@ -21,6 +21,7 @@ CPPOPTS += -DUSE_XATTR
CPPOPTS += -DUSE_FFLAGS
CPPOPTS += -DCOPY_LINKS_DELAYED
CPPOPTS += -DSCHILY_PRINT
+CPPOPTS += -DWITH_SELINUX
CFILES= star.c header.c cpiohdr.c xheader.c xattr.c \
list.c extract.c create.c append.c diff.c restore.c \
remove.c star_unix.c acl_unix.c acltext.c fflags.c \
@@ -35,7 +36,7 @@ CFILES= star.c header.c cpiohdr.c xheader.c xattr.c \
HFILES= star.h starsubs.h dirtime.h xtab.h xutimes.h \
movearch.h table.h props.h fifo.h diff.h restore.h \
checkerr.h dumpdate.h bitstring.h
-LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL)
+LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_SELINUX)
XMK_FILE= Makefile.man starformatman.mk
###########################################################################
diff --git a/star/star_fat.mk b/star/star_fat.mk
index 1975c94..507fbee 100644
--- a/star/star_fat.mk
+++ b/star/star_fat.mk
@@ -29,6 +29,7 @@ CPPOPTS += -DUSE_FFLAGS
CPPOPTS += -DCOPY_LINKS_DELAYED
CPPOPTS += -DSTAR_FAT
CPPOPTS += -DSCHILY_PRINT
+CPPOPTS += -DWITH_SELINUX
CFILES= star_fat.c header.c cpiohdr.c xheader.c xattr.c \
list.c extract.c create.c append.c diff.c restore.c \
remove.c star_unix.c acl_unix.c acltext.c fflags.c \
@@ -48,7 +49,7 @@ HFILES= star.h starsubs.h dirtime.h xtab.h xutimes.h \
#LIBS= -lunos
#LIBS= -lschily -lc /usr/local/lib/gcc-gnulib
-LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL)
+LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_SELINUX)
#
# Wenn -lfind, dann auch $(LIB_INTL)
#
diff --git a/star/starsubs.h b/star/starsubs.h
index a914ade..1e2a233 100644
--- a/star/starsubs.h
+++ b/star/starsubs.h
@@ -317,6 +317,11 @@ extern void opt_xattr __PR((void));
extern BOOL get_xattr __PR((register FINFO *info));
extern BOOL set_xattr __PR((register FINFO *info));
extern void free_xattr __PR((star_xattr_t **xattr));
+# ifdef WITH_SELINUX
+#include <selinux/selinux.h>
+extern BOOL setselinux __PR((register FINFO *info));
+extern int selinux_enabled;
+# endif
#endif
/*
diff --git a/star/suntar.mk b/star/suntar.mk
index 9b76a23..1842917 100644
--- a/star/suntar.mk
+++ b/star/suntar.mk
@@ -19,6 +19,7 @@ CPPOPTS += -DUSE_FIND
CPPOPTS += -DUSE_ACL
CPPOPTS += -DUSE_XATTR
CPPOPTS += -DUSE_FFLAGS
+CPPOPTS += -DWITH_SELINUX
CPPOPTS += -DSCHILY_PRINT
CFILES= suntar.c header.c cpiohdr.c xheader.c xattr.c \
list.c extract.c create.c append.c diff.c restore.c \
@@ -34,7 +35,7 @@ CFILES= suntar.c header.c cpiohdr.c xheader.c xattr.c \
HFILES= star.h starsubs.h dirtime.h xtab.h xutimes.h \
movearch.h table.h props.h fifo.h diff.h \
checkerr.h dumpdate.h bitstring.h pathname.h
-LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_CAP)
+LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_CAP) $(LIB_SELINUX)
XMK_FILE= suntarman.mk
###########################################################################
diff --git a/star/xattr.c b/star/xattr.c
index 2e262ef..08fc42e 100644
--- a/star/xattr.c
+++ b/star/xattr.c
@@ -198,6 +198,27 @@ fail:
#endif /* USE_XATTR */
}
+#ifdef WITH_SELINUX
+EXPORT BOOL
+setselinux(info)
+ register FINFO *info;
+{
+#if defined(USE_XATTR) && defined(HAVE_SETXATTR) && defined(WITH_SELINUX)
+ if (info->f_xattr) {
+ star_xattr_t *xap;
+ for (xap = info->f_xattr; xap->name != NULL; xap++) {
+ if (strcmp(xap->name, "security.selinux") == 0) {
+ if (setfscreatecon(xap->value)) {
+ return FALSE;
+ }
+ }
+ }
+ }
+#endif /* USE_XATTR && WITH_SELINUX */
+ return TRUE;
+}
+#endif
+
/* ARGSUSED */
EXPORT BOOL
set_xattr(info)
@@ -211,6 +232,10 @@ set_xattr(info)
return (TRUE);
for (xap = info->f_xattr; xap->name != NULL; xap++) {
+#ifdef WITH_SELINUX
+ if (selinux_enabled && (strcmp(xap->name, "security.selinux") == 0))
+ continue;
+#endif
if (lsetxattr(info->f_name, xap->name, xap->value,
xap->value_len, 0) != 0) {
if (!errhidden(E_SETXATTR, info->f_name)) {

View File

@ -1,19 +0,0 @@
diff --git a/star/star.mk b/star/star.mk
index 68d3482..4961a29 100644
--- a/star/star.mk
+++ b/star/star.mk
@@ -32,11 +32,11 @@ CFILES= star.c header.c cpiohdr.c xheader.c xattr.c \
subst.c volhdr.c \
chdir.c match.c defaults.c dumpdate.c \
fifo.c device.c checkerr.c \
- findinfo.c
+ findinfo.c pathname.c
HFILES= star.h starsubs.h dirtime.h xtab.h xutimes.h \
movearch.h table.h props.h fifo.h diff.h restore.h \
- checkerr.h dumpdate.h bitstring.h
-LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_SELINUX)
+ checkerr.h dumpdate.h bitstring.h pathname.h
+LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_SELINUX) $(LIB_CAP)
XMK_FILE= Makefile.man starformatman.mk
###########################################################################