[Nagiosplug-checkins] CVS: nagiosplug/plugins check_http.c,1.35,1.36 check_ldap.c,1.7,1.8 check_smtp.c,1.14,1.15

Jeremy T. Bouse undrgrid at users.sourceforge.net
Mon Jun 30 12:48:07 CEST 2003


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

Modified Files:
	check_http.c check_ldap.c check_smtp.c 
Log Message:
Added -4 and -6 command line options into check_http, check_ldap and 
	check_smtp


Index: check_http.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** check_http.c	21 Jun 2003 05:23:03 -0000	1.35
--- check_http.c	30 Jun 2003 19:47:18 -0000	1.36
***************
*** 46,50 ****
              [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\
              [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\
!             [-P string] [-m min_pg_size]"
  
  #define LONGOPTIONS "\
--- 46,50 ----
              [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\
              [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\
!             [-P string] [-m min_pg_size] [-4|-6]"
  
  #define LONGOPTIONS "\
***************
*** 53,56 ****
--- 53,60 ----
   -I, --IP-address=ADDRESS\n\
     IP address or name (use numeric address if possible to bypass DNS lookup).\n\
+  -4, --use-ipv4\n\
+    Use IPv4 protocol\n\
+  -6, --use-ipv6\n\
+    Use IPv6 protocol\n\
   -e, --expect=STRING\n\
     String to expect in first (status) line of server response (default: %s)\n\
***************
*** 317,320 ****
--- 321,326 ----
  		{"certificate", required_argument, 0, 'C'},
  		{"min", required_argument, 0, 'm'},
+ 		{"use-ipv4", no_argument, 0, '4'},
+ 		{"use-ipv6", no_argument, 0, '6'},
  		{0, 0, 0, 0}
  	};
***************
*** 337,341 ****
  
  	while (1) {
! 		c = getopt_long (argc, argv, "Vvht:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLSm:", long_options, &option_index);
  		if (c == -1 || c == EOF)
  			break;
--- 343,347 ----
  
  	while (1) {
! 		c = getopt_long (argc, argv, "Vvh46t:c:w:H:P:I:a:e:p:s:R:r:u:f:C:nlLSm:", long_options, &option_index);
  		if (c == -1 || c == EOF)
  			break;
***************
*** 465,468 ****
--- 471,484 ----
  			break;
  #endif
+ 		case '4':
+ 			address_family = AF_INET;
+ 			break;
+ 		case '6':
+ #ifdef USE_IPV6
+ 			address_family = AF_INET6;
+ #else
+ 			usage ("IPv6 support not available\n");
+ #endif
+ 			break;
  		case 'v': /* verbose */
  			verbose = TRUE;

Index: check_ldap.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ldap.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** check_ldap.c	29 Jun 2003 19:54:50 -0000	1.7
--- check_ldap.c	30 Jun 2003 19:47:21 -0000	1.8
***************
*** 160,163 ****
--- 160,165 ----
  		{"ver3", no_argument, 0, '3'},
  #endif
+ 		{"use-ipv4", no_argument, 0, '4'},
+ 		{"use-ipv6", no_argument, 0, '6'},
  		{"port", required_argument, 0, 'p'},
  		{"warn", required_argument, 0, 'w'},
***************
*** 175,179 ****
  
  	while (1) {
! 		c = getopt_long (argc, argv, "hV23t:c:w:H:b:p:a:D:P:", longopts, &option_index);
  
  		if (c == -1 || c == EOF)
--- 177,181 ----
  
  	while (1) {
! 		c = getopt_long (argc, argv, "hV2346t:c:w:H:b:p:a:D:P:", longopts, &option_index);
  
  		if (c == -1 || c == EOF)
***************
*** 224,227 ****
--- 226,239 ----
  			break;
  #endif
+ 		case '4':
+ 			address_family = AF_INET;
+ 			break;
+ 		case '6':
+ #ifdef USE_IPV6
+ 			address_family = AF_INET6;
+ #else
+ 			usage ("IPv6 support not available\n");
+ #endif
+ 			break;
  		default:
  			usage ("check_ldap: could not parse unknown arguments\n");
***************
*** 230,235 ****
  	}
  
! 	if (ld_host[0] == 0) {
! 		asprintf (&ld_host, "%s", argv[c]);
  	}
  
--- 242,251 ----
  	}
  
! 	c = optind;
! 	if (strlen(ld_host) == 0 && is_host(argv[c])) {
! 		asprintf (&ld_host, "%s", argv[c++]);
! 	}
! 	if (strlen(ld_base) == 0 && argv[c]) {
! 		asprintf (&ld_base, "%s", argv[c++]);
  	}
  
***************
*** 272,277 ****
  		 "\t-p [--port] ... ldap port (default: %d)\n"
  #ifdef HAVE_LDAP_SET_OPTION
! 		 "\t-2 [--ver2] ... use ldap porotocol version 2\n"
! 		 "\t-3 [--ver3] ... use ldap porotocol version 3\n"
  		 "\t\t(default protocol version: %d)\n"
  #endif
--- 288,295 ----
  		 "\t-p [--port] ... ldap port (default: %d)\n"
  #ifdef HAVE_LDAP_SET_OPTION
! 		 "\t-2 [--ver2] ... use ldap protocol version 2\n"
! 		 "\t-3 [--ver3] ... use ldap protocol version 3\n"
! 		 "\t-4 [--use-ipv4] ... use IPv4 protocol\n"
! 		 "\t-6 [--use-ipv6] ... use IPv6 protocol\n"
  		 "\t\t(default protocol version: %d)\n"
  #endif
***************
*** 293,297 ****
  		 "         [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n"
  #ifdef HAVE_LDAP_SET_OPTION
! 		 "         [-2|-3]\n"
  #endif
  		 "(Note: all times are in seconds.)\n", progname);
--- 311,315 ----
  		 "         [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n"
  #ifdef HAVE_LDAP_SET_OPTION
! 		 "         [-2|-3] [-4|-6]\n"
  #endif
  		 "(Note: all times are in seconds.)\n", progname);

Index: check_smtp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_smtp.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** check_smtp.c	13 Mar 2003 21:10:59 -0000	1.14
--- check_smtp.c	30 Jun 2003 19:47:21 -0000	1.15
***************
*** 34,42 ****
  const char *option_summary = "\
  -H host [-p port] [-e expect] [-C command] [-f from addr]\n\
!          [-w warn] [-c crit] [-t timeout] [-n] [-v]";
  
  const char *options = "\
   -H, --hostname=STRING or IPADDRESS\n\
     Check server on the indicated host\n\
   -p, --port=INTEGER\n\
     Make connection on the indicated port (default: %d)\n\
--- 34,46 ----
  const char *option_summary = "\
  -H host [-p port] [-e expect] [-C command] [-f from addr]\n\
!          [-w warn] [-c crit] [-t timeout] [-n] [-v] [-4|-6]";
  
  const char *options = "\
   -H, --hostname=STRING or IPADDRESS\n\
     Check server on the indicated host\n\
+  -4, --use-ipv4\n\
+    Use IPv4 protocol\n\
+  -6, --use-ipv6\n\
+    Use IPv6 protocol\n\
   -p, --port=INTEGER\n\
     Make connection on the indicated port (default: %d)\n\
***************
*** 234,237 ****
--- 238,243 ----
  		{"verbose", no_argument, 0, 'v'},
  		{"version", no_argument, 0, 'V'},
+ 		{"use-ipv4", no_argument, 0, '4'},
+ 		{"use-ipv6", no_argument, 0, '6'},
  		{"help", no_argument, 0, 'h'},
  		{0, 0, 0, 0}
***************
*** 251,255 ****
  
  	while (1) {
! 		c = getopt_long (argc, argv, "+hVvt:p:f:e:c:w:H:C:",
  		                 long_options, &option_index);
  
--- 257,261 ----
  
  	while (1) {
! 		c = getopt_long (argc, argv, "+hVv46t:p:f:e:c:w:H:C:",
  		                 long_options, &option_index);
  
***************
*** 315,318 ****
--- 321,334 ----
  				usage ("Time interval must be a nonnegative integer\n");
  			}
+ 			break;
+ 		case '4':
+ 			address_family = AF_INET;
+ 			break;
+ 		case '6':
+ #ifdef USE_IPV6
+ 			address_family = AF_INET6;
+ #else
+ 			usage ("IPv6 support not available\n");
+ #endif
  			break;
  		case 'V':									/* version */





More information about the Commits mailing list