openssh/openssh-4.3p2-initscript.patch

69 lines
1.6 KiB
Diff
Raw Normal View History

--- openssh-4.5p1/contrib/redhat/sshd.init.initscript 2006-04-22 13:26:08.000000000 +0200
+++ openssh-4.5p1/contrib/redhat/sshd.init 2007-07-25 18:26:50.000000000 +0200
@@ -29,6 +29,8 @@
DSA_KEY=/etc/ssh/ssh_host_dsa_key
PID_FILE=/var/run/sshd.pid
+runlevel=$(set -- $(runlevel); eval "echo \$$#" )
+
do_rsa1_keygen() {
if [ ! -s $RSA1_KEY ]; then
echo -n $"Generating SSH1 RSA host key: "
@@ -99,12 +101,16 @@
start()
{
# Create keys if necessary
- do_rsa1_keygen
- do_rsa_keygen
- do_dsa_keygen
+ if [ "x${AUTOCREATE_SERVER_KEYS}" != xNO ]; then
+ do_rsa1_keygen
+ do_rsa_keygen
+ do_dsa_keygen
+ fi
+
+ cp -af /etc/localtime /var/empty/sshd/etc
- echo -n $"Starting $prog:"
- initlog -c "$SSHD $OPTIONS" && success || failure
+ echo -n $"Starting $prog: "
+ $SSHD $OPTIONS && success || failure
RETVAL=$?
[ "$RETVAL" = 0 ] && touch /var/lock/subsys/sshd
echo
@@ -112,17 +118,30 @@
stop()
{
- echo -n $"Stopping $prog:"
- killproc $SSHD -TERM
+ echo -n $"Stopping $prog: "
+ if [ -n "`pidfileofproc $SSHD`" ] ; then
+ killproc $SSHD
+ else
+ failure $"Stopping $prog"
+ fi
RETVAL=$?
+ # if we are in halt or reboot runlevel kill all running sessions
+ # so the TCP connections are closed cleanly
+ if [ "x$runlevel" = x0 -o "x$runlevel" = x6 ] ; then
+ killall $prog 2>/dev/null
+ fi
[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/sshd
echo
}
reload()
{
- echo -n $"Reloading $prog:"
- killproc $SSHD -HUP
+ echo -n $"Reloading $prog: "
+ if [ -n "`pidfileofproc $SSHD`" ] ; then
+ killproc $SSHD -HUP
+ else
+ failure $"Reloading $prog"
+ fi
RETVAL=$?
echo
}