diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2012-01-19 12:08:39 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-01-19 12:08:39 +0000 |
commit | e9382963d309f13507bf14b60a262b33c0c8c0ac (patch) | |
tree | b20e96dd22252b54bb0463bf808a1e015a652f0e /main/openssh | |
parent | 1d6326abef03f8686577541d1f113ad5d59bb193 (diff) | |
download | aports-e9382963d309f13507bf14b60a262b33c0c8c0ac.tar.bz2 aports-e9382963d309f13507bf14b60a262b33c0c8c0ac.tar.xz |
main/openssh: fix init.d script
- properly kill established ssh connections on shutdown
- do not use $opts in init.d script. ref #943
Diffstat (limited to 'main/openssh')
-rw-r--r-- | main/openssh/APKBUILD | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | main/openssh/sshd.initd | 29 |
2 files changed, 17 insertions, 16 deletions
diff --git a/main/openssh/APKBUILD b/main/openssh/APKBUILD index 16b2714a60..17d846c2db 100644 --- a/main/openssh/APKBUILD +++ b/main/openssh/APKBUILD @@ -2,7 +2,7 @@ pkgname=openssh pkgver=5.9_p1 _myver=${pkgver%_*}${pkgver#*_} -pkgrel=0 +pkgrel=1 pkgdesc="Port of OpenBSD's free SSH release" url="http://www.openssh.org/portable.html" arch="all" @@ -89,5 +89,5 @@ client() { md5sums="afe17eee7e98d3b8550cc349834a85d0 openssh-5.9p1.tar.gz f3db05e57e7af4cb2b55b85117652ed3 openssh5.9-dynwindow_noneswitch.diff 949ff348573438163240c60d6c3618eb openssh5.9-peaktput.diff -b35a2df5e951c3d315055332b6572352 sshd.initd +cb0dd08c413fad346f0c594107b4a2e0 sshd.initd b35e9f3829f4cfca07168fcba98749c7 sshd.confd" diff --git a/main/openssh/sshd.initd b/main/openssh/sshd.initd index 35430c5e42..193985b09a 100644..100755 --- a/main/openssh/sshd.initd +++ b/main/openssh/sshd.initd @@ -1,9 +1,10 @@ #!/sbin/runscript # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/files/sshd.rc6.2,v 1.1 2011/01/24 02:55:47 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/files/sshd.rc6.3,v 1.2 2011/09/14 21:46:19 polynomial-c Exp $ -opts="${opts} reload checkconfig gen_keys" +extra_commands="checkconfig gen_keys" +extra_started_commands="reload" depend() { use logger dns @@ -28,7 +29,12 @@ checkconfig() { gen_keys || return 1 - "${SSHD_BINARY}" -t ${myopts} || return 1 + [ "${SSHD_PIDFILE}" != "/var/run/sshd.pid" ] \ + && SSHD_OPTS="${SSHD_OPTS} -o PidFile=${SSHD_PIDFILE}" + [ "${SSHD_CONFDIR}" != "/etc/ssh" ] \ + && SSHD_OPTS="${SSHD_OPTS} -f ${SSHD_CONFDIR}/sshd_config" + + "${SSHD_BINARY}" -t ${SSHD_OPTS} || return 1 } gen_key() { @@ -51,17 +57,12 @@ gen_keys() { } start() { - local myopts="" - [ "${SSHD_PIDFILE}" != "/var/run/sshd.pid" ] \ - && myopts="${myopts} -o PidFile=${SSHD_PIDFILE}" - [ "${SSHD_CONFDIR}" != "/etc/ssh" ] \ - && myopts="${myopts} -f ${SSHD_CONFDIR}/sshd_config" - checkconfig || return 1 + ebegin "Starting ${SVCNAME}" start-stop-daemon --start --exec "${SSHD_BINARY}" \ --pidfile "${SSHD_PIDFILE}" \ - -- ${myopts} ${SSHD_OPTS} + -- ${SSHD_OPTS} eend $? } @@ -76,19 +77,19 @@ stop() { eend $? if [ "$RC_RUNLEVEL" = "shutdown" ]; then - ebegin "Shutting down ssh connections" - _sshd_pids=$(pgrep "${SSHD_BINARY##*/}: .* \[priv]") + _sshd_pids=$(pgrep "${SSHD_BINARY##*/}") if [ -n "$_sshd_pids" ]; then + ebegin "Shutting down ssh connections" kill -TERM $_sshd_pids >/dev/null 2>&1 + eend 0 fi - eend 0 fi } reload() { checkconfig || return 1 ebegin "Reloading ${SVCNAME}" - start-stop-daemon --stop --signal HUP --oknodo \ + start-stop-daemon --signal HUP \ --exec "${SSHD_BINARY}" --pidfile "${SSHD_PIDFILE}" eend $? } |