Back to index

nagios-plugins  1.4.16
Classes | Defines | Typedefs | Enumerations | Functions | Variables
radiusd.h File Reference
#include "sysdep.h"
#include "radius.h"
#include "conf.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  dict_attr
struct  dict_value
struct  dict_vendor
struct  value_pair
struct  auth_req
struct  client
struct  nas
struct  realm

Defines

#define DEBUG   if(debug_flag)log_debug
#define DEBUG2   if (debug_flag > 1)log_debug
#define SECONDS_PER_DAY   86400
#define MAX_REQUEST_TIME   30
#define CLEANUP_DELAY   5
#define MAX_REQUESTS   255
#define L_DBG   1
#define L_AUTH   2
#define L_INFO   3
#define L_ERR   4
#define L_PROXY   5
#define L_CONS   128
#define VENDOR(x)   (x >> 16)

Typedefs

typedef struct dict_attr DICT_ATTR
typedef struct dict_value DICT_VALUE
typedef struct dict_vendor DICT_VENDOR
typedef struct value_pair VALUE_PAIR
typedef struct auth_req AUTH_REQ
typedef struct client CLIENT
typedef struct nas NAS
typedef struct realm REALM

Enumerations

enum  {
  PW_OPERATOR_EQUAL = 0, PW_OPERATOR_NOT_EQUAL, PW_OPERATOR_LESS_THAN, PW_OPERATOR_GREATER_THAN,
  PW_OPERATOR_LESS_EQUAL, PW_OPERATOR_GREATER_EQUAL
}

Functions

int rad_accounting (AUTH_REQ *, int)
int rad_accounting_orig (AUTH_REQ *, int, char *)
int radzap (UINT4 nas, int port, char *user, time_t t)
char * uue (void *)
int rad_check_multi (char *name, VALUE_PAIR *request, int maxsimul)
void fprint_attr_list (FILE *, VALUE_PAIR *)
void fprint_attr_val (FILE *, VALUE_PAIR *)
int dict_init (char *)
DICT_ATTRdict_attrget (int)
DICT_ATTRdict_attrfind (char *)
DICT_VALUEdict_valfind (char *)
DICT_VALUEdict_valget (UINT4 value, char *)
int dict_vendorcode (int)
int dict_vendorpec (int)
void md5_calc (u_char *, u_char *, u_int)
int radius_exec_program (char *, VALUE_PAIR *, VALUE_PAIR **, int, char **user_msg)
void debug_pair (FILE *, VALUE_PAIR *)
int log_err (char *)
void sig_cleanup (int)
char * ip_hostname (UINT4)
UINT4 get_ipaddr (char *)
int good_ipaddr (char *)
void ipaddr2str (char *, UINT4)
void pairfree (VALUE_PAIR *)
UINT4 ipstr2long (char *)
struct passwd * rad_getpwnam (char *)
VALUE_PAIRpairfind (VALUE_PAIR *, int)
void pairdelete (VALUE_PAIR **, int)
void pairadd (VALUE_PAIR **, VALUE_PAIR *)
void authfree (AUTH_REQ *authreq)
char * strNcpy (char *dest, char *src, int n)
int rad_send_reply (int, AUTH_REQ *, VALUE_PAIR *, char *, int)
AUTH_REQradrecv (UINT4, u_short, u_char *, int)
int calc_digest (u_char *, AUTH_REQ *)
int calc_acctdigest (u_char *digest, AUTH_REQ *authreq)
int user_find (char *name, VALUE_PAIR *, VALUE_PAIR **, VALUE_PAIR **)
int userparse (char *buffer, VALUE_PAIR **first_pair)
void presuf_setup (VALUE_PAIR *request_pairs)
int hints_setup (VALUE_PAIR *request_pairs)
int huntgroup_access (VALUE_PAIR *request_pairs)
CLIENTclient_find (UINT4 ipno)
char * client_name (UINT4 ipno)
int read_clients_file (char *)
REALMrealm_find (char *)
NASnas_find (UINT4 ipno)
char * nas_name (UINT4 ipno)
char * nas_name2 (AUTH_REQ *r)
char * auth_name (AUTH_REQ *authreq, int do_cid)
int read_naslist_file (char *)
int read_config_files (void)
int presufcmp (VALUE_PAIR *check, char *name, char *rest, int rl)
void pairmove (VALUE_PAIR **to, VALUE_PAIR **from)
void pairmove2 (VALUE_PAIR **to, VALUE_PAIR **from, int attr)
void version ()
int log (int, char *,...)
int log_debug (char *,...)
int proxy_send (AUTH_REQ *authreq, int activefd)
int proxy_receive (AUTH_REQ *authreq, int activefd)
int rad_auth_init (AUTH_REQ *authreq, int activefd)
int rad_authenticate (AUTH_REQ *, int)
char * radius_xlate (char *, VALUE_PAIR *req, VALUE_PAIR *reply)
int timestr_match (char *, time_t)

Variables

char * recv_buffer
char * send_buffer
char * progname
int debug_flag
char * radacct_dir
char * radius_dir
UINT4 expiration_seconds
UINT4 warning_seconds
int radius_pid
int use_dbm
int log_stripped_names
int cache_passwd
UINT4 myip
int log_auth_detail
int log_auth
int log_auth_pass
int auth_port
int acct_port

Class Documentation

struct dict_attr

Definition at line 39 of file radiusd.h.

Collaboration diagram for dict_attr:
Class Members
char name
struct dict_attr * next
int type
int value
int vendor
struct dict_value

Definition at line 47 of file radiusd.h.

Collaboration diagram for dict_value:
Class Members
char attrname
char name
struct dict_value * next
int value
struct dict_vendor

Definition at line 54 of file radiusd.h.

Collaboration diagram for dict_vendor:
Class Members
struct dict_vendor * next
int vendorcode
char vendorname
int vendorpec
struct value_pair

Definition at line 61 of file radiusd.h.

Collaboration diagram for value_pair:
Class Members
int attribute
int length
UINT4 lvalue
char name
struct value_pair * next
int operator
char strvalue
int type
struct auth_req

Definition at line 72 of file radiusd.h.

Collaboration diagram for auth_req:
Class Members
int child_pid
u_char code
u_char * data
int data_len
u_char id
UINT4 ipaddr
struct auth_req * next
VALUE_PAIR * proxy_pairs
u_char realm
VALUE_PAIR * request
u_char secret
int server_code
UINT4 server_id
UINT4 server_ipaddr
VALUE_PAIR * server_reply
UINT4 timestamp
u_short udp_port
u_char username
int validated
u_char vector
struct client

Definition at line 96 of file radiusd.h.

Collaboration diagram for client:
Class Members
UINT4 ipaddr
char longname
struct client * next
u_char secret
char shortname
struct nas

Definition at line 104 of file radiusd.h.

Collaboration diagram for nas:
Class Members
UINT4 ipaddr
char longname
char nastype
struct nas * next
char shortname
struct realm

Definition at line 112 of file radiusd.h.

Collaboration diagram for realm:
Class Members
int acct_port
int auth_port
int dohints
UINT4 ipaddr
struct realm * next
char realm
char server
int striprealm

Define Documentation

#define CLEANUP_DELAY   5

Definition at line 137 of file radiusd.h.

#define DEBUG   if(debug_flag)log_debug

Definition at line 132 of file radiusd.h.

#define DEBUG2   if (debug_flag > 1)log_debug

Definition at line 133 of file radiusd.h.

#define L_AUTH   2

Definition at line 141 of file radiusd.h.

#define L_CONS   128

Definition at line 145 of file radiusd.h.

#define L_DBG   1

Definition at line 140 of file radiusd.h.

#define L_ERR   4

Definition at line 143 of file radiusd.h.

#define L_INFO   3

Definition at line 142 of file radiusd.h.

#define L_PROXY   5

Definition at line 144 of file radiusd.h.

#define MAX_REQUEST_TIME   30

Definition at line 136 of file radiusd.h.

#define MAX_REQUESTS   255

Definition at line 138 of file radiusd.h.

#define SECONDS_PER_DAY   86400

Definition at line 135 of file radiusd.h.

#define VENDOR (   x)    (x >> 16)

Definition at line 151 of file radiusd.h.


Typedef Documentation

typedef struct auth_req AUTH_REQ
typedef struct client CLIENT
typedef struct dict_attr DICT_ATTR
typedef struct dict_value DICT_VALUE
typedef struct dict_vendor DICT_VENDOR
typedef struct nas NAS
typedef struct realm REALM
typedef struct value_pair VALUE_PAIR

Enumeration Type Documentation

anonymous enum
Enumerator:
PW_OPERATOR_EQUAL 
PW_OPERATOR_NOT_EQUAL 
PW_OPERATOR_LESS_THAN 
PW_OPERATOR_GREATER_THAN 
PW_OPERATOR_LESS_EQUAL 
PW_OPERATOR_GREATER_EQUAL 

Definition at line 123 of file radiusd.h.


Function Documentation

char* auth_name ( AUTH_REQ authreq,
int  do_cid 
)
void authfree ( AUTH_REQ authreq)

Definition at line 278 of file util.c.

{
       pairfree(authreq->request);
       memset(authreq, 0, sizeof(AUTH_REQ));
       free(authreq);
}

Here is the call graph for this function:

int calc_acctdigest ( u_char *  digest,
AUTH_REQ authreq 
)
int calc_digest ( u_char *  ,
AUTH_REQ  
)

Here is the caller graph for this function:

CLIENT* client_find ( UINT4  ipno)
char* client_name ( UINT4  ipno)
void debug_pair ( FILE *  ,
VALUE_PAIR  
)

Definition at line 50 of file attrprint.c.

{
       if(debug_flag) {
              fputs("    ", fd);
              fprint_attr_val(fd, pair);
              fputs("\n", fd);
       }
}

Here is the call graph for this function:

DICT_ATTR* dict_attrfind ( char *  )

Definition at line 431 of file dict.c.

{
       DICT_ATTR     *attr;

       attr = dictionary_attributes;
       while(attr != (DICT_ATTR *)NULL) {
              if(DICT_STRCMP(attr->name, attrname) == 0) {
                     return(attr);
              }
              attr = attr->next;
       }
       return((DICT_ATTR *)NULL);
}
DICT_ATTR* dict_attrget ( int  )

Definition at line 406 of file dict.c.

{
       DICT_ATTR     *attr;

       attr = dictionary_attributes;
       while(attr != (DICT_ATTR *)NULL) {
              if(attr->value == attribute) {
                     return(attr);
              }
              attr = attr->next;
       }
       return((DICT_ATTR *)NULL);
}

Here is the caller graph for this function:

int dict_init ( char *  )

Definition at line 108 of file dict.c.

{
       FILE   *dictfd;
       char   dummystr[64];
       char   namestr[64];
       char   valstr[64];
       char   attrstr[64];
       char   typestr[64];
       char   vendorstr[64];
       int    line_no;
       DICT_ATTR     *attr;
       DICT_VALUE    *dval;
       DICT_VENDOR   *v;
       char   buffer[256];
       int    value;
       int    type;
       int    vendor;
       int    is_attrib;
#ifdef ATTRIB_NMC
       int    vendor_usr_seen = 0;
       int    is_nmc = 0;
#endif

       if (fn == NULL) dict_free();

       if (fn) {
              if (fn[0] == '/')
                     strNcpy(buffer, fn, sizeof(buffer));
              else
                     sprintf(buffer, "%.127s/%.127s", radius_dir, fn);
       } else
              sprintf(buffer, "%.200s/%.50s", radius_dir, RADIUS_DICTIONARY);

       if((dictfd = fopen(buffer, "r")) == (FILE *)NULL) {
              log(L_CONS|L_ERR, "dict_init: Couldn't open dictionary: %s",
                     buffer);
              return(-1);
       }

       line_no = 0;
       while(fgets(buffer, sizeof(buffer), dictfd) != (char *)NULL) {
              line_no++;
              
              /* Skip empty space */
              if(*buffer == '#' || *buffer == '\0' || *buffer == '\n') {
                     continue;
              }

              if (strncasecmp(buffer, "$INCLUDE", 8) == 0) {

                     /* Read the $INCLUDE line */
                     if(sscanf(buffer, "%63s%63s", dummystr, valstr) != 2) {
                            log(L_ERR,
                     "%s: Invalid filename on line %d of dictionary\n",
                                   progname, line_no);
                            return(-1);
                     }
                     if (dict_init(valstr) < 0)
                            return -1;
                     continue;
              }

              is_attrib = 0;
              if (strncmp(buffer, "ATTRIBUTE", 9) == 0)
                     is_attrib = 1;
#ifdef ATTRIB_NMC
              is_nmc = 0;
              if (strncmp(buffer, "ATTRIB_NMC", 10) == 0)
                     is_attrib = is_nmc = 1;
#endif
              if (is_attrib) {
                     /* Read the ATTRIBUTE line */
                     vendor = 0;
                     vendorstr[0] = 0;
                     if(sscanf(buffer, "%63s%63s%63s%63s%63s", dummystr,
                            namestr, valstr, typestr, vendorstr) < 4) {
                            log(L_ERR,
                     "%s: Invalid attribute on line %d of dictionary\n",
                                   progname, line_no);
                            return(-1);
                     }

#ifdef ATTRIB_NMC
                     /*
                      *     Convert ATTRIB_NMC into our format.
                      *     We might need to add USR to the list of
                      *     vendors first.
                      */
                     if (is_nmc && vendorstr[0] == 0) {
                            if (!vendor_usr_seen) {
                                   if (addvendor("USR", VENDORPEC_USR) < 0)
                                          return -1;
                                   vendor_usr_seen = 1;
                            }
                            strcpy(vendorstr, "USR");
                     }
#endif

                     /*
                      * Validate all entries
                      */
                     if(strlen(namestr) > 31) {
                            log(L_ERR|L_CONS,
              "dict_init: Invalid name length on line %d of dictionary",
                                   line_no);
                            return(-1);
                     }

                     if(!isdigit(*valstr)) {
                            log(L_ERR|L_CONS,
                     "dict_init: Invalid value on line %d of dictionary",
                                   line_no);
                            return(-1);
                     }
                     if (valstr[0] != '0')
                            value = atoi(valstr);
                     else
                            sscanf(valstr, "%i", &value);

                     if(strcmp(typestr, "string") == 0) {
                            type = PW_TYPE_STRING;
                     }
                     else if(strcmp(typestr, "integer") == 0) {
                            type = PW_TYPE_INTEGER;
                     }
                     else if(strcmp(typestr, "ipaddr") == 0) {
                            type = PW_TYPE_IPADDR;
                     }
                     else if(strcmp(typestr, "date") == 0) {
                            type = PW_TYPE_DATE;
                     }
                     else {
                            log(L_ERR|L_CONS,
                     "dict_init: Invalid type on line %d of dictionary",
                                   line_no);
                            return(-1);
                     }

                     for (v = dictionary_vendors; v; v = v->next) {
                            if (strcmp(vendorstr, v->vendorname) == 0)
                                   vendor = v->vendorcode;
                     }
                     if (vendorstr[0] && !vendor) {
                            log(L_ERR|L_CONS,
                     "dict_init: unknown vendor %s on line %d of dictionary",
                            vendorstr, line_no);
                            return -1;
                     }

#ifdef COMPAT_1543
                     /*
                      *     Convert old values 221,1036-1039 to the new
                      *     ones, in case the dictionary is still the
                      *     one from 1.5.4.3
                      *
                      *     XXX - this is a HACK !!
                      */
                     switch (value) {
                            case 221:
                                   value = PW_HUNTGROUP_NAME;
                                   break;
                            case 1036:
                                   value = PW_FALL_THROUGH;
                                   break;
                            case 1037:
                                   value = PW_ADD_PORT_TO_IP_ADDRESS;
                                   break;
                            case 1038:
                                   value = PW_EXEC_PROGRAM;
                                   break;
                            case 1039:
                                   value = PW_EXEC_PROGRAM_WAIT;
                                   break;
                     }
#endif
                     /* Create a new attribute for the list */
                     if((attr = (DICT_ATTR *)malloc(sizeof(DICT_ATTR))) ==
                                   (DICT_ATTR *)NULL) {
                            log(L_ERR|L_CONS, "dict_init: out of memory");
                            return(-1);
                     }
                     strNcpy(attr->name, namestr, sizeof(attr->name));
                     attr->value = value;
                     attr->type = type;
                     if (vendor)
                            attr->value |= (vendor << 16);

                     /*
                      *     Add to the front of the list, so that
                      *     values at the end of the file override
                      *     those in the begin.
                      */
                     attr->next = dictionary_attributes;
                     dictionary_attributes = attr;

              }
              else if (strncmp(buffer, "VALUE", 5) == 0) {

                     /* Read the VALUE line */
                     if(sscanf(buffer, "%63s%63s%63s%63s", dummystr, attrstr,
                                          namestr, valstr) != 4) {
                            log(L_ERR|L_CONS,
              "dict_init: Invalid value entry on line %d of dictionary",
                                   line_no);
                            return(-1);
                     }

                     /*
                      * Validate all entries
                      */
                     if(strlen(attrstr) > 31) {
                            log(L_ERR|L_CONS,
              "dict_init: Invalid attribute length on line %d of dictionary",
                                   line_no);
                            return(-1);
                     }

                     if(strlen(namestr) > 31) {
                            log(L_ERR|L_CONS,
              "dict_init: Invalid name length on line %d of dictionary",
                                   line_no);
                            return(-1);
                     }

                     if(!isdigit(*valstr)) {
                            log(L_ERR|L_CONS,
                     "dict_init: Invalid value on line %d of dictionary",
                                   line_no);
                            return(-1);
                     }
                     value = atoi(valstr);

                     /* Create a new VALUE entry for the list */
                     if((dval = (DICT_VALUE *)malloc(sizeof(DICT_VALUE))) ==
                                   (DICT_VALUE *)NULL) {
                            log(L_ERR|L_CONS, "dict_init: out of memory");
                            return(-1);
                     }
                     strNcpy(dval->attrname, attrstr, sizeof(dval->attrname));
                     strNcpy(dval->name, namestr, sizeof(dval->name));
                     dval->value = value;

                     /* Insert at front. */
                     dval->next = dictionary_values;
                     dictionary_values = dval;
              }
              else if(strncmp(buffer, "VENDOR", 6) == 0) {

                     /* Read the VENDOR line */
                     if(sscanf(buffer, "%63s%63s%63s", dummystr, attrstr,
                                          valstr) != 3) {
                            log(L_ERR|L_CONS,
              "dict_init: Invalid vendor entry on line %d of dictionary",
                                   line_no);
                            return(-1);
                     }

                     /*
                      * Validate all entries
                      */
                     if(strlen(attrstr) > 31) {
                            log(L_ERR|L_CONS,
              "dict_init: Invalid attribute length on line %d of dictionary",
                                   line_no);
                            return(-1);
                     }

                     if(!isdigit(*valstr)) {
                            log(L_ERR|L_CONS,
                     "dict_init: Invalid value on line %d of dictionary",
                                   line_no);
                            return(-1);
                     }
                     value = atoi(valstr);

                     /* Create a new VENDOR entry for the list */
                     if (addvendor(attrstr, value) < 0)
                            return -1;
#ifdef ATTRIB_NMC
                     if (value == VENDORPEC_USR)
                            vendor_usr_seen = 1;
#endif
              }
       }
       fclose(dictfd);
       return(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

DICT_VALUE* dict_valfind ( char *  )

Definition at line 456 of file dict.c.

{
       DICT_VALUE    *val;

       val = dictionary_values;
       while(val != (DICT_VALUE *)NULL) {
              if(DICT_STRCMP(val->name, valname) == 0) {
                     return(val);
              }
              val = val->next;
       }
       return((DICT_VALUE *)NULL);
}
DICT_VALUE* dict_valget ( UINT4  value,
char *   
)

Definition at line 481 of file dict.c.

{
       DICT_VALUE    *val;

       val = dictionary_values;
       while(val != (DICT_VALUE *)NULL) {
              if(DICT_STRCMP(val->attrname, attrname) == 0 &&
                                          val->value == value) {
                     return(val);
              }
              val = val->next;
       }
       return((DICT_VALUE *)NULL);
}

Here is the caller graph for this function:

int dict_vendorcode ( int  )

Definition at line 516 of file dict.c.

{
       DICT_VENDOR   *v;

       for (v = dictionary_vendors; v; v = v->next)
              if (v->vendorpec == pec)
                     break;

       return v ? v->vendorcode : 0;
}
int dict_vendorpec ( int  )

Definition at line 502 of file dict.c.

{
       DICT_VENDOR   *v;

       for (v = dictionary_vendors; v; v = v->next)
              if (v->vendorcode == code)
                     break;

       return v ? v->vendorpec : 0;
}
void fprint_attr_list ( FILE *  ,
VALUE_PAIR  
)

Definition at line 63 of file attrprint.c.

{
       while(pair) {
              fprintf(fd, "    ");
              fprint_attr_val(fd, pair);
              fprintf(fd, "\n");
              pair = pair->next;
       }
}

Here is the call graph for this function:

void fprint_attr_val ( FILE *  ,
VALUE_PAIR  
)

Definition at line 78 of file attrprint.c.

{
       DICT_VALUE    *dict_valget();
       DICT_VALUE    *dval;
       char          buffer[32];
       u_char        *ptr;
       UINT4         vendor;
       int           i, left;

       switch(pair->type) {

       case PW_TYPE_STRING:
              fprintf(fd, "%s = \"", pair->name);
              ptr = (u_char *)pair->strvalue;
              if (pair->attribute != PW_VENDOR_SPECIFIC) {
                     left = pair->length;
                     while(left-- > 0) {
                            /*
                             *     Ugh! Ascend gear sends "foo"
                             *     as "foo\0", length 4.
                             *     Suppress trailing zeros.
                             */
                            if (left == 0 && *ptr == 0)
                                   break;
                            if(!(isprint(*ptr)))
                                   fprintf(fd, "\\%03o", *ptr);
                            else
                                   fputc(*ptr, fd);
                            ptr++;
                     }
                     fputc('"', fd);
                     break;
              }
              /*
               *     Special format, print out as much
               *     info as we can.
               */
              if (pair->length < 6) {
                     fprintf(fd, "(invalid length: %d)\"", pair->length);
                     break;
              }
              memcpy(&vendor, ptr, 4);
              ptr += 4;
              fprintf(fd, "V%d", (int)ntohl(vendor));
              left = pair->length - 4;
              while (left >= 2) {
                     fprintf(fd, ":T%d:L%d:", ptr[0], ptr[1]);
                     left -= 2;
                     ptr += 2;
                     i = ptr[1] - 2;
                     while (i > 0 && left > 0) {
                            if(!(isprint(*ptr)))
                                   fprintf(fd, "\\%03o", *ptr);
                            else
                                   fputc(*ptr, fd);
                            ptr++;
                            i--;
                            left--;
                     }
              }
              fputc('"', fd);
              break;

       case PW_TYPE_INTEGER:
              dval = dict_valget(pair->lvalue, pair->name);
              if(dval != (DICT_VALUE *)NULL) {
                     fprintf(fd, "%s = %s", pair->name, dval->name);
              }
              else {
                     fprintf(fd, "%s = %ld", pair->name, (long)pair->lvalue);
              }
              break;

       case PW_TYPE_IPADDR:
              ipaddr2str(buffer, pair->lvalue);
              fprintf(fd, "%s = %s", pair->name, buffer);
              break;

       case PW_TYPE_DATE:
              strftime(buffer, sizeof(buffer), "%b %e %Y",
                                   localtime((time_t *)&pair->lvalue));
              fprintf(fd, "%s = \"%s\"", pair->name, buffer);
              break;

       default:
              fprintf(fd, "Unknown type %d", pair->type);
              break;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

UINT4 get_ipaddr ( char *  )

Definition at line 77 of file util.c.

{
       struct hostent       *hp;
       UINT4         ipstr2long();

       if(good_ipaddr(host) == 0) {
              return(ipstr2long(host));
       }
       else if((hp = gethostbyname(host)) == (struct hostent *)NULL) {
              return((UINT4)0);
       }
       return(ntohl(*(UINT4 *)hp->h_addr));
}

Here is the call graph for this function:

Here is the caller graph for this function:

int good_ipaddr ( char *  )

Definition at line 95 of file util.c.

{
       int    dot_count;
       int    digit_count;

       dot_count = 0;
       digit_count = 0;
       while(*addr != '\0' && *addr != ' ') {
              if(*addr == '.') {
                     dot_count++;
                     digit_count = 0;
              }
              else if(!isdigit(*addr)) {
                     dot_count = 5;
              }
              else {
                     digit_count++;
                     if(digit_count > 3) {
                            dot_count = 5;
                     }
              }
              addr++;
       }
       if(dot_count != 3) {
              return(-1);
       }
       else {
              return(0);
       }
}

Here is the caller graph for this function:

int hints_setup ( VALUE_PAIR request_pairs)
int huntgroup_access ( VALUE_PAIR request_pairs)
char* ip_hostname ( UINT4  )

Definition at line 57 of file util.c.

{
       struct        hostent *hp;
       static char   hstname[128];
       UINT4         n_ipaddr;

       n_ipaddr = htonl(ipaddr);
       hp = gethostbyaddr((char *)&n_ipaddr, sizeof (struct in_addr), AF_INET);
       if (hp == 0) {
              ipaddr2str(hstname, ipaddr);
              return(hstname);
       }
       return (char *)hp->h_name;
}

Here is the call graph for this function:

void ipaddr2str ( char *  ,
UINT4   
)

Definition at line 131 of file util.c.

{
       int    addr_byte[4];
       int    i;
       UINT4  xbyte;

       for(i = 0;i < 4;i++) {
              xbyte = ipaddr >> (i*8);
              xbyte = xbyte & (UINT4)0x000000FF;
              addr_byte[i] = xbyte;
       }
       sprintf(buffer, "%u.%u.%u.%u", addr_byte[3], addr_byte[2],
              addr_byte[1], addr_byte[0]);
}

Here is the caller graph for this function:

UINT4 ipstr2long ( char *  )

Definition at line 151 of file util.c.

{
       char   buf[6];
       char   *ptr;
       int    i;
       int    count;
       UINT4  ipaddr;
       int    cur_byte;

       ipaddr = (UINT4)0;
       for(i = 0;i < 4;i++) {
              ptr = buf;
              count = 0;
              *ptr = '\0';
              while(*ip_str != '.' && *ip_str != '\0' && count < 4) {
                     if(!isdigit(*ip_str)) {
                            return((UINT4)0);
                     }
                     *ptr++ = *ip_str++;
                     count++;
              }
              if(count >= 4 || count == 0) {
                     return((UINT4)0);
              }
              *ptr = '\0';
              cur_byte = atoi(buf);
              if(cur_byte < 0 || cur_byte > 255) {
                     return((UINT4)0);
              }
              ip_str++;
              ipaddr = ipaddr << 8 | (UINT4)cur_byte;
       }
       return(ipaddr);
}

Here is the caller graph for this function:

int log ( int  ,
char *  ,
  ... 
)

Definition at line 109 of file log.c.

{
       va_list ap;
       int r;

       va_start(ap, msg);
       r = do_log(lvl, msg, ap);
       va_end(ap);

       return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int log_debug ( char *  ,
  ... 
)

Definition at line 97 of file log.c.

{
       va_list ap;
       int r;

       va_start(ap, msg);
       r = do_log(L_DBG, msg, ap);
       va_end(ap);

       return r;
}

Here is the call graph for this function:

int log_err ( char *  )
void md5_calc ( u_char *  ,
u_char *  ,
u_int   
)
NAS* nas_find ( UINT4  ipno)
char* nas_name ( UINT4  ipno)
char* nas_name2 ( AUTH_REQ r)
void pairadd ( VALUE_PAIR **  ,
VALUE_PAIR  
)

Definition at line 261 of file util.c.

{
       VALUE_PAIR *i;

       new->next = NULL;
       if (*first == NULL) {
              *first = new;
              return;
       }
       for(i = *first; i->next; i = i->next)
              ;
       i->next = new;
}
void pairdelete ( VALUE_PAIR **  ,
int   
)

Definition at line 241 of file util.c.

{
       VALUE_PAIR *i, *next, *last = NULL;

       for(i = *first; i; i = next) {
              next = i->next;
              if (i->attribute == attr) {
                     if (last)
                            last->next = next;
                     else
                            *first = next;
                     free(i);
              } else
                     last = i;
       }
}
VALUE_PAIR* pairfind ( VALUE_PAIR ,
int   
)

Definition at line 230 of file util.c.

{
       while(first && first->attribute != attr)
              first = first->next;
       return first;
}
void pairfree ( VALUE_PAIR )

Definition at line 215 of file util.c.

{
       VALUE_PAIR    *next;

       while(pair != NULL) {
              next = pair->next;
              free(pair);
              pair = next;
       }
}

Here is the caller graph for this function:

void pairmove ( VALUE_PAIR **  to,
VALUE_PAIR **  from 
)
void pairmove2 ( VALUE_PAIR **  to,
VALUE_PAIR **  from,
int  attr 
)
void presuf_setup ( VALUE_PAIR request_pairs)
int presufcmp ( VALUE_PAIR check,
char *  name,
char *  rest,
int  rl 
)
int proxy_receive ( AUTH_REQ authreq,
int  activefd 
)
int proxy_send ( AUTH_REQ authreq,
int  activefd 
)
int rad_accounting ( AUTH_REQ ,
int   
)
int rad_accounting_orig ( AUTH_REQ ,
int  ,
char *   
)
int rad_auth_init ( AUTH_REQ authreq,
int  activefd 
)
int rad_authenticate ( AUTH_REQ ,
int   
)
int rad_check_multi ( char *  name,
VALUE_PAIR request,
int  maxsimul 
)
struct passwd* rad_getpwnam ( char *  ) [read]

Definition at line 190 of file util.c.

{
       static struct passwd *lastpwd;
       static char lastname[64];
       static time_t lasttime = 0;
       time_t now;

       now = time(NULL);

       if ((now <= lasttime + 5 ) && strncmp(name, lastname, 64) == 0)
              return lastpwd;

       strncpy(lastname, name, 63);
       lastname[63] = 0;
       lastpwd = getpwnam(name);
       lasttime = now;

       return lastpwd;
}
int rad_send_reply ( int  ,
AUTH_REQ ,
VALUE_PAIR ,
char *  ,
int   
)
int radius_exec_program ( char *  ,
VALUE_PAIR ,
VALUE_PAIR **  ,
int  ,
char **  user_msg 
)
char* radius_xlate ( char *  ,
VALUE_PAIR req,
VALUE_PAIR reply 
)
AUTH_REQ* radrecv ( UINT4  ,
u_short  ,
u_char *  ,
int   
)
int radzap ( UINT4  nas,
int  port,
char *  user,
time_t  t 
)
int read_clients_file ( char *  )
int read_config_files ( void  )
int read_naslist_file ( char *  )
REALM* realm_find ( char *  )
void sig_cleanup ( int  )
char* strNcpy ( char *  dest,
char *  src,
int  n 
)

Definition at line 311 of file util.c.

{
       if (n > 0)
              strncpy(dest, src, n);
       else
              n = 1;
       dest[n - 1] = 0;

       return dest;
}

Here is the caller graph for this function:

int timestr_match ( char *  ,
time_t   
)
int user_find ( char *  name,
VALUE_PAIR ,
VALUE_PAIR **  ,
VALUE_PAIR **   
)
int userparse ( char *  buffer,
VALUE_PAIR **  first_pair 
)
char* uue ( void *  )
void version ( )

Here is the caller graph for this function:


Variable Documentation

int acct_port
int auth_port

Definition at line 71 of file check_radius.c.

int log_auth
char* progname

Definition at line 39 of file check_http-with-client-certificate.c.

char* radacct_dir
char* radius_dir

Definition at line 69 of file check_radius.c.

char* recv_buffer

Definition at line 62 of file check_radius.c.

char* send_buffer

Definition at line 61 of file check_radius.c.

int use_dbm

Definition at line 169 of file radiusd.h.