[Nagiosplug-checkins] CVS: nagiosplug/plugins check_dns.c,1.8,1.8.2.1

Karl DeBisschop kdebisschop at users.sourceforge.net
Sat May 31 07:22:03 CEST 2003


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv30256

Modified Files:
      Tag: r1_3_0
	check_dns.c 
Log Message:
trap null or empty returns from nslookup


Index: check_dns.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dns.c,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -C2 -r1.8 -r1.8.2.1
*** check_dns.c	21 Feb 2003 21:46:27 -0000	1.8
--- check_dns.c	31 May 2003 14:04:05 -0000	1.8.2.1
***************
*** 137,146 ****
  				for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++)
  					/* NOOP */;
! 				address = strscpy (address, temp_buffer);
  				strip (address);
  				result = STATE_OK;
  			}
  			else {
! 				output = strscpy (output, "Unknown error (plugin)");
  				result = STATE_WARNING;
  			}
--- 137,148 ----
  				for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++)
  					/* NOOP */;
! 				address = strdup (temp_buffer);
  				strip (address);
+ 				if (address==NULL || strlen(address)==0)
+ 					terminate (STATE_CRITICAL, "DNS CRITICAL - '%s' returned empty host name string", %s);
  				result = STATE_OK;
  			}
  			else {
! 				output = strdup ("Unknown error (plugin)");
  				result = STATE_WARNING;
  			}
***************
*** 177,183 ****
  	/* compare to expected address */
  	if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) {
! 	        result = STATE_CRITICAL;
! 	        asprintf(&output, "expected %s but got %s", expected_address, address);
! 		}
  	
  	(void) time (&end_time);
--- 179,185 ----
  	/* compare to expected address */
  	if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) {
! 		result = STATE_CRITICAL;
! 		asprintf(&output, "expected %s but got %s", expected_address, address);
! 	}
  	
  	(void) time (&end_time);





More information about the Commits mailing list