[Pkg-nagios-changes] [pkg-nagios-plugins] 140/413: add add nas-ip-address option to check_radius

Jan Wagner waja at moszumanska.debian.org
Tue Nov 26 23:13:16 UTC 2013


This is an automated email from the git hooks/post-receive script.

waja pushed a commit to branch master
in repository pkg-nagios-plugins.

commit 93d4faf21adfcbc4492f1d3b459050cee07f52e8
Author: Jan Wagner <waja at cyconet.org>
Date:   Fri Jun 6 13:10:32 2008 +0000

    add add nas-ip-address option to check_radius
---
 debian/changelog                                   |   3 +
 debian/patches/00list                              |   1 +
 .../patches/37_check_radius_nas-ip-address.dpatch  | 103 +++++++++++++++++++++
 3 files changed, 107 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 4f13e44..1871c81 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -36,6 +36,9 @@ nagios-plugins (1.4.12-1) UNRELEASED; urgency=low
   * add 36_check_ldap_empty_base.dpatch which allows empty ldap base, thanks
     to Stephane Chazelas <stephane at artesyncp.com> for providing it
     (Closes: #479984)
+  * add 37_check_radius_nas-ip-address.dpatch to add support for nas-ip to
+    check_radius, thanks Josip Rodin <joy at debbugs.entuzijast.net> for
+    providing it (Closes: #482947)
 
   [ Alexander Wirt ]
   * Call smbclient with -N (supress password prompt) if no password is
diff --git a/debian/patches/00list b/debian/patches/00list
index 0492fda..a622e1a 100644
--- a/debian/patches/00list
+++ b/debian/patches/00list
@@ -11,4 +11,5 @@
 34_fix_smbclient_check_disk_smb.dpatch
 35_check_http_date.dpatch
 36_check_ldap_empty_base.dpatch
+37_check_radius_nas-ip-address.dpatch
 50_misc_typos.dpatch
diff --git a/debian/patches/37_check_radius_nas-ip-address.dpatch b/debian/patches/37_check_radius_nas-ip-address.dpatch
new file mode 100755
index 0000000..23b8991
--- /dev/null
+++ b/debian/patches/37_check_radius_nas-ip-address.dpatch
@@ -0,0 +1,103 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 37_check_radius_nas-ip-address.dpatch by Jan Wagner <waja at cyconet.org>
+## patch provided by Josip Rodin <joy at debbugs.entuzijast.net>
+##
+## DP: add nas-ip-address option
+
+ at DPATCH@
+diff -urNad nagios-plugins-1.4.12~/plugins/check_radius.c nagios-plugins-1.4.12/plugins/check_radius.c
+--- nagios-plugins-1.4.12~/plugins/check_radius.c	2008-06-06 15:00:49.000000000 +0200
++++ nagios-plugins-1.4.12/plugins/check_radius.c	2008-06-06 15:02:33.000000000 +0200
+@@ -73,6 +73,7 @@
+ char *username = NULL;
+ char *password = NULL;
+ char *nasid = NULL;
++char *nasipaddress = NULL;
+ char *expect = NULL;
+ char *config_file = NULL;
+ unsigned short port = PW_AUTH_UDP_PORT;
+@@ -173,19 +174,26 @@
+ 	memset (&data, 0, sizeof(data));
+ 	if (!(my_rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) &&
+ 				my_rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) &&
+-				my_rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) &&
+-				(nasid==NULL || my_rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0))))
++				my_rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0)
++				))
+ 		die (STATE_UNKNOWN, _("Out of Memory?"));
+ 
+-	/* 
+-	 * Fill in NAS-IP-Address 
+-	 */
+-
+-	if ((client_id = my_rc_own_ipaddress ()) == 0)
+-		return (ERROR_RC);
++	if (nasid != NULL) {
++		if (!(my_rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0)))
++			die (STATE_UNKNOWN, _("Invalid NAS-Identifier"));
++	}
+ 
+-	if (my_rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) ==
+-			NULL) return (ERROR_RC);
++	if (nasipaddress != NULL) {
++		if (rc_good_ipaddr (nasipaddress))
++			die (STATE_UNKNOWN, _("Invalid NAS-IP-Address"));
++		if ((client_id = rc_get_ipaddr(nasipaddress)) == 0)
++			die (STATE_UNKNOWN, _("Invalid NAS-IP-Address"));
++	} else {
++		if ((client_id = my_rc_own_ipaddress ()) == 0)
++			die (STATE_UNKNOWN, _("Can't find local IP for NAS-IP-Address"));
++	}
++	if (my_rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == NULL)
++		die (STATE_UNKNOWN, _("Invalid NAS-IP-Address"));
+ 
+ 	my_rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval,
+ 	             retries);
+@@ -223,6 +231,7 @@
+ 		{"username", required_argument, 0, 'u'},
+ 		{"password", required_argument, 0, 'p'},
+ 		{"nas-id", required_argument, 0, 'n'},
++		{"nas-ip-address", required_argument, 0, 'N'},
+ 		{"filename", required_argument, 0, 'F'},
+ 		{"expect", required_argument, 0, 'e'},
+ 		{"retries", required_argument, 0, 'r'},
+@@ -234,7 +243,7 @@
+ 	};
+ 
+ 	while (1) {
+-		c = getopt_long (argc, argv, "+hVvH:P:F:u:p:n:t:r:e:", longopts,
++		c = getopt_long (argc, argv, "+hVvH:P:F:u:p:n:N:t:r:e:", longopts,
+ 									 &option);
+ 
+ 		if (c == -1 || c == EOF || c == 1)
+@@ -279,6 +288,9 @@
+ 		case 'n':									/* nas id */
+ 			nasid = optarg;
+ 			break;
++		case 'N':									/* nas ip address */
++			nasipaddress = optarg;
++			break;
+ 		case 'F':									/* configuration file */
+ 			config_file = optarg;
+ 			break;
+@@ -342,6 +354,8 @@
+   printf ("    %s\n", _("Password for autentication (SECURITY RISK)"));
+   printf (" %s\n", "-n, --nas-id=STRING");
+   printf ("    %s\n", _("NAS identifier"));
++  printf (" %s\n", "-N, --nas-ip-address=STRING");
++  printf ("    %s\n", _("NAS IP Address"));
+   printf (" %s\n", "-F, --filename=STRING");
+   printf ("    %s\n", _("Configuration file"));
+   printf (" %s\n", "-e, --expect=STRING");
+@@ -377,8 +391,9 @@
+ print_usage (void)
+ {
+   printf (_("Usage:"));
+-	printf ("%s -H host -F config_file -u username -p password [-n nas-id] [-P port]\n\
+-                  [-t timeout] [-r retries] [-e expect]\n", progname);
++	printf ("%s -H host -F config_file -u username -p password\n\
++			[-P port] [-t timeout] [-r retries] [-e expect]\n\
++			[-n nas-id] [-N nas-ip-addr]\n", progname);
+ }
+ 
+ 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-nagios-plugins.git



More information about the Pkg-nagios-changes mailing list