Subject: Support restarting only selected stunnel instances.
Author: Peter Palfrader <weasel@debian.org>
Bug-Debian: http://bugs.debian.org/627765

Index: stunnel4/tools/stunnel.init.in
===================================================================
--- stunnel4.orig/tools/stunnel.init.in
+++ stunnel4/tools/stunnel.init.in
@@ -14,7 +14,6 @@
 DAEMON=@prefix@/bin/stunnel4
 NAME=stunnel
 DESC="SSL tunnels"
-FILES="/etc/stunnel/*.conf"
 OPTIONS=""
 ENABLED=0
 
@@ -76,6 +75,22 @@
   exit 0
 fi
 
+# If the user want to manage a single tunnel, the conf file's name
+# is in $2. Otherwise, respect /etc/default/stunnel4 setting. If no
+# setting there, use /etc/stunnel/*.conf
+if [ -n "${2:-}" ]; then
+  if [ -e "/etc/stunnel/$2.conf" ]; then
+    FILES="/etc/stunnel/$2.conf"
+  else
+    echo >&2 "/etc/stunnel/$2.conf does not exist."
+    exit 1
+  fi
+else
+  if [ -z "$FILES" ]; then
+    FILES="/etc/stunnel/*.conf"
+  fi
+fi
+
 test -x $DAEMON || exit 0
 
 set -e
@@ -110,7 +125,7 @@
         ;;
   *)
         N=/etc/init.d/$NAME
-        echo "Usage: $N {start|stop|reload|reopen-logs|restart}" >&2
+        echo "Usage: $N {start|stop|reload|reopen-logs|restart} [<stunnel instance>]" >&2
         exit 1
         ;;
 esac
