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/sshd.initd | |
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/sshd.initd')
-rwxr-xr-x[-rw-r--r--] | main/openssh/sshd.initd | 29 |
1 files changed, 15 insertions, 14 deletions
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 $? } |