net-misc/spiped: update initd script and avoid privilege escalation.
authorPatrice Clement <monsieurp@gentoo.org>
Sat, 16 Sep 2017 10:55:34 +0000 (12:55 +0200)
committerPatrice Clement <monsieurp@gentoo.org>
Sat, 16 Sep 2017 10:57:53 +0000 (12:57 +0200)
Gentoo-Bug: https://bugs.gentoo.org/631022

Package-Manager: Portage-2.3.6, Repoman-2.3.1

net-misc/spiped/files/spiped.initd
net-misc/spiped/spiped-1.6.0-r1.ebuild [new file with mode: 0644]

index 0f33ccfa9cdbbe225e5b05d54a53f733ddd5519f..ccc95ac80addb0f5a09914ab80d3b9fd5860ef53 100644 (file)
@@ -1,13 +1,19 @@
 #!/sbin/openrc-run
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-KEYFILE=${KEYFILE:="/etc/spiped/keyfile"}
-SPIPED_USER=${SPIPED_USER:="nobody"}
-PIDFILE="/run/spiped/spiped.pid"
+: ${KEYFILE:="/etc/spiped/keyfile"}
+: ${SPIPED_USER:="nobody"}
 
-command="spiped"
-command_args="${OPTS} -s [${SRCHOST}]:${SRCPORT} -t ${TARGETHOST}:${TARGETPORT} -k ${KEYFILE} -p ${PIDFILE}"
+command="/usr/sbin/spiped"
+command_args="${OPTS}
+       -s [${SRCHOST}]:${SRCPORT}
+       -t ${TARGETHOST}:${TARGETPORT}
+       -k ${KEYFILE}
+       -F"
+command_background="true"
+command_user="${SPIPED_USER}"
+pidfile="/run/${RC_SVCNAME}.pid"
 
 depend() {
        use net
@@ -21,25 +27,6 @@ checkconfig() {
   fi
 }
 
-start() {
+start_pre() {
        checkconfig || return 1
-
-       ebegin "Starting ${SVCNAME}"
-       checkpath -d -o "${SPIPED_USER}" -m750 "$(dirname "${PIDFILE}")"
-
-       start-stop-daemon --start \
-               --user ${SPIPED_USER} \
-               --pidfile ${PIDFILE} \
-               --exec $command -- $command_args
-        
-       eend $?
-}
-
-stop() {
-       ebegin "Stopping ${SVCNAME}"
-        
-       start-stop-daemon --stop \
-               --pidfile ${PIDFILE}
-        
-       eend $?
 }
diff --git a/net-misc/spiped/spiped-1.6.0-r1.ebuild b/net-misc/spiped/spiped-1.6.0-r1.ebuild
new file mode 100644 (file)
index 0000000..ed4c445
--- /dev/null
@@ -0,0 +1,45 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+DESCRIPTION="secure pipe daemon"
+HOMEPAGE="http://www.tarsnap.com/spiped.html"
+SRC_URI="http://www.tarsnap.com/${PN}/${P}.tgz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="libressl"
+
+MY_PN="${PN/d/}"
+
+DEPEND="
+       !libressl? ( dev-libs/openssl:0= )
+       libressl? ( dev-libs/libressl:0= )"
+
+# Blocker added due to #548126
+RDEPEND="
+       ${DEPEND}
+       !net-mail/qlogtools"
+
+src_install() {
+       dobin "${MY_PN}/${MY_PN}"
+       dosbin "${PN}/${PN}"
+
+       doman "${MY_PN}/${MY_PN}.1" "${PN}/${PN}.1"
+
+       newinitd "${FILESDIR}/${PN}.initd" "${PN}"
+       newconfd "${FILESDIR}/${PN}.confd" "${PN}"
+
+       dodir "etc/${PN}"
+}
+
+pkg_postinst() {
+       elog
+       elog "You will need to configure spiped via its"
+       elog "configuration file located in /etc/conf.d/."
+       elog
+       elog "Please have a look at this file prior to starting up spiped!"
+       elog
+}