Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dirkmueller:acdc:sp5-rebuild
star.16416
star-selinux.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File star-selinux.patch of Package star.16416
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_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)) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor