[Nagiosplug-devel] [ nagiosplug-Patches-3386170 ] check_snmp: fix for unit and label parameters on 64bit

SourceForge.net noreply at sourceforge.net
Thu Aug 4 14:53:01 CEST 2011


Patches item #3386170, was opened at 2011-08-04 14:53
Message generated for change (Tracker Item Submitted) made by mampfred
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=3386170&group_id=29880

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Bugfix
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Martin Rohrbach (mampfred)
Assigned to: Nobody/Anonymous (nobody)
Summary: check_snmp: fix for unit and label parameters on 64bit

Initial Comment:
Patch against Plugin Version (-V output): v1.4.15 (nagios-plugins 1.4.15)
Plugin Name: check_snmp
Example Plugin Commandline: -u a,b,c,d,e (see below)
Tested on operating system: SLES 11 SP 1 (Linux 2.6.32.29-0.3-default #1 SMP 2011-02-25 13:36:59 +0100 x86_64 x86_64 x86_64 GNU/Linux)
Tested on architecture: x86_64
Tested with compiler: gcc

When parising the -u and -l parameters, the alloc is done without using sizeof(char *). This corrupts the stack whenever there's more than 4 paremeters to either of the parameters as you can see in the test output below where the "SNMP" is garbled. The patch fixes this for both parameters and renames one of the helper functions to a sensible name (thisarg => trimstring).

bash# ./check_snmp -V
check_snmp v1.4.15 (nagios-plugins 1.4.15)
bash# uname -a
Linux kobarid 2.6.32.29-0.3-default #1 SMP 2011-02-25 13:36:59 +0100 x86_64 x86_64 x86_64 GNU/Linux

Garbled "SNMP" string before fix (last line):

bash# ./check_snmp -H mary.unix.db.de -C nasfiler -o .1.3.6.1.4.1.789.1.2.2.4.0,.1.3.6.1.4.1.789.1.2.2.4.0,.1.3.6.1.4.1.789.1.2.2.4.0,.1.3.6.1.4.1.789.1.2.2.4.0,.1.3.6.1.4.1.789.1.2.2.4.0 -v -v -v -u a,b,c,d,e
/usr/bin/snmpget -t 1 -r 5 -m '' -v 1 [authpriv] mary.unix.db.de:161 .1.3.6.1.4.1.789.1.2.2.4.0 .1.3.6.1.4.1.789.1.2.2.4.0 .1.3.6.1.4.1.789.1.2.2.4.0 .1.3.6.1.4.1.789.1.2.2.4.0 .1.3.6.1.4.1.789.1.2.2.4.0
iso.3.6.1.4.1.789.1.2.2.4.0 = INTEGER: 3
iso.3.6.1.4.1.789.1.2.2.4.0 = INTEGER: 3
iso.3.6.1.4.1.789.1.2.2.4.0 = INTEGER: 3
iso.3.6.1.4.1.789.1.2.2.4.0 = INTEGER: 3
iso.3.6.1.4.1.789.1.2.2.4.0 = INTEGER: 3
Processing oid 1 (line 1)
  oidname: iso.3.6.1.4.1.789.1.2.2.4.0
  response:  = INTEGER: 3
Processing oid 2 (line 2)
  oidname: iso.3.6.1.4.1.789.1.2.2.4.0
  response:  = INTEGER: 3
Processing oid 3 (line 3)
  oidname: iso.3.6.1.4.1.789.1.2.2.4.0
  response:  = INTEGER: 3
Processing oid 4 (line 4)
  oidname: iso.3.6.1.4.1.789.1.2.2.4.0
  response:  = INTEGER: 3
Processing oid 5 (line 5)
  oidname: iso.3.6.1.4.1.789.1.2.2.4.0
  response:  = INTEGER: 3
cg;6� OK - 3 a 3 b 3 c 3 d 3 e | iso.3.6.1.4.1.789.1.2.2.4.0=3 iso.3.6.1.4.1.789.1.2.2.4.0=3 iso.3.6.1.4.1.789.1.2.2.4.0=3 iso.3.6.1.4.1.789.1.2.2.4.0=3 iso.3.6.1.4.1.789.1.2.2.4.0=3

With fix:

bash# ./check_snmp_64bit_fix -H mary.unix.db.de -C nasfiler -o .1.3.6.1.4.1.789.1.2.2.4.0,.1.3.6.1.4.1.789.1.2.2.4.0,.1.3.6.1.4.1.789.1.2.2.4.0,.1.3.6.1.4.1.789.1.2.2.4.0,.1.3.6.1.4.1.789.1.2.2.4.0 -v -v -v -u a,b,c,d,e
/usr/bin/snmpget -t 1 -r 5 -m '' -v 1 [authpriv] mary.unix.db.de:161 .1.3.6.1.4.1.789.1.2.2.4.0 .1.3.6.1.4.1.789.1.2.2.4.0 .1.3.6.1.4.1.789.1.2.2.4.0 .1.3.6.1.4.1.789.1.2.2.4.0 .1.3.6.1.4.1.789.1.2.2.4.0
iso.3.6.1.4.1.789.1.2.2.4.0 = INTEGER: 3
iso.3.6.1.4.1.789.1.2.2.4.0 = INTEGER: 3
iso.3.6.1.4.1.789.1.2.2.4.0 = INTEGER: 3
iso.3.6.1.4.1.789.1.2.2.4.0 = INTEGER: 3
iso.3.6.1.4.1.789.1.2.2.4.0 = INTEGER: 3
Processing oid 1 (line 1)
  oidname: iso.3.6.1.4.1.789.1.2.2.4.0
  response:  = INTEGER: 3
Processing oid 2 (line 2)
  oidname: iso.3.6.1.4.1.789.1.2.2.4.0
  response:  = INTEGER: 3
Processing oid 3 (line 3)
  oidname: iso.3.6.1.4.1.789.1.2.2.4.0
  response:  = INTEGER: 3
Processing oid 4 (line 4)
  oidname: iso.3.6.1.4.1.789.1.2.2.4.0
  response:  = INTEGER: 3
Processing oid 5 (line 5)
  oidname: iso.3.6.1.4.1.789.1.2.2.4.0
  response:  = INTEGER: 3
SNMP OK - 3 a 3 b 3 c 3 d 3 e | iso.3.6.1.4.1.789.1.2.2.4.0=3 iso.3.6.1.4.1.789.1.2.2.4.0=3 iso.3.6.1.4.1.789.1.2.2.4.0=3 iso.3.6.1.4.1.789.1.2.2.4.0=3 iso.3.6.1.4.1.789.1.2.2.4.0=3



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=3386170&group_id=29880




More information about the Devel mailing list