[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#140963: Updated Patch



package ssh
reassign 140963 openssh-server 1:4.6p1-4
thanks

Attached is an updated version of the patch supplied by Vincent
Bernat. I've tested it on my own machine, with and without
sshd_not_to_be_run, and it appears to work correctly.

Phil
--- ssh.init.1:4.6p1-4	2007-07-16 23:02:56.000000000 -0700
+++ ssh.init.new	2007-07-16 23:32:31.000000000 -0700
@@ -28,13 +28,15 @@
 }
 
 check_for_no_start() {
-    # forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
-    if [ -e /etc/ssh/sshd_not_to_be_run ]; then 
-	if [ "$1" = log_end_msg ]; then
+    # Bail if /etc/ssh/sshd_not_to_be_run exists and we're not being forced
+    if [ -e /etc/ssh/sshd_not_to_be_run -a -z "$NOCHECK" ]; then 
+	if [ "$1" = restart ]; then
 	    log_end_msg 0
+	    echo
 	fi
 	if ! run_by_init; then
 	    log_action_msg "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)"
+	    log_action_msg "Use \"force-$1\" instead of \"$1\" if you really want to use it"
 	fi
 	exit 0
     fi
@@ -70,7 +72,7 @@
 
 case "$1" in
   start)
-	check_for_no_start
+	check_for_no_start $1
 	check_dev_null
 	log_daemon_msg "Starting OpenBSD Secure Shell server" "sshd"
 	check_privsep_dir
@@ -89,8 +91,8 @@
 	fi
 	;;
 
-  reload|force-reload)
-	check_for_no_start
+  reload)
+	check_for_no_start $1
 	check_config
 	log_daemon_msg "Reloading OpenBSD Secure Shell server's configuration" "sshd"
 	if start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd; then
@@ -105,7 +107,7 @@
 	check_config
 	log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd"
 	start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/sshd.pid
-	check_for_no_start log_end_msg
+	check_for_no_start $1
 	check_dev_null log_end_msg
 	if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
 	    log_end_msg 0
@@ -125,7 +127,7 @@
 	case $RET in
 	    0)
 		# old daemon stopped
-		check_for_no_start log_end_msg
+		check_for_no_start $1
 		check_dev_null log_end_msg
 		if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
 		    log_end_msg 0
@@ -146,8 +148,13 @@
 	esac
 	;;
 
+  force-*)
+	export NOCHECK=1
+	$0 $(echo "$1" | sed 's/^force-//')
+	;;
+
   *)
-	log_action_msg "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart|try-restart}"
+	log_action_msg "Usage: /etc/init.d/ssh {start|stop|reload|restart|try-restart}"
 	exit 1
 esac
 

Reply to: