New upstream version 2.2
This commit is contained in:
parent
ea115afa68
commit
c845af032a
101 changed files with 4649 additions and 22969 deletions
|
@ -36,7 +36,9 @@ const char *email = "devel@monitoring-plugins.org";
|
|||
#include "utils.h"
|
||||
#include "netutils.h"
|
||||
|
||||
#if defined(HAVE_LIBFREERADIUS_CLIENT)
|
||||
#if defined(HAVE_LIBRADCLI)
|
||||
#include <radcli/radcli.h>
|
||||
#elif defined(HAVE_LIBFREERADIUS_CLIENT)
|
||||
#include <freeradius-client.h>
|
||||
#elif defined(HAVE_LIBRADIUSCLIENT_NG)
|
||||
#include <radiusclient-ng.h>
|
||||
|
@ -48,22 +50,24 @@ int process_arguments (int, char **);
|
|||
void print_help (void);
|
||||
void print_usage (void);
|
||||
|
||||
#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG)
|
||||
#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || defined(HAVE_LIBRADCLI)
|
||||
#define my_rc_conf_str(a) rc_conf_str(rch,a)
|
||||
#if defined(HAVE_LIBRADCLI)
|
||||
#define my_rc_send_server(a,b) rc_send_server(rch,a,b,AUTH)
|
||||
#else
|
||||
#define my_rc_send_server(a,b) rc_send_server(rch,a,b)
|
||||
#ifdef HAVE_LIBFREERADIUS_CLIENT
|
||||
#endif
|
||||
#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADCLI)
|
||||
#define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(rch,a,b,c,d,(a)->secret,e,f)
|
||||
#else
|
||||
#define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(rch,a,b,c,d,e,f)
|
||||
#endif
|
||||
#define my_rc_own_ipaddress() rc_own_ipaddress(rch)
|
||||
#define my_rc_avpair_add(a,b,c,d) rc_avpair_add(rch,a,b,c,-1,d)
|
||||
#define my_rc_read_dictionary(a) rc_read_dictionary(rch, a)
|
||||
#else
|
||||
#define my_rc_conf_str(a) rc_conf_str(a)
|
||||
#define my_rc_send_server(a,b) rc_send_server(a, b)
|
||||
#define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(a,b,c,d,e,f)
|
||||
#define my_rc_own_ipaddress() rc_own_ipaddress()
|
||||
#define my_rc_avpair_add(a,b,c,d) rc_avpair_add(a, b, c, d)
|
||||
#define my_rc_read_dictionary(a) rc_read_dictionary(a)
|
||||
#endif
|
||||
|
@ -76,7 +80,7 @@ void print_usage (void);
|
|||
|
||||
int my_rc_read_config(char *);
|
||||
|
||||
#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG)
|
||||
#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || defined(HAVE_LIBRADCLI)
|
||||
rc_handle *rch = NULL;
|
||||
#endif
|
||||
|
||||
|
@ -90,7 +94,6 @@ char *config_file = NULL;
|
|||
unsigned short port = PW_AUTH_UDP_PORT;
|
||||
int retries = 1;
|
||||
int verbose = FALSE;
|
||||
ENV *env = NULL;
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
|
@ -150,6 +153,8 @@ Please note that all tags must be lowercase to use the DocBook XML DTD.
|
|||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct sockaddr_storage ss;
|
||||
char name[HOST_NAME_MAX];
|
||||
char msg[BUFFER_LEN];
|
||||
SEND_DATA data;
|
||||
int result = STATE_UNKNOWN;
|
||||
|
@ -185,15 +190,14 @@ main (int argc, char **argv)
|
|||
die (STATE_UNKNOWN, _("Invalid NAS-Identifier\n"));
|
||||
}
|
||||
|
||||
if (nasipaddress != NULL) {
|
||||
if (rc_good_ipaddr (nasipaddress))
|
||||
die (STATE_UNKNOWN, _("Invalid NAS-IP-Address\n"));
|
||||
if ((client_id = rc_get_ipaddr(nasipaddress)) == 0)
|
||||
die (STATE_UNKNOWN, _("Invalid NAS-IP-Address\n"));
|
||||
} else {
|
||||
if ((client_id = my_rc_own_ipaddress ()) == 0)
|
||||
die (STATE_UNKNOWN, _("Can't find local IP for NAS-IP-Address\n"));
|
||||
if (nasipaddress == NULL) {
|
||||
if (gethostname (name, sizeof(name)) != 0)
|
||||
die (STATE_UNKNOWN, _("gethostname() failed!\n"));
|
||||
nasipaddress = name;
|
||||
}
|
||||
if (!dns_lookup (nasipaddress, &ss, AF_INET)) /* TODO: Support IPv6. */
|
||||
die (STATE_UNKNOWN, _("Invalid NAS-IP-Address\n"));
|
||||
client_id = ntohl (((struct sockaddr_in *)&ss)->sin_addr.s_addr);
|
||||
if (my_rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == NULL)
|
||||
die (STATE_UNKNOWN, _("Invalid NAS-IP-Address\n"));
|
||||
|
||||
|
@ -259,10 +263,10 @@ process_arguments (int argc, char **argv)
|
|||
usage5 ();
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (OK);
|
||||
exit (STATE_UNKNOWN);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (OK);
|
||||
exit (STATE_UNKNOWN);
|
||||
case 'v': /* verbose mode */
|
||||
verbose = TRUE;
|
||||
break;
|
||||
|
@ -274,7 +278,7 @@ process_arguments (int argc, char **argv)
|
|||
break;
|
||||
case 'P': /* port */
|
||||
if (is_intnonneg (optarg))
|
||||
port = atoi (optarg);
|
||||
port = (unsigned short)atoi (optarg);
|
||||
else
|
||||
usage4 (_("Port must be a positive integer"));
|
||||
break;
|
||||
|
@ -310,7 +314,7 @@ process_arguments (int argc, char **argv)
|
|||
break;
|
||||
case 't': /* timeout */
|
||||
if (is_intpos (optarg))
|
||||
timeout_interval = atoi (optarg);
|
||||
timeout_interval = (unsigned)atoi (optarg);
|
||||
else
|
||||
usage2 (_("Timeout interval must be a positive integer"), optarg);
|
||||
break;
|
||||
|
@ -399,7 +403,7 @@ print_usage (void)
|
|||
|
||||
int my_rc_read_config(char * a)
|
||||
{
|
||||
#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG)
|
||||
#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || defined(HAVE_LIBRADCLI)
|
||||
rch = rc_read_config(a);
|
||||
return (rch == NULL) ? 1 : 0;
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue