Package: sasl2-bin
Version: 2.1.22.dfsg1-23+lenny1
Severity: normal

please find a patch to support /etc/init.d/saslauthd status
attached.

it's working for us in a clustered mail server environment
based on lenny without any issue.

i'm currently testing if the patch will also work with squeeze
and sasl2-bin 2.1.23.dfsg1-5. i'll report back.

please apply at least to squeeze asap.

thanks,
raoul
diff -r 31d7e8b9e81f init.d/saslauthd
--- a/init.d/saslauthd	Thu Jul 15 17:45:01 2010 +0200
+++ b/init.d/saslauthd	Thu Jul 15 17:49:20 2010 +0200
@@ -64,6 +64,17 @@
 	done
 }
 
+# Function that sends a SIG0 to all saslauthd instances
+# Parameters: none
+# Return value: none
+do_checkall()
+{
+	for instance in $DEFAULT_FILES
+	do
+		check_instance $instance
+	done
+}
+
 # Function that starts a single saslauthd instance
 # Parameters:
 #	$1 = path of default file for this instance
@@ -252,6 +263,52 @@
 	log_end_msg $?
 }
 
+# Function that sends a SIG0 to a single saslauthd instance
+# Parameters:
+#	$1 = path of default file for this instance
+# Return value:
+#	0 on success (does not mean the daemon was reloaded)
+#	other values on failure
+check_instance()
+{
+	# Load defaults file for this instance.
+	. $1
+
+	# If the short name of this instance is undefined, warn the user
+	# but choose a default name.
+	if [ -z "$NAME" ]; then
+		log_warning_msg "Short name (NAME) undefined in $1, using default"
+		NAME=default
+	fi
+
+	# Determine run directory and pid file location by looking
+	# for an -m option.
+	RUN_DIR=`echo "$OPTIONS" | xargs -n 1 echo | sed -n '/^-m$/{n;p}'`
+	if [ -z "$RUN_DIR" ]; then
+		# No run directory defined in defaults file, fail.
+        log_failure_msg "No run directory defined for $NAME, cannot check"
+		return 2
+	fi
+	PIDFILE=$RUN_DIR/saslauthd.pid
+
+	log_daemon_msg "Checking $DESC" "$NAME"
+
+	# Reload the daemon. First, see if it is already running.
+	start-stop-daemon --start --quiet --pidfile $PIDFILE \
+		--exec $DAEMON --test > /dev/null
+
+	if [ "$?" -eq "0" ]; then
+		# Not running, signal this and stop.
+		log_progress_msg "(not running)"
+		log_end_msg 3
+		return 3
+	fi
+
+	log_progress_msg "(running)"
+	log_end_msg $?
+	return 0
+}
+
 # Function that creates a directory with the specified
 # ownership and permissions
 # Parameters:
@@ -281,6 +338,10 @@
 		do_stopall
 		do_startall
 		;;
+	status)
+		do_checkall
+		exit $?
+		;;
 	start-instance)
 		if [ -f /etc/default/$2 ]; then
 			start_instance /etc/default/$2

Reply via email to