basic_radius_auth.cc File Reference
#include "squid.h"
#include "auth/basic/RADIUS/radius-util.h"
#include "auth/basic/RADIUS/radius.h"
#include "base/Random.h"
#include "helper/protocol_defines.h"
#include "md5.h"
#include <cctype>
#include <cerrno>
#include <cstring>
#include <ctime>
Include dependency graph for basic_radius_auth.cc:

Go to the source code of this file.

Macros

#define MAXPWNAM   254
 
#define MAXPASS   254
 
#define MAXLINE   254
 

Functions

static void md5_calc (uint8_t out[16], void *in, size_t len)
 
static int timeval_diff (const struct timeval *a, const struct timeval *b)
 
static int time_since (const struct timeval *when)
 
static int result_recv (char *buffer, int length)
 
static void random_vector (char *aVector)
 
static int rad_auth_config (const char *cfname)
 
static void urldecode (char *dst, const char *src, int size)
 
static void authenticate (int socket_fd, const char *username, const char *passwd)
 
int main (int argc, char **argv)
 

Variables

static int i_send_buffer [2048]
 
static int i_recv_buffer [2048]
 
static char * send_buffer = (char *) i_send_buffer
 
static char * recv_buffer = (char *) i_recv_buffer
 
static int sockfd
 
static u_char request_id
 
static char vector [AUTH_VECTOR_LEN]
 
static char secretkey [MAXPASS+1] = ""
 
static char server [MAXLINE] = ""
 
static char identifier [MAXLINE] = ""
 
static char svc_name [MAXLINE] = "radius"
 
static int nasport = 111
 
static int nasporttype = 0
 
static uint32_t nas_ipaddr
 
static uint32_t auth_ipaddr
 
static int retries = 10
 
char progname [] = "basic_radius_auth"
 

Macro Definition Documentation

◆ MAXLINE

#define MAXLINE   254

Definition at line 98 of file basic_radius_auth.cc.

◆ MAXPASS

#define MAXPASS   254

Definition at line 97 of file basic_radius_auth.cc.

◆ MAXPWNAM

#define MAXPWNAM   254

Definition at line 96 of file basic_radius_auth.cc.

Function Documentation

◆ authenticate()

◆ main()

◆ md5_calc()

static void md5_calc ( uint8_t  out[16],
void *  in,
size_t  len 
)
static

Definition at line 154 of file basic_radius_auth.cc.

References SquidMD5Final(), SquidMD5Init(), and SquidMD5Update().

Referenced by authenticate(), and result_recv().

◆ rad_auth_config()

static int rad_auth_config ( const char *  cfname)
static

Definition at line 224 of file basic_radius_auth.cc.

References identifier, MAXLINE, retries, secretkey, server, and svc_name.

Referenced by main().

◆ random_vector()

static void random_vector ( char *  aVector)
static

Definition at line 207 of file basic_radius_auth.cc.

References AUTH_VECTOR_LEN, and RandomSeed32().

Referenced by authenticate().

◆ result_recv()

static int result_recv ( char *  buffer,
int  length 
)
static

◆ time_since()

static int time_since ( const struct timeval *  when)
static

Definition at line 143 of file basic_radius_auth.cc.

References now, and timeval_diff().

Referenced by authenticate().

◆ timeval_diff()

static int timeval_diff ( const struct timeval *  a,
const struct timeval *  b 
)
static

Definition at line 134 of file basic_radius_auth.cc.

Referenced by time_since().

◆ urldecode()

static void urldecode ( char *  dst,
const char *  src,
int  size 
)
static

Definition at line 255 of file basic_radius_auth.cc.

References size.

Referenced by main().

Variable Documentation

◆ auth_ipaddr

uint32_t auth_ipaddr
static

Definition at line 116 of file basic_radius_auth.cc.

Referenced by main().

◆ i_recv_buffer

int i_recv_buffer[2048]
static

Definition at line 103 of file basic_radius_auth.cc.

Referenced by authenticate().

◆ i_send_buffer

int i_send_buffer[2048]
static

Definition at line 102 of file basic_radius_auth.cc.

◆ identifier

char identifier[MAXLINE] = ""
static

Definition at line 111 of file basic_radius_auth.cc.

Referenced by authenticate(), main(), rad_auth_config(), and time_Inst().

◆ nas_ipaddr

uint32_t nas_ipaddr
static

Definition at line 115 of file basic_radius_auth.cc.

Referenced by authenticate(), and main().

◆ nasport

int nasport = 111
static

Definition at line 113 of file basic_radius_auth.cc.

Referenced by authenticate().

◆ nasporttype

int nasporttype = 0
static

Definition at line 114 of file basic_radius_auth.cc.

Referenced by authenticate().

◆ progname

char progname[] = "basic_radius_auth"

◆ recv_buffer

char* recv_buffer = (char *) i_recv_buffer
static

Definition at line 105 of file basic_radius_auth.cc.

Referenced by authenticate().

◆ request_id

u_char request_id
static

Definition at line 107 of file basic_radius_auth.cc.

Referenced by authenticate(), and result_recv().

◆ retries

◆ secretkey

char secretkey[MAXPASS+1] = ""
static

Definition at line 109 of file basic_radius_auth.cc.

Referenced by authenticate(), main(), rad_auth_config(), and result_recv().

◆ send_buffer

char* send_buffer = (char *) i_send_buffer
static

Definition at line 104 of file basic_radius_auth.cc.

Referenced by authenticate().

◆ server

◆ sockfd

◆ svc_name

char svc_name[MAXLINE] = "radius"
static

Definition at line 112 of file basic_radius_auth.cc.

Referenced by main(), and rad_auth_config().

◆ vector

char vector[AUTH_VECTOR_LEN]
static

Definition at line 108 of file basic_radius_auth.cc.

Referenced by authenticate(), Rock::SwapDir::getOptionTree(), and result_recv().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors