From 214927d25baf9d3b8d193248aadeac623d11fcc867a3865ffbea6fc31353523c Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Wed, 6 Jun 2018 14:57:44 +0000 Subject: [PATCH] Accepting request 614590 from home:kstreitova:branches:utilities - add patches from the star package * schily-2018-05-25_star_configuration.patch * schily-2018-05-25_star_no_fsync.patch * schily-2018-05-25_star_lock.patch * schily-2018-05-25_star_detect_gzip_failures.patch * schily-2018-05-25_star_bufferoverflow.patch * schily-2018-05-25_star_use_ssh_by_default.patch * schily-2018-05-25_star_selinux.patch - add missing BuildRequires for star: * autoconf (because of selinux patch) * libacl-devel * libattr-devel * libselinux-devel * libtool - install README-FIRST (as schily-rmt) documentation - add noreplace for %_sysconfdir/default/rmt and %_sysconfdir/default/star - move srmt from sbindir to bindir - do not ship star_sym and suntar OBS-URL: https://build.opensuse.org/request/show/614590 OBS-URL: https://build.opensuse.org/package/show/utilities/schily?expand=0&rev=27 --- README-FIRST | 15 ++ schily-2018-05-25_star_bufferoverflow.patch | 22 ++ schily-2018-05-25_star_configuration.patch | 226 ++++++++++++++++++ ...2018-05-25_star_detect_gzip_failures.patch | 88 +++++++ schily-2018-05-25_star_lock.patch | 48 ++++ schily-2018-05-25_star_mk.patch | 15 ++ schily-2018-05-25_star_no_fsync.patch | 13 + schily-2018-05-25_star_selinux.patch | 224 +++++++++++++++++ ...y-2018-05-25_star_use_ssh_by_default.patch | 13 + schily.changes | 23 ++ schily.spec | 61 ++++- 11 files changed, 735 insertions(+), 13 deletions(-) create mode 100644 README-FIRST create mode 100644 schily-2018-05-25_star_bufferoverflow.patch create mode 100644 schily-2018-05-25_star_configuration.patch create mode 100644 schily-2018-05-25_star_detect_gzip_failures.patch create mode 100644 schily-2018-05-25_star_lock.patch create mode 100644 schily-2018-05-25_star_mk.patch create mode 100644 schily-2018-05-25_star_no_fsync.patch create mode 100644 schily-2018-05-25_star_selinux.patch create mode 100644 schily-2018-05-25_star_use_ssh_by_default.patch diff --git a/README-FIRST b/README-FIRST new file mode 100644 index 0000000..81899c4 --- /dev/null +++ b/README-FIRST @@ -0,0 +1,15 @@ +If you want to use rmt from this package, you have to edit /etc/default/rmt +to configure it. By default, nobody is allowed to run mt (entry USER) and +the only visible target (entry ACCESS) is the null device. + +If you would like to have an account to directly access rmt, you will have +to create one yourself, setting the default shell to /usr/sbin/rmt. Please +don't forget to add entries to .rhosts in the home directory of said account +for all remote users that are allowed to use this account. + +The creation of this account may be done either via YaST2 or via useradd. +An example for using useradd would be: + + useradd -c "Remote TAPE" -G bin -s /usr/sbin/rmt rtape + +After creating this account, you have to add this user to /etc/default/rmt. diff --git a/schily-2018-05-25_star_bufferoverflow.patch b/schily-2018-05-25_star_bufferoverflow.patch new file mode 100644 index 0000000..ca81aa5 --- /dev/null +++ b/schily-2018-05-25_star_bufferoverflow.patch @@ -0,0 +1,22 @@ +Index: schily-2018-05-25/star/longnames.c +=================================================================== +--- schily-2018-05-25.orig/star/longnames.c ++++ schily-2018-05-25/star/longnames.c +@@ -167,7 +167,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); + } + +@@ -210,7 +210,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); diff --git a/schily-2018-05-25_star_configuration.patch b/schily-2018-05-25_star_configuration.patch new file mode 100644 index 0000000..c67cb06 --- /dev/null +++ b/schily-2018-05-25_star_configuration.patch @@ -0,0 +1,226 @@ +Index: schily-2018-05-25/DEFAULTS/Defaults.linux +=================================================================== +--- schily-2018-05-25.orig/DEFAULTS/Defaults.linux ++++ schily-2018-05-25/DEFAULTS/Defaults.linux +@@ -26,7 +25,7 @@ DEFLINKMODE= static + # If the next line is uncommented, compilation is done with minimal warnings + # + ########################################################################### +-CWARNOPTS= ++#CWARNOPTS= + + ########################################################################### + # +@@ -41,9 +40,8 @@ LINUX_SRC_INCLUDE= $(__LINUX_SRC_IN + + DEFINCDIRS= $(SRCROOT)/include + DEFOSINCDIRS= +-LDPATH= -L/opt/schily/lib +-#RUNPATH= -R$(INS_BASE)/lib -R/opt/schily/lib -R$(OLIBSDIR) +-RUNPATH= -R$(INS_BASE)/lib -R/opt/schily/lib ++LDPATH= -L/usr/lib ++RUNPATH= + + ########################################################################### + # +@@ -57,13 +55,13 @@ OSDEFS += -D_GNU_SOURCE + # Installation config stuff + # + ########################################################################### +-INS_BASE= /opt/schily ++INS_BASE= /usr + INS_KBASE= / + INS_RBASE= / + # + DEFUMASK= 002 + # +-DEFINSMODEF= 444 ++DEFINSMODEF= 644 + DEFINSMODEX= 755 + DEFINSUSR= root + DEFINSGRP= bin +Index: schily-2018-05-25/include/schily/schily.h +=================================================================== +--- schily-2018-05-25.orig/include/schily/schily.h ++++ schily-2018-05-25/include/schily/schily.h +@@ -377,7 +377,7 @@ extern int _comerr __PR((FILE *, int, i + #endif + + /*PRINTFLIKE1*/ +-extern int error __PR((const char *, ...)) __printflike__(1, 2); ++extern int error __PR((const char *, ...)); + #ifdef FOUND_SIZE_T + extern char *fillbytes __PR((void *, ssize_t, char)); + extern char *zerobytes __PR((void *, ssize_t)); +Index: schily-2018-05-25/mt/Makefile +=================================================================== +--- schily-2018-05-25.orig/mt/Makefile ++++ schily-2018-05-25/mt/Makefile +@@ -7,7 +7,7 @@ include $(SRCROOT)/$(RULESDIR)/rules.to + + INSDIR= bin + TARGET= smt +-SYMLINKS= mt ++#SYMLINKS= mt + CPPOPTS += -DUSE_REMOTE + CPPOPTS += -DSCHILY_PRINT + +@@ -17,7 +17,7 @@ CFILES= mt.c + # LIB_CAP is needed for Linux capability support in librmt. + # + LIBS= -lrmt -lschily $(LIB_SOCKET) $(LIB_CAP) +-XMK_FILE= Makefile.man mt.mk1 ++XMK_FILE= Makefile.man + + ########################################################################### + include $(SRCROOT)/$(RULESDIR)/rules.cmd +Index: schily-2018-05-25/rmt/rmt.1 +=================================================================== +--- schily-2018-05-25.orig/rmt/rmt.1 ++++ schily-2018-05-25/rmt/rmt.1 +@@ -17,9 +17,8 @@ + .SH NAME + rmt \- remote magnetic tape protocol server + .SH SYNOPSIS +-.B /opt/schily/sbin/rmt + .br +-.B /etc/rmt ++.B /usr/bin/rmt + + .SH DESCRIPTION + .IX "rmt command" "" "\fLrmt\fP \(em remote magnetic tape protocol server" +Index: schily-2018-05-25/rmt/rmt.dfl +=================================================================== +--- schily-2018-05-25.orig/rmt/rmt.dfl ++++ schily-2018-05-25/rmt/rmt.dfl +@@ -18,15 +18,13 @@ + # Each USER= entry adds the listed user to the users who may run rmt + # + # A typical passwd entry looks like this: +-# rtape:x:1999:1000:Remote TAPE:/export/home/rtape:/opt/schily/sbin/rmt ++# rtape:x:1999:1000:Remote TAPE:/home/tape:/usr/sbin/rmt + # +-# Add entries for all valid remote users to /export/home/rtape/.rhosts ++# Add entries for all valid remote users to: ++# /home/tape/.rhosts + # + #USER=rtape +-#USER=joerg +-# Default to old SunOS behavior. If you like to be more restrictive, comment +-# out the entry below and enable the explicit USER= entries above. +-USER=* ++#USER=* + + # + # Each ACCESS= entry adds a target or group of targets to the list of visible +@@ -43,8 +41,8 @@ USER=* + # user host file + # name name + # +-#ACCESS=rtape sparky /dev/rmt/* +-ACCESS=* * /dev/rmt/* ++#ACCESS=rtape sparky /dev/st0 ++#ACCESS=* * /dev/nst* + ACCESS=* * /dev/null +-ACCESS=* * /dev/zero ++#ACCESS=* * /dev/zero + #ACCESS=* * * +Index: schily-2018-05-25/rmt/Makefile +=================================================================== +--- schily-2018-05-25.orig/rmt/Makefile ++++ schily-2018-05-25/rmt/Makefile +@@ -5,8 +5,8 @@ RULESDIR= RULES + include $(SRCROOT)/$(RULESDIR)/rules.top + ########################################################################### + +-INSDIR= sbin +-TARGET= rmt ++INSDIR= bin ++TARGET= srmt + CPPOPTS += -DUSE_REMOTE + CPPOPTS += -DUSE_LARGEFILES + CFILES= rmt.c +Index: schily-2018-05-25/rmt/Makefile.man +=================================================================== +--- schily-2018-05-25.orig/rmt/Makefile.man ++++ schily-2018-05-25/rmt/Makefile.man +@@ -8,7 +8,7 @@ include $(SRCROOT)/$(RULESDIR)/rules.to + ########################################################################### + + MANDIR= man +-TARGETMAN= rmt ++TARGETMAN= srmt + MANSECT= $(MANSECT_CMD) + MANSUFFIX= $(MANSUFF_CMD) + MANFILE= rmt.1 +Index: schily-2018-05-25/star/all.mk +=================================================================== +--- schily-2018-05-25.orig/star/all.mk ++++ schily-2018-05-25/star/all.mk +@@ -12,7 +12,7 @@ include $(SRCROOT)/$(RULESDIR)/rules.to + # 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 Makefile.dfl + + ########################################################################### + include $(SRCROOT)/$(RULESDIR)/rules.mks +Index: schily-2018-05-25/star/pax.mk +=================================================================== +--- schily-2018-05-25.orig/star/pax.mk ++++ schily-2018-05-25/star/pax.mk +@@ -8,7 +8,7 @@ include $(SRCROOT)/$(RULESDIR)/rules.to + + INSDIR= bin + TARGET= spax +-#SYMLINKS= ustar tar ++SYMLINKS= pax + CPPOPTS += -D__STAR__ + CPPOPTS += -DSET_CTIME -DFIFO -DUSE_MMAP -DUSE_REMOTE -DUSE_RCMD_RSH + #CPPOPTS += -DSET_CTIME -DFIFO -DUSE_MMAP +Index: schily-2018-05-25/star/star.mk +=================================================================== +--- schily-2018-05-25.orig/star/star.mk ++++ schily-2018-05-25/star/star.mk +@@ -8,7 +8,7 @@ include $(SRCROOT)/$(RULESDIR)/rules.to + + INSDIR= bin + TARGET= star +-SYMLINKS= ustar tar ++SYMLINKS= ustar + CPPOPTS += -D__STAR__ + CPPOPTS += -DSET_CTIME -DFIFO -DUSE_MMAP -DUSE_REMOTE -DUSE_RCMD_RSH + #CPPOPTS += -DSET_CTIME -DFIFO -DUSE_MMAP +@@ -23,6 +23,7 @@ CPPOPTS += -DCOPY_LINKS_DELAYED + CPPOPTS += -DUSE_NLS + CPPOPTS += -DTEXT_DOMAIN=\"SCHILY_utils\" + 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 \ +@@ -37,8 +38,8 @@ CFILES= star.c header.c cpiohdr.c xhead + 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) +-XMK_FILE= Makefile.man starformatman.mk ++LIBS= -ldeflt -lrmt -lfind -lschily $(LIB_ACL) $(LIB_ATTR) $(LIB_SOCKET) $(LIB_INTL) $(LIB_SELINUX) ++XMK_FILE= Makefile.man + + ########################################################################### + include $(SRCROOT)/$(RULESDIR)/rules.cmd +Index: schily-2018-05-25/man/Makefile +=================================================================== +--- schily-2018-05-25.orig/man/Makefile ++++ schily-2018-05-25/man/Makefile +@@ -7,7 +7,7 @@ RULESDIR= RULES + include $(SRCROOT)/$(RULESDIR)/rules.top + ########################################################################### + +-DIRS= man4 ++DIRS= man1 + + ########################################################################### + include $(SRCROOT)/$(RULESDIR)/rules.dir diff --git a/schily-2018-05-25_star_detect_gzip_failures.patch b/schily-2018-05-25_star_detect_gzip_failures.patch new file mode 100644 index 0000000..86fd15c --- /dev/null +++ b/schily-2018-05-25_star_detect_gzip_failures.patch @@ -0,0 +1,88 @@ +Index: schily-2018-05-25/star/buffer.c +=================================================================== +--- schily-2018-05-25.orig/star/buffer.c ++++ schily-2018-05-25/star/buffer.c +@@ -1804,6 +1804,10 @@ checkerrs() + errmsgno(EX_BAD, "Problems with restore database.\n"); + return (TRUE); + } ++ if (xstats.s_comprerrs > 0) { ++ errmsgno(EX_BAD, "Compress program returned error[%d].\n", xstats.s_comprerrs); ++ return (TRUE); ++ } + return (FALSE); + } + +@@ -1879,6 +1883,16 @@ die(err) + excomerrno(err, "Cannot recover from error - exiting.\n"); + } + ++void sigchld_handler(int sig) ++{ ++ int status; ++ pid_t pid; ++ while ((pid = wait4(compresspid, &status, 0, NULL)) > 0) { ++ if (pid == compresspid) ++ xstats.s_comprerrs = WEXITSTATUS(status); ++ } ++ ++} + /* + * Quick hack to implement a -z flag. May be changed soon. + */ +@@ -1894,6 +1908,8 @@ compressopen() + int mypid; + char *zip_prog = "gzip"; + ++ compresspid = 0; ++ + if (compress_prg) + zip_prog = compress_prg; + else if (bzflag) +@@ -1957,6 +1973,7 @@ compressopen() + #else + if (fpipe(pp) == 0) + comerr("Compress pipe failed\n"); ++ signal(SIGCHLD, sigchld_handler); + mypid = fork(); + if (mypid < 0) + comerr("Compress fork failed\n"); +@@ -1986,7 +2003,10 @@ compressopen() + fexecl(zip_prog, tarf, pp[1], null, zip_prog, "-d", (char *)NULL); + errmsg("Compress: exec of '%s' failed\n", zip_prog); + _exit(-1); ++ } else { ++ compresspid = mypid; + } ++ + fclose(tarf); + if (cflag) { + tarf = pp[1]; +Index: schily-2018-05-25/star/star.c +=================================================================== +--- schily-2018-05-25.orig/star/star.c ++++ schily-2018-05-25/star/star.c +@@ -117,6 +117,7 @@ char strvers[] = "1.5.4"; /* The pure v + char *vers; /* the full version string */ + + struct star_stats xstats; /* for printing statistics */ ++pid_t compresspid = 0; + + extern BOOL havepat; /* Pattern matching in use */ + +Index: schily-2018-05-25/star/star.h +=================================================================== +--- schily-2018-05-25.orig/star/star.h ++++ schily-2018-05-25/star/star.h +@@ -870,9 +870,11 @@ struct star_stats { + int s_setxattr; /* set xattr for file failed */ + #endif + int s_restore; /* other incremental restore specific */ ++ int s_comprerrs; /* errors of compress-subprogram */ + }; + + extern struct star_stats xstats; ++extern pid_t compresspid; /* pid of compress-subprogram child */ + + + #include diff --git a/schily-2018-05-25_star_lock.patch b/schily-2018-05-25_star_lock.patch new file mode 100644 index 0000000..24f21d6 --- /dev/null +++ b/schily-2018-05-25_star_lock.patch @@ -0,0 +1,48 @@ +Index: schily-2018-05-25/star/fifo.c +=================================================================== +--- schily-2018-05-25.orig/star/fifo.c ++++ schily-2018-05-25/star/fifo.c +@@ -487,13 +487,42 @@ LOCAL int + swait(f) + int f; + { +- int ret; ++ int ret, err; + unsigned char c; ++ struct flock lock; ++ useconds_t wait; ++ ++ wait = 500000; ++ lock.l_type = F_RDLCK; ++ lock.l_whence = SEEK_CUR; ++ lock.l_start = 0; ++ lock.l_len = 0; ++ do { ++ err = fcntl(f, F_SETLK, &lock); ++ if (err < 0) { ++ err = geterrno(); ++ if (err == EINTR) ++ continue; ++ if ((err == EACCES || err == EAGAIN) && (wait > 0)) { ++ usleep(10000); ++ wait -= 10000; ++ continue; ++ } ++ errmsg("Can not get lock on semaphore wait for file descriptor\n"); ++ exprstats(-1); ++ } ++ } while (0); + + seterrno(0); + do { + ret = read(f, &c, 1); + } while (ret < 0 && geterrno() == EINTR); ++ ++ lock.l_type = F_UNLCK; ++ do { ++ err = fcntl(f, F_SETLK, &lock); ++ } while (err < 0 && geterrno() == EINTR); ++ + if (ret < 0 || (ret == 0 && pid)) { + /* + * If pid != 0, this is the foreground process diff --git a/schily-2018-05-25_star_mk.patch b/schily-2018-05-25_star_mk.patch new file mode 100644 index 0000000..6ed61de --- /dev/null +++ b/schily-2018-05-25_star_mk.patch @@ -0,0 +1,15 @@ +Index: schily-2018-05-25/star/star.mk +=================================================================== +--- schily-2018-05-25.orig/star/star.mk ++++ schily-2018-05-25/star/star.mk +@@ -37,8 +37,8 @@ CFILES= star.c header.c cpiohdr.c xhead + 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 + + ########################################################################### diff --git a/schily-2018-05-25_star_no_fsync.patch b/schily-2018-05-25_star_no_fsync.patch new file mode 100644 index 0000000..cf4b138 --- /dev/null +++ b/schily-2018-05-25_star_no_fsync.patch @@ -0,0 +1,13 @@ +Index: schily-2018-05-25/star/star.c +=================================================================== +--- schily-2018-05-25.orig/star/star.c ++++ schily-2018-05-25/star/star.c +@@ -193,7 +193,7 @@ int verbose = 0; /* -v has been spec + BOOL silent = FALSE; /* -silent no informal msg */ + BOOL prblockno = FALSE; /* -block-number for all files */ + BOOL no_xheader = FALSE; /* -no-xheader ignore P.2001 */ +-BOOL no_fsync = FALSE; /* -no-fsync on extract */ ++BOOL no_fsync = TRUE; /* -no-fsync on extract */ + BOOL readnull = FALSE; /* -read0 on with list= */ + BOOL tpath = FALSE; /* -tpath print path only */ + BOOL cflag = FALSE; /* -c has been specified */ diff --git a/schily-2018-05-25_star_selinux.patch b/schily-2018-05-25_star_selinux.patch new file mode 100644 index 0000000..d17584a --- /dev/null +++ b/schily-2018-05-25_star_selinux.patch @@ -0,0 +1,224 @@ +Index: schily-2018-05-25/autoconf/rules.cnf.in +=================================================================== +--- schily-2018-05-25.orig/autoconf/rules.cnf.in ++++ schily-2018-05-25/autoconf/rules.cnf.in +@@ -38,6 +38,7 @@ LIB_GEN= @lib_gen@ + LIB_ELF= @lib_elf@ + LIB_PTHREAD= @lib_pthread@ + LIB_RT= @lib_rt@ ++LIB_SELINUX = @lib_selinux@ + LIB_DL= @lib_dl@ + LIB_DIR= @lib_dir@ + LIB_CAP= @lib_cap@ +Index: schily-2018-05-25/star/cpio.mk +=================================================================== +--- schily-2018-05-25.orig/star/cpio.mk ++++ schily-2018-05-25/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 xhead + 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 + + ########################################################################### +Index: schily-2018-05-25/star/extract.c +=================================================================== +--- schily-2018-05-25.orig/star/extract.c ++++ schily-2018-05-25/star/extract.c +@@ -261,6 +261,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; +Index: schily-2018-05-25/star/gnutar.mk +=================================================================== +--- schily-2018-05-25.orig/star/gnutar.mk ++++ schily-2018-05-25/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 xhe + 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 + + ########################################################################### +Index: schily-2018-05-25/star/pax.mk +=================================================================== +--- schily-2018-05-25.orig/star/pax.mk ++++ schily-2018-05-25/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 xheade + 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 + + ########################################################################### +Index: schily-2018-05-25/star/star.c +=================================================================== +--- schily-2018-05-25.orig/star/star.c ++++ schily-2018-05-25/star/star.c +@@ -51,6 +51,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)); +@@ -443,6 +447,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. +Index: schily-2018-05-25/star/star_fat.mk +=================================================================== +--- schily-2018-05-25.orig/star/star_fat.mk ++++ schily-2018-05-25/star/star_fat.mk +@@ -33,6 +33,7 @@ CPPOPTS += -DUSE_ICONV # Use iconv() fo + CPPOPTS += -DUSE_NLS # Include locale support + CPPOPTS += -DTEXT_DOMAIN=\"SCHILY_utils\" + 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 \ +@@ -55,7 +56,7 @@ HFILES= star.h starsubs.h dirtime.h xta + # + # LIB_CAP is needed for Linux capability support in librmt. + # +-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) + # + # Wenn -lfind, dann auch $(LIB_INTL) + # +Index: schily-2018-05-25/star/starsubs.h +=================================================================== +--- schily-2018-05-25.orig/star/starsubs.h ++++ schily-2018-05-25/star/starsubs.h +@@ -322,6 +322,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 ++extern BOOL setselinux __PR((register FINFO *info)); ++extern int selinux_enabled; ++# endif + #endif + + /* +Index: schily-2018-05-25/star/suntar.mk +=================================================================== +--- schily-2018-05-25.orig/star/suntar.mk ++++ schily-2018-05-25/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 xhe + 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 + + ########################################################################### +Index: schily-2018-05-25/star/xattr.c +=================================================================== +--- schily-2018-05-25.orig/star/xattr.c ++++ schily-2018-05-25/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_xflags & XF_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)) { diff --git a/schily-2018-05-25_star_use_ssh_by_default.patch b/schily-2018-05-25_star_use_ssh_by_default.patch new file mode 100644 index 0000000..087778d --- /dev/null +++ b/schily-2018-05-25_star_use_ssh_by_default.patch @@ -0,0 +1,13 @@ +Index: schily-2018-05-25/librmt/remote.c +=================================================================== +--- schily-2018-05-25.orig/librmt/remote.c ++++ schily-2018-05-25/librmt/remote.c +@@ -1464,7 +1464,7 @@ _rcmdrsh(ahost, inport, locuser, remuser + int pid; + + if (rsh == 0) +- rsh = "rsh"; ++ rsh = "ssh"; + + /* + * Verify that 'locuser' is present on local host. diff --git a/schily.changes b/schily.changes index ce65ac5..324198b 100644 --- a/schily.changes +++ b/schily.changes @@ -1,3 +1,26 @@ +------------------------------------------------------------------- +Tue Jun 5 08:21:16 UTC 2018 - kstreitova@suse.com + +- add patches from the star package + * schily-2018-05-25_star_configuration.patch + * schily-2018-05-25_star_no_fsync.patch + * schily-2018-05-25_star_lock.patch + * schily-2018-05-25_star_detect_gzip_failures.patch + * schily-2018-05-25_star_bufferoverflow.patch + * schily-2018-05-25_star_use_ssh_by_default.patch + * schily-2018-05-25_star_selinux.patch +- add missing BuildRequires for star: + * autoconf (because of selinux patch) + * libacl-devel + * libattr-devel + * libselinux-devel + * libtool +- install README-FIRST (as schily-rmt) documentation +- add noreplace for %_sysconfdir/default/rmt and + %_sysconfdir/default/star +- move srmt from sbindir to bindir +- do not ship star_sym and suntar + ------------------------------------------------------------------- Mon May 28 12:20:09 UTC 2018 - jengelh@inai.de diff --git a/schily.spec b/schily.spec index 926c648..e6825c8 100644 --- a/schily.spec +++ b/schily.spec @@ -33,13 +33,35 @@ Url: http://cdrtools.sourceforge.net/private/cdrecord.html #Freshcode-Url: http://freshcode.club/projects/schily Source: https://downloads.sf.net/schilytools/%name-%rver.tar.bz2 +Source1: README-FIRST Patch1: iconv-name.diff +# PATCH-FIX-SUSE: some default values for configuration/compilation +Patch2: schily-2018-05-25_star_configuration.patch +# PATCH-FIX-SUSE: [bnc#97500] do not run FSYNC by default +Patch3: schily-2018-05-25_star_no_fsync.patch +# PATCH-FIX-SUSE: [bnc#414251] set read lock before using the semaphore wait on a pipe fd to avoid deadlock +Patch4: schily-2018-05-25_star_lock.patch +# PATCH-FIX-UPSTREAM: [bnc#858660] detect gzip failures +Patch5: schily-2018-05-25_star_detect_gzip_failures.patch +# PATCH-FIX-UPSTREAM: [bnc#625527] fix bufferoverflow +Patch6: schily-2018-05-25_star_bufferoverflow.patch +# PATCH-FIX-SUSE: use ssh as adefault remote access method +Patch7: schily-2018-05-25_star_use_ssh_by_default.patch +# PATCH-FIX-UPSTREAM: Fix broken star.mk in 1.5.3 (included from all.mk) +Patch8: schily-2018-05-25_star_mk.patch +# PATCH-FIX-UPSTREAM: Implement selinux +Patch9: schily-2018-05-25_star_selinux.patch # Honor https://en.opensuse.org/openSUSE:Packaging_Patches_guidelines#Upstream_policy # and submit patches upstream FIRST (cc to the bspkg maintainer perhaps). BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: autoconf BuildRequires: fdupes BuildRequires: gcc-c++ +BuildRequires: libacl-devel +BuildRequires: libattr-devel BuildRequires: libcap-devel +BuildRequires: libselinux-devel +BuildRequires: libtool BuildRequires: makedepend Conflicts: cdrkit-cdrtools-compat @@ -351,7 +373,7 @@ Group: Productivity/Archiving/Backup Conflicts: dump-rmt Conflicts: tar-rmt Obsoletes: star-rmt -Provides: star-rmt:/usr/sbin/srmt +Provides: star-rmt:/usr/bin/srmt Requires(post): update-alternatives Requires(postun): update-alternatives @@ -400,8 +422,18 @@ Features: %prep %setup -qn %name-%rver %patch -P 1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 find . "(" -type d -o -type f ")" -exec chmod u+w "{}" "+" +cp %{SOURCE1} . + %build perl -i -pe 's{\@echo}{echo}' RULES/cc-* # Static link libhfs, only used by mkisofs. @@ -433,10 +465,13 @@ if test "%_lib" != lib; then fi find "$b/%_libdir" -type f -name "*.a" -delete find "$b/%_libdir" -type f -name "*.so.*" -exec chmod a+x "{}" "+" + +# Install documentation mkdir -p "%_docdir" for i in "$b/%_datadir/doc"/*; do test "$i" != "$b/%_docdir" && mv "$i" "$b/%_docdir/" done +install -D -m 644 %{SOURCE1} %{buildroot}%{_docdir}/schily-rmt # bosh mv -fv "$b/%_bindir/sh" "$b/%_bindir/bosh" @@ -463,12 +498,15 @@ rm -Rfv "$b/%_datadir/lib/siconv" ln -sfv spax "$b/%_bindir/pax" rm -fv "$b/%_bindir/tar" "$b/%_bindir/gnutar" +# Do not ship star_sym and suntar +rm -fv "$b/%_bindir/star_sym" +rm -fv "$b/%_bindir/suntar" +rm -fv "$b/%_mandir/man1/star_sym.1" +rm -fv "$b/%_mandir/man1/suntar.1" + # mt/rmt rm -fv "$b/%_bindir/mt" # handled up u-a ls -l "$b/%_mandir"/man*/*mt* -mv "$b/%_mandir/man1/mt.1" "$b/%_mandir/man1/smt.1" -mv "$b/%_sbindir/rmt" "$b/%_sbindir/srmt" # make room for u-a -mv "$b/%_mandir/man1/rmt.1" "$b/%_mandir/man1/srmt.1" # get rid of things that upset rpmlint find "$b/usr/share/doc" -type f -name "*big*" -print -delete @@ -662,12 +700,12 @@ fi %post rmt "%_sbindir/update-alternatives" \ - --install "%_sbindir/rmt" rmt "%_sbindir/srmt" 10 \ + --install "%_bindir/rmt" rmt "%_bindir/srmt" 10 \ --slave "%_mandir/man8/rmt.1%ext_man" "rmt.1%ext_man" "%_mandir/man8/srmt.1%ext_man" %postun rmt if test "$1" = 0; then - "%_sbindir/update-alternatives" --remove rmt "%_sbindir/srmt" + "%_sbindir/update-alternatives" --remove rmt "%_bindir/srmt" fi %post -n libcdrdeflt1_0 -p /sbin/ldconfig @@ -927,9 +965,10 @@ fi %files -n schily-rmt %license CDDL.Schily.txt -%config %_sysconfdir/default/rmt +%{_docdir}/schily-rmt +%config(noreplace) %_sysconfdir/default/rmt %_docdir/rmt/ -%_sbindir/srmt +%_bindir/srmt %_mandir/man1/srmt.1* %ghost %_sysconfdir/alternatives/rmt %ghost %_sysconfdir/alternatives/rmt.1%ext_man @@ -943,16 +982,12 @@ fi %files -n star %license CDDL.Schily.txt -%config %_sysconfdir/default/star +%config(noreplace) %_sysconfdir/default/star %_bindir/star -%_bindir/star_sym -%_bindir/suntar %_bindir/tartest %_bindir/ustar %_docdir/star/ %_mandir/man1/star.1* -%_mandir/man1/star_sym.1* -%_mandir/man1/suntar.1* %_mandir/man1/ustar.1* %_mandir/man5/star.5*