Merge branch 'maint'

* maint:
  sslutils: Remove superfluous parenthesis for sslv3 function too
  sslutils: remove superfluous parenthesis
  check_snmp: modified tests
  check_snmp.c: switched DEFAULT_TIMEOUT to DEFAULT_SOCKET_TIMEOUT (provided by utils.h), already used by help description, see issue #1318
  install snmpd on travis tests
  enable libtab on travis builds
  add perl snmp to travis dependencies
  NEWS: Mention check_ups performance data fix
  Fix incorrect performance data thresholds
  check_dhcp: Fix option parsing
  Fixes segfaults when running via monitoring worker (off-by-one)
  travis: fix http test host
  sslutils: Check if OpenSSL supports SSLv3.

Conflicts:
	NEWS
	plugins/sslutils.c
This commit is contained in:
Holger Weiss 2015-10-08 12:52:10 +02:00
commit 37928b52a5
5 changed files with 22 additions and 41 deletions

1
NEWS
View file

@ -19,6 +19,7 @@ This file documents the major additions and syntax changes between releases.
mandated by 2326
Fix check_procs on HP-UX
check_smtp's -e/--expect option can now be combined with -S/--starttls
Fix incorrect performance data thresholds emitted by check_ups
WARNINGS
The format of the performance data emitted by check_mrtgtraf has been

View file

@ -229,7 +229,7 @@ struct in_addr requested_address;
int process_arguments(int, char **);
int call_getopt(int, char **);
int validate_arguments(void);
int validate_arguments(int, int);
void print_usage(void);
void print_help(void);
@ -1059,29 +1059,19 @@ int get_results(void){
/* process command-line arguments */
int process_arguments(int argc, char **argv){
int c;
int arg_index;
if(argc<1)
return ERROR;
c=0;
while((c+=(call_getopt(argc-c,&argv[c])))<argc){
/*
if(is_option(argv[c]))
continue;
*/
}
return validate_arguments();
arg_index = call_getopt(argc,argv);
return validate_arguments(argc,arg_index);
}
int call_getopt(int argc, char **argv){
int c=0;
int i=0;
extern int optind;
int option_index = 0;
static struct option long_options[] =
{
@ -1098,24 +1088,13 @@ int call_getopt(int argc, char **argv){
};
while(1){
c=getopt_long(argc,argv,"+hVvt:s:r:t:i:m:u",long_options,&option_index);
int c=0;
i++;
c=getopt_long(argc,argv,"+hVvt:s:r:t:i:m:u",long_options,&option_index);
if(c==-1||c==EOF||c==1)
break;
switch(c){
case 'w':
case 'r':
case 't':
case 'i':
i++;
break;
default:
break;
}
switch(c){
case 's': /* DHCP server address */
@ -1181,12 +1160,14 @@ int call_getopt(int argc, char **argv){
break;
}
}
return i;
return optind;
}
int validate_arguments(void){
int validate_arguments(int argc, int arg_index){
if(argc-optind > 0)
usage(_("Got unexpected non-option argument"));
return OK;
}

View file

@ -41,7 +41,6 @@ const char *email = "devel@monitoring-plugins.org";
#define DEFAULT_PORT "161"
#define DEFAULT_MIBLIST "ALL"
#define DEFAULT_PROTOCOL "1"
#define DEFAULT_TIMEOUT 1
#define DEFAULT_RETRIES 5
#define DEFAULT_AUTH_PROTOCOL "MD5"
#define DEFAULT_PRIV_PROTOCOL "DES"
@ -227,7 +226,7 @@ main (int argc, char **argv)
outbuff = strdup ("");
delimiter = strdup (" = ");
output_delim = strdup (DEFAULT_OUTPUT_DELIMITER);
timeout_interval = DEFAULT_TIMEOUT;
timeout_interval = DEFAULT_SOCKET_TIMEOUT;
retries = DEFAULT_RETRIES;
np_init( (char *) progname, argc, argv );

View file

@ -242,8 +242,8 @@ main (int argc, char **argv)
}
xasprintf (&data, "%s %s", data,
perfdata ("battery", (long)ups_battery_percent, "%",
check_warn, (long)(1000*warning_value),
check_crit, (long)(1000*critical_value),
check_warn, (long)(warning_value),
check_crit, (long)(critical_value),
TRUE, 0, TRUE, 100));
} else {
xasprintf (&data, "%s %s", data,
@ -271,8 +271,8 @@ main (int argc, char **argv)
}
xasprintf (&data, "%s %s", data,
perfdata ("load", (long)ups_load_percent, "%",
check_warn, (long)(1000*warning_value),
check_crit, (long)(1000*critical_value),
check_warn, (long)(warning_value),
check_crit, (long)(critical_value),
TRUE, 0, TRUE, 100));
} else {
xasprintf (&data, "%s %s", data,
@ -308,8 +308,8 @@ main (int argc, char **argv)
}
xasprintf (&data, "%s %s", data,
perfdata ("temp", (long)ups_temperature, tunits,
check_warn, (long)(1000*warning_value),
check_crit, (long)(1000*critical_value),
check_warn, (long)(warning_value),
check_crit, (long)(critical_value),
TRUE, 0, FALSE, 0));
} else {
xasprintf (&data, "%s %s", data,

View file

@ -166,8 +166,8 @@ SKIP: {
SKIP: {
skip "no non responsive host defined", 2 if ( ! $host_nonresponsive );
$res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:");
cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" );
like($res->output, '/External command error: Timeout: No Response from /', "String matches timeout problem");
cmp_ok( $res->return_code, '==', 2, "Exit CRITICAL with non responsive host" );
like($res->output, '/Plugin timed out while executing system call/', "String matches timeout problem");
}
SKIP: {