[Nagiosplug-checkins] CVS: nagiosplug/plugins check_dns.c,1.11,1.12

Ton Voon tonvoon at users.sourceforge.net
Tue Mar 11 16:46:02 CET 2003


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

Modified Files:
	check_dns.c 
Log Message:
Removed is_host checks to speed up code. Fixed timings so no spaces


Index: check_dns.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dns.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** check_dns.c	12 Mar 2003 00:08:19 -0000	1.11
--- check_dns.c	12 Mar 2003 00:45:01 -0000	1.12
***************
*** 155,158 ****
--- 155,159 ----
  		if (result != STATE_OK) {
  			output = strscpy (output, 1 + index (input_buffer, ':'));
+ 			strip (output);
  			break;
  		}
***************
*** 165,168 ****
--- 166,170 ----
  			result = max_state (result, error_scan (input_buffer));
  			output = strscpy (output, 1 + index (input_buffer, ':'));
+ 			strip (output);
  		}
  	}
***************
*** 192,196 ****
  			multi_address = TRUE;
  
! 		printf ("DNS ok - %-7.3f seconds response time, address%s %s|time=%-7.3f\n",
  		  elapsed_time, (multi_address==TRUE ? "es are" : " is"), address, elapsed_time);
  	}
--- 194,198 ----
  			multi_address = TRUE;
  
! 		printf ("DNS ok - %-5.3f seconds response time, address%s %s|time=%-5.3f\n",
  		  elapsed_time, (multi_address==TRUE ? "es are" : " is"), address, elapsed_time);
  	}
***************
*** 316,324 ****
  			break;
  		case 'H': /* hostname */
- 			if (is_host (optarg) == FALSE) {
- 				printf ("Invalid host name/address\n\n");
- 				print_usage ();
- 				exit (STATE_UNKNOWN);
- 			}
  			if (strlen (optarg) >= ADDRESS_LENGTH)
  				terminate (STATE_UNKNOWN, "Input buffer overflow\n");
--- 318,321 ----
***************
*** 326,329 ****
--- 323,328 ----
  			break;
  		case 's': /* server name */
+ 			/* TODO: this is_host check is probably unnecessary. Better to confirm nslookup
+ 			   response matches */
  			if (is_host (optarg) == FALSE) {
  				printf ("Invalid server name/address\n\n");
***************
*** 336,339 ****
--- 335,339 ----
  			break;
  		case 'r': /* reverse server name */
+ 			/* TODO: Is this is_host necessary? */
  			if (is_host (optarg) == FALSE) {
  				printf ("Invalid host name/address\n\n");
***************
*** 346,354 ****
  			break;
  		case 'a': /* expected address */
- 			if (is_addr (optarg) == FALSE) {
- 				printf ("Invalid expected address\n\n");
- 				print_usage ();
- 				exit (STATE_UNKNOWN);
- 			}
  			if (strlen (optarg) >= ADDRESS_LENGTH)
  				terminate (STATE_UNKNOWN, "Input buffer overflow\n");
--- 346,349 ----
***************
*** 361,368 ****
  	c = optind;
  	if (strlen(query_address)==0 && c<argc) {
- 		if (is_host(argv[c])==FALSE) {
- 			printf ("Invalid name/address: %s\n\n", argv[c]);
- 			return ERROR;
- 		}
  		if (strlen(argv[c])>=ADDRESS_LENGTH)
  			terminate (STATE_UNKNOWN, "Input buffer overflow\n");
--- 356,359 ----
***************
*** 371,374 ****
--- 362,366 ----
  
  	if (strlen(dns_server)==0 && c<argc) {
+ 		/* TODO: See -s option */
  		if (is_host(argv[c]) == FALSE) {
  			printf ("Invalid name/address: %s\n\n", argv[c]);





More information about the Commits mailing list