Package: snmpd
Version: 5.4.1~dfsg-12
Severity: normal
Tags: patch

I want to use snmp to remotely reboot machine. I have found advice to use
exec/execfix pair to do this.

Entry in snmpd.conf:
...
exec    reboot /usr/bin/uptime
execFix reboot /root/bin/reboot

And command:
snmpset -v 2c -c secret host UCD-SNMP-MIB::extErrFix.1 i 1


This does not work - snmpd writes this error message to log:
/etc/snmp/snmpd.conf: line 92: Error: No matching exec entry

Problem is in source - "Fix" suffix is added to name of execFix directive and
then it is searched for complementary exec entry. Attached is patch, that
removes this suffix, when it is no longer needed.


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.26
Locale: LANG=cs_CZ.UTF-8, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages snmpd depends on:
ii  libc6                         2.9-4      GNU C Library: Shared libraries
pn  libsnmp5                      <none>     (no description available)
pn  libssl0.9.7                   <none>     (no description available)
ii  libwrap0                      7.6.q-16   Wietse Venema's TCP wrappers libra

snmpd recommends no packages.

snmpd suggests no packages.

-- 
Jezz
mail:   j...@hkfree.org
jabber: j...@njs.netlab.cz
--- net-snmp-5.4.1~dfsg.orig/agent/mibgroup/agent/extend.c
+++ net-snmp-5.4.1~dfsg/agent/mibgroup/agent/extend.c
@@ -458,6 +458,9 @@
      */
     if (!strcmp( token, "execFix"  )) {
         int  i;
+        /* Fix suffix must be stripped from exec_name - no longer needed. */
+        int name_len = strlen(exec_name);
+        exec_name[name_len-3] = '\0';
         for ( i=0; i < num_compatability_entries; i++ ) {
             if (!strcmp( exec_name,
                     compatability_entries[i].exec_entry->token))

Attachment: signature.asc
Description: Digital signature

Reply via email to