Package: snmpd
Version: 5.4.3~dfsg-2
Severity: important
Tags: patch

Hello,

The status function of the init script does not test if the daemons are
enabled. In my configuration snmptrapd is disabled
in /etc/default/snmpd.
----
TRAPDRUN=no
----

Which means that in my setup, snmptrapd not running should be normal;
however the init status exits with exit code 3:
----
~# /etc/init.d/snmpd status
snmpd is running.
snmptrapd is not running ... failed!
~# echo $?
3
----

This makes it impossible for applications relying on the init status
exit code to function correctly (e.g. puppet).

I have attached a patch that tests the /etc/default/snmpd values in the
status function; in my case:
----
~# /etc/init.d/snmpd status
snmpd is running.
~# echo $?
0
----

Hope this helps.

Cheers,
 Ignace M
--- /tmp/snmpd  2012-04-12 18:22:31.215540234 +0200
+++ /etc/init.d/snmpd   2012-04-12 18:24:09.809561309 +0200
@@ -90,8 +90,12 @@
     ;;
   status)
     status=0
-    status_of_proc /usr/sbin/snmpd snmpd || status=$?
-    status_of_proc /usr/sbin/snmptrapd snmptrapd || status=$?
+    if [ "$SNMPDRUN" = "yes" ]; then
+        status_of_proc /usr/sbin/snmpd snmpd || status=$?
+    fi
+    if [ "$TRAPDRUN" = "yes" ]; then
+        status_of_proc /usr/sbin/snmptrapd snmptrapd || status=$?
+    fi
     exit $status
     ;;
   *)

Reply via email to