init package

This commit is contained in:
chengquan 2019-12-31 23:33:31 +08:00
parent e5de065783
commit 4313ba352b
14 changed files with 728 additions and 39 deletions

View File

@ -1,39 +0,0 @@
# star
#### 介绍
{**以下是码云平台说明,您可以替换此简介**
码云是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN。专为开发者提供稳定、高效、安全的云端软件开发协作平台
无论是个人、团队、或是企业,都能够用码云实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 码云特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

View File

@ -0,0 +1,29 @@
From dac100b46c15c7105dd7e015ce5db7b512dc37db Mon Sep 17 00:00:00 2001
From: openEuler Buildteam <buildteam@openeuler.org>
Date: Tue, 31 Dec 2019 23:02:27 +0800
Subject: [PATCH] star:remove useless patch
---
star-1.5.3/rmt/rmt.dfl | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/star-1.5.3/rmt/rmt.dfl b/star-1.5.3/rmt/rmt.dfl
index 7b8ca8b..d5167b4 100644
--- a/rmt/rmt.dfl
+++ b/rmt/rmt.dfl
@@ -44,7 +44,7 @@ USER=*
# name name
#
#ACCESS=rtape sparky /dev/rmt/*
-ACCESS=* * /dev/rmt/*
-ACCESS=* * /dev/null
-ACCESS=* * /dev/zero
-#ACCESS=* * *
+#ACCESS=* * /dev/rmt/*
+#ACCESS=* * /dev/null
+#ACCESS=* * /dev/zero
+ACCESS=* * *
--
2.19.1

View File

@ -0,0 +1,80 @@
--- 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 *

31
star-1.5.1-crc.patch Normal file
View File

@ -0,0 +1,31 @@
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

@ -0,0 +1,56 @@
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

@ -0,0 +1,13 @@
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

@ -0,0 +1,22 @@
diff --git a/star/longnames.c b/star/longnames.c
index 33cbe2a..9d2e303 100644
--- a/star/longnames.c
+++ b/star/longnames.c
@@ -155,7 +155,7 @@ name_to_tcb(info, ptb)
if (add)
strcatl(ptb->ndbuf.t_name, name, "/", (char *)NULL);
else
- strcpy(ptb->ndbuf.t_name, name);
+ strncpy(ptb->ndbuf.t_name, name, props.pr_maxsname);
return (TRUE);
}
@@ -198,7 +198,7 @@ name_to_tcb(info, ptb)
if (add)
strcatl(ptb->ndbuf.t_name, &np[1], "/", (char *)NULL);
else
- strcpy(ptb->ndbuf.t_name, &np[1]);
+ strncpy(ptb->ndbuf.t_name, &np[1], props.pr_maxsname);
strncpy(ptb->dbuf.t_prefix, name, np - name);
info->f_flags |= F_SPLIT_NAME;
return (TRUE);

View File

@ -0,0 +1,13 @@
diff --git a/librmt/remote.c b/librmt/remote.c
index 4606484..298ecef 100644
--- a/librmt/remote.c
+++ b/librmt/remote.c
@@ -1462,7 +1462,7 @@ _rcmdrsh(ahost, inport, locuser, remuser, cmd, rsh)
int pid;
if (rsh == 0)
- rsh = "rsh";
+ rsh = "ssh";
/*
* Verify that 'locuser' is present on local host.

View File

@ -0,0 +1,13 @@
--- 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

@ -0,0 +1,26 @@
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

273
star-1.5.3-selinux.patch Normal file
View File

@ -0,0 +1,273 @@
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)) {

19
star-1.5.3-star-mk.patch Normal file
View File

@ -0,0 +1,19 @@
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
###########################################################################

BIN
star-1.5.3.tar.bz2 Normal file

Binary file not shown.

153
star.spec Normal file
View File

@ -0,0 +1,153 @@
%global ALTERNATIVES %{_sbindir}/alternatives
%global ALT_NAME pax
%global ALT_LINK %{_bindir}/pax
%global ALT_SL1_NAME pax-man
%global ALT_SL1_LINK %{_mandir}/man1/pax.1.gz
%global ALT_PATH %{_bindir}/spax
%global ALT_SL1_PATH %{_mandir}/man1/spax.1.gz
Name: star
Version: 1.5.3
Release: 16
Summary: An archiver supports ACL
License: CDDL
URL: http://freecode.com/projects/%{name}
Source: http://downloads.sourceforge.net/s-tar/%{name}-%{version}.tar.bz2
Patch1: star-1.5.3-selinux.patch
Patch2: star-1.5-changewarnSegv.patch
Patch3: star-1.5.2-bufferoverflow.patch
Patch4: star-1.5.1-manpagereferences.patch
Patch5: star-1.5.1-selinux-segfault.patch
Patch6: star-1.5.1-crc.patch
Patch7: star-1.5.2-use-ssh-by-default.patch
Patch8: star-1.5.3-star-mk.patch
Patch9: star-1.5.3-pax-X-option.patch
Patch10: star-1.5.3-default-acl.patch
Patch9000: bugfix-star-rmt-add-authority.patch
BuildRequires: libattr-devel libacl-devel libtool libselinux-devel e2fsprogs-devel git
Provides: scpio = %{version}-%{release} spax = %{version}-%{release} rmt = %{version}-%{release}
Obsoletes: scpio spax rmt
Requires(post): %{ALTERNATIVES}
Requires(preun): %{ALTERNATIVES}
%description
Star is an archiver with ACL support, it saves many files together into a single
tape or disk archive, and can restore individual files from the archive.
%package help
Summary: Help files for %{name}
BuildArch: noarch
%description help
Help files for %{name}.
%prep
%autosetup -n %{name}-%{version} -p1 -Sgit
cp -a star/all.mk star/Makefile
star_recode()
{
for i in $@; do
iconv -f iso_8859-1 -t utf-8 $i > .tmp_file
mv .tmp_file $i
done
}
star_recode AN-1.5 AN-1.5.2 star/star.4
for PLAT in %{arm} %{power64} aarch64 %{mips} x86_64; do
for AFILE in gcc cc; do
[ ! -e RULES/${PLAT}-linux-${AFILE}.rul ] \
&& ln -s i586-linux-${AFILE}.rul RULES/${PLAT}-linux-${AFILE}.rul
done
done
%build
%global make_flags GMAKE_NOWARN=true \\\
RUNPATH= \\\
LDPATH= \\\
PARCH=%{_target_cpu} \\\
K_ARCH=%{_target_cpu} \\\
INS_BASE=%{buildroot}%{_prefix} \\\
INS_RBASE=%{buildroot} \\\
INSTALL='sh $(SRCROOT)/conf/install-sh -c -m $(INSMODEINS)' \\\
COPTX="$RPM_OPT_FLAGS -DTRY_EXT2_FS" \\\
LDOPTX="$RPM_LD_FLAGS" \\\
DEFCCOM=gcc
%make_build %make_flags
%install
make install -s %make_flags
ln -s star.1.gz %{buildroot}%{_mandir}/man1/ustar.1
mkdir -p %{buildroot}%{_sysconfdir}
mkdir -p %{buildroot}%{_pkgdocdir}
ln -s %{_sbindir}/rmt %{buildroot}%{_sysconfdir}/rmt
install -p -m 644 COPYING star/README CDDL.Schily.txt AN-* %{buildroot}%{_pkgdocdir}
rm -rf %{buildroot}%{_prefix}/lib
%clean
%post
%{ALTERNATIVES} --install %{ALT_LINK} %{ALT_NAME} %{ALT_PATH} 66 \
--slave %{ALT_SL1_LINK} %{ALT_SL1_NAME} %{ALT_SL1_PATH}
%preun
if [ $1 -eq 0 ]; then
%{ALTERNATIVES} --remove %{ALT_NAME} %{ALT_PATH}
fi
%files
%exclude %{_bindir}/mt
%exclude %{_bindir}/smt
%exclude %{_bindir}/tartest
%exclude %{_bindir}/tar
%exclude %{_bindir}/gnutar
%exclude %{_bindir}/star_fat
%exclude %{_bindir}/star_sym
%exclude %{_bindir}/suntar
%exclude %{_sysconfdir}/default/star
%exclude %{_prefix}%{_sysconfdir}
%exclude %{_prefix}/include
%exclude %{_mandir}/man3
%exclude %{_mandir}/man5/{makefiles,makerules}.5*
%exclude %{_mandir}/man1/{tartest,gnutar,smt,mt,suntar,match}.1*
%exclude %{_docdir}/star/testscripts
%exclude %{_docdir}/star/TODO
%exclude %{_docdir}/rmt
%doc %{_pkgdocdir}
%{_bindir}/star
%{_bindir}/ustar
%dir %{_pkgdocdir}
%license COPYING
%doc %{_pkgdocdir}/CDDL.Schily.txt
%{_bindir}/scpio
%{_bindir}/spax
%ghost %verify(not md5 size mode mtime) %{ALT_LINK}
%ghost %verify(not md5 size mode mtime) %{ALT_SL1_LINK}
%{_sbindir}/rmt
%config %{_sysconfdir}/default/rmt
%{_sysconfdir}/rmt
%files help
%{_mandir}/man1/star.*
%{_mandir}/man1/ustar.*
%{_mandir}/man5/star.*
%{_mandir}/man1/scpio.*
%{_mandir}/man1/spax.*
%{_mandir}/man1/rmt.*
%changelog
* Thu Nov 21 2019 fangyufa<fangyufa1@huawei.com> - 1.5.3-16
- add buildrequires of git for x86_64 build
* Mon Oct 21 2019 openEuler Buildteam<buildteam@openeuler.org> - 1.5.3-15
- Type:NA
- ID:NA
- SUG:NA
- DESC:Package Init