Imported Upstream version 1.4.16+git20130911
This commit is contained in:
		
							parent
							
								
									96678a79c9
								
							
						
					
					
						commit
						ea90af2ba1
					
				
					 20 changed files with 379 additions and 383 deletions
				
			
		| 
						 | 
				
			
			@ -855,18 +855,18 @@ check_http (void)
 | 
			
		|||
  char *full_page_new;
 | 
			
		||||
  char *buf;
 | 
			
		||||
  char *pos;
 | 
			
		||||
  long microsec;
 | 
			
		||||
  double elapsed_time;
 | 
			
		||||
  long microsec_connect;
 | 
			
		||||
  double elapsed_time_connect;
 | 
			
		||||
  long microsec_ssl;
 | 
			
		||||
  double elapsed_time_ssl;
 | 
			
		||||
  long microsec_firstbyte;
 | 
			
		||||
  double elapsed_time_firstbyte;
 | 
			
		||||
  long microsec_headers;
 | 
			
		||||
  double elapsed_time_headers;
 | 
			
		||||
  long microsec_transfer;
 | 
			
		||||
  double elapsed_time_transfer;
 | 
			
		||||
  long microsec = 0L;
 | 
			
		||||
  double elapsed_time = 0.0;
 | 
			
		||||
  long microsec_connect = 0L;
 | 
			
		||||
  double elapsed_time_connect = 0.0;
 | 
			
		||||
  long microsec_ssl = 0L;
 | 
			
		||||
  double elapsed_time_ssl = 0.0;
 | 
			
		||||
  long microsec_firstbyte = 0L;
 | 
			
		||||
  double elapsed_time_firstbyte = 0.0;
 | 
			
		||||
  long microsec_headers = 0L;
 | 
			
		||||
  double elapsed_time_headers = 0.0;
 | 
			
		||||
  long microsec_transfer = 0L;
 | 
			
		||||
  double elapsed_time_transfer = 0.0;
 | 
			
		||||
  int page_len = 0;
 | 
			
		||||
  int result = STATE_OK;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -164,8 +164,14 @@ enum SmartCommand
 | 
			
		|||
		SMART_CMD_AUTO_OFFLINE 
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
void print_values (values_t * p, thresholds_t * t);
 | 
			
		||||
int smart_cmd_simple (int fd, enum SmartCommand command, __u8 val0, char show_error); 
 | 
			
		||||
char *get_offline_text (int);
 | 
			
		||||
int smart_read_values (int, values_t *);
 | 
			
		||||
int values_not_passed (values_t *, thresholds_t *);
 | 
			
		||||
int nagios (values_t *, thresholds_t *);
 | 
			
		||||
void print_value (value_t *, threshold_t *);
 | 
			
		||||
void print_values (values_t *, thresholds_t *);
 | 
			
		||||
int smart_cmd_simple (int, enum SmartCommand, __u8, char);
 | 
			
		||||
int smart_read_thresholds (int, thresholds_t *);
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
main (int argc, char *argv[]) 
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -150,7 +150,7 @@ main (int argc, char **argv)
 | 
			
		|||
	int crit = 0; /* number of processes in crit state */
 | 
			
		||||
	int i = 0, j = 0;
 | 
			
		||||
	int result = STATE_UNKNOWN;
 | 
			
		||||
	int ret;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
	output chld_out, chld_err;
 | 
			
		||||
 | 
			
		||||
	setlocale (LC_ALL, "");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,6 +32,8 @@ char *progname;
 | 
			
		|||
const char *copyright = "1999-2008";
 | 
			
		||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
 | 
			
		||||
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
 | 
			
		||||
#include "common.h"
 | 
			
		||||
#include "netutils.h"
 | 
			
		||||
#include "utils.h"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,6 +35,8 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
 | 
			
		|||
 | 
			
		||||
#define DEFAULT_TIMEOUT 11
 | 
			
		||||
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
 | 
			
		||||
#include "common.h"
 | 
			
		||||
#include "utils.h"
 | 
			
		||||
#include "utils_cmd.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -43,6 +45,7 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
 | 
			
		|||
 | 
			
		||||
static const char **process_arguments (int, char **);
 | 
			
		||||
int validate_arguments (char **);
 | 
			
		||||
int translate_state (char *);
 | 
			
		||||
void print_help (void);
 | 
			
		||||
void print_usage (void);
 | 
			
		||||
int subst_text = FALSE;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,11 +27,12 @@
 | 
			
		|||
* 
 | 
			
		||||
*****************************************************************************/
 | 
			
		||||
 | 
			
		||||
#define LOCAL_TIMEOUT_ALARM_HANDLER
 | 
			
		||||
 | 
			
		||||
#include "common.h"
 | 
			
		||||
#include "netutils.h"
 | 
			
		||||
 | 
			
		||||
unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT;
 | 
			
		||||
unsigned int socket_timeout_state = STATE_CRITICAL;
 | 
			
		||||
 | 
			
		||||
int econn_refuse_state = STATE_CRITICAL;
 | 
			
		||||
int was_refused = FALSE;
 | 
			
		||||
#if USE_IPV6
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -81,20 +81,14 @@ void host_or_die(const char *str);
 | 
			
		|||
#  define is_hostname(addr) resolve_host_or_addr(addr, AF_INET)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef LOCAL_TIMEOUT_ALARM_HANDLER
 | 
			
		||||
extern unsigned int socket_timeout;
 | 
			
		||||
extern int socket_timeout_state;
 | 
			
		||||
RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
 | 
			
		||||
#else
 | 
			
		||||
unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT;
 | 
			
		||||
unsigned int socket_timeout_state = STATE_CRITICAL;
 | 
			
		||||
extern RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
extern unsigned int socket_timeout_state;
 | 
			
		||||
extern int econn_refuse_state;
 | 
			
		||||
extern int was_refused;
 | 
			
		||||
extern int address_family;
 | 
			
		||||
 | 
			
		||||
RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
 | 
			
		||||
 | 
			
		||||
/* SSL-Related functionality */
 | 
			
		||||
#ifdef HAVE_SSL
 | 
			
		||||
/* maybe this could be merged with the above np_net_connect, via some flags */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,17 +25,7 @@
 | 
			
		|||
#define NAGIOSPLUG_RUNCMD_H
 | 
			
		||||
 | 
			
		||||
#include "common.h"
 | 
			
		||||
 | 
			
		||||
/** types **/
 | 
			
		||||
struct output {
 | 
			
		||||
	char *buf;     /* output buffer */
 | 
			
		||||
	size_t buflen; /* output buffer content length */
 | 
			
		||||
	char **line;   /* array of lines (points to buf) */
 | 
			
		||||
	size_t *lens;  /* string lengths */
 | 
			
		||||
	size_t lines;  /* lines of output */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef struct output output;
 | 
			
		||||
#include "utils_cmd.h" /* for the "output" type */
 | 
			
		||||
 | 
			
		||||
/** prototypes **/
 | 
			
		||||
int np_runcmd(const char *, output *, output *, int);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,7 +27,6 @@
 | 
			
		|||
*****************************************************************************/
 | 
			
		||||
 | 
			
		||||
#define MAX_CN_LENGTH 256
 | 
			
		||||
#define LOCAL_TIMEOUT_ALARM_HANDLER
 | 
			
		||||
#include "common.h"
 | 
			
		||||
#include "netutils.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -49,7 +48,7 @@ int np_net_ssl_init_with_hostname_and_version(int sd, char *host_name, int versi
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
int np_net_ssl_init_with_hostname_version_and_cert(int sd, char *host_name, int version, char *cert, char *privkey) {
 | 
			
		||||
	const SSL_METHOD *method = NULL;
 | 
			
		||||
	SSL_METHOD *method = NULL;
 | 
			
		||||
 | 
			
		||||
	switch (version) {
 | 
			
		||||
	case 0: /* Deafult to auto negotiation */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,8 +22,6 @@
 | 
			
		|||
* 
 | 
			
		||||
*****************************************************************************/
 | 
			
		||||
 | 
			
		||||
#define LOCAL_TIMEOUT_ALARM_HANDLER
 | 
			
		||||
 | 
			
		||||
#include "common.h"
 | 
			
		||||
#include "utils.h"
 | 
			
		||||
#include "utils_base.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -38,6 +36,11 @@ extern const char *progname;
 | 
			
		|||
#define STRLEN 64
 | 
			
		||||
#define TXTBLK 128
 | 
			
		||||
 | 
			
		||||
unsigned int timeout_state = STATE_CRITICAL;
 | 
			
		||||
unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT;
 | 
			
		||||
 | 
			
		||||
time_t start_time, end_time;
 | 
			
		||||
 | 
			
		||||
/* **************************************************************************
 | 
			
		||||
 * max_state(STATE_x, STATE_y)
 | 
			
		||||
 * compares STATE_x to  STATE_y and returns result based on the following
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,17 +31,12 @@ void print_revision (const char *, const char *);
 | 
			
		|||
 | 
			
		||||
/* Handle timeouts */
 | 
			
		||||
 | 
			
		||||
#ifdef LOCAL_TIMEOUT_ALARM_HANDLER
 | 
			
		||||
extern unsigned int timeout_state;
 | 
			
		||||
extern unsigned int timeout_interval;
 | 
			
		||||
RETSIGTYPE timeout_alarm_handler (int);
 | 
			
		||||
#else
 | 
			
		||||
unsigned int timeout_state = STATE_CRITICAL;
 | 
			
		||||
unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT;
 | 
			
		||||
extern RETSIGTYPE timeout_alarm_handler (int);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
time_t start_time, end_time;
 | 
			
		||||
RETSIGTYPE timeout_alarm_handler (int);
 | 
			
		||||
 | 
			
		||||
extern time_t start_time, end_time;
 | 
			
		||||
 | 
			
		||||
/* Test input types */
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue