#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>
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()
|
static |
Definition at line 279 of file basic_radius_auth.cc.
References AUTH_HDR_LEN, AUTH_VECTOR_LEN, pw_auth_hdr::code, pw_auth_hdr::data, i_recv_buffer, pw_auth_hdr::id, identifier, pw_auth_hdr::length, MAXPASS, MAXPWNAM, md5_calc(), nas_ipaddr, nasport, nasporttype, progname, PW_AUTHENTICATION_REQUEST, PW_NAS_ID, PW_NAS_IP_ADDRESS, PW_NAS_PORT_ID, PW_NAS_PORT_TYPE, PW_PASSWORD, PW_USER_NAME, random_vector(), recv_buffer, request_id, result_recv(), retries, secretkey, send_buffer, SEND_ERR, SEND_OK, time_since(), vector, pw_auth_hdr::vector, and xstrerr().
Referenced by main(), and Auth::UserRequest::tryToAuthenticateAndSetAuthUser().
◆ main()
Definition at line 467 of file basic_radius_auth.cc.
References auth_ipaddr, authenticate(), debug_enabled, get_ipaddr(), getopt(), HELPER_INPUT_BUFFER, identifier, MAXPASS, MAXPWNAM, nas_ipaddr, optarg, PW_AUTH_UDP_PORT, rad_auth_config(), retries, secretkey, SEND_ERR, server, sockfd, svc_name, urldecode(), Win32SockCleanup(), and xstrerr().
◆ md5_calc()
|
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 |
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 |
Definition at line 207 of file basic_radius_auth.cc.
References AUTH_VECTOR_LEN, and RandomSeed32().
Referenced by authenticate().
◆ result_recv()
Definition at line 166 of file basic_radius_auth.cc.
References AUTH_VECTOR_LEN, pw_auth_hdr::code, debug(), pw_auth_hdr::id, pw_auth_hdr::length, md5_calc(), PW_AUTHENTICATION_ACK, request_id, secretkey, vector, and pw_auth_hdr::vector.
Referenced by authenticate().
◆ time_since()
|
static |
Definition at line 143 of file basic_radius_auth.cc.
References now, and timeval_diff().
Referenced by authenticate().
◆ timeval_diff()
|
static |
Definition at line 134 of file basic_radius_auth.cc.
Referenced by time_since().
◆ urldecode()
|
static |
Variable Documentation
◆ auth_ipaddr
|
static |
Definition at line 116 of file basic_radius_auth.cc.
Referenced by main().
◆ i_recv_buffer
|
static |
Definition at line 103 of file basic_radius_auth.cc.
Referenced by authenticate().
◆ i_send_buffer
|
static |
Definition at line 102 of file basic_radius_auth.cc.
◆ identifier
|
static |
Definition at line 111 of file basic_radius_auth.cc.
Referenced by authenticate(), main(), rad_auth_config(), and time_Inst().
◆ nas_ipaddr
|
static |
Definition at line 115 of file basic_radius_auth.cc.
Referenced by authenticate(), and main().
◆ nasport
|
static |
Definition at line 113 of file basic_radius_auth.cc.
Referenced by authenticate().
◆ nasporttype
|
static |
Definition at line 114 of file basic_radius_auth.cc.
Referenced by authenticate().
◆ progname
char progname[] = "basic_radius_auth" |
Definition at line 119 of file basic_radius_auth.cc.
Referenced by authenticate(), Helper::Client::openSessions(), statefulhelper::openSessions(), and usage().
◆ recv_buffer
|
static |
Definition at line 105 of file basic_radius_auth.cc.
Referenced by authenticate().
◆ request_id
|
static |
Definition at line 107 of file basic_radius_auth.cc.
Referenced by authenticate(), and result_recv().
◆ retries
|
static |
Definition at line 117 of file basic_radius_auth.cc.
Referenced by authenticate(), main(), Snmp::Session::pack(), rad_auth_config(), Snmp::Session::unpack(), and Ipc::UdsSender::wrote().
◆ secretkey
|
static |
Definition at line 109 of file basic_radius_auth.cc.
Referenced by authenticate(), main(), rad_auth_config(), and result_recv().
◆ send_buffer
|
static |
Definition at line 104 of file basic_radius_auth.cc.
Referenced by authenticate().
◆ server
|
static |
Definition at line 110 of file basic_radius_auth.cc.
Referenced by PeerSelector::addSelection(), auth_html(), check_domain(), Ssl::checkX509ServerValidity(), connectTo(), GetAvgStat(), Ip::Qos::getTosFromServer(), Ftp::Server::handlePasvReply(), Ftp::Server::handleReply(), idnsGrokReply(), idnsShutdownAndFreeState(), idnsStats(), main(), Http::One::Server::noteTakeServerConnectionControl(), rad_auth_config(), HierarchyLogEntry::resetPeerNotes(), serverSocket(), SMB_Connect_Server(), snmp_netDnsFn(), ssl_verify_cb(), Security::PeerConnector::sslCrtvdHandleReply(), and FwdState::syncHierNote().
◆ sockfd
|
static |
Definition at line 106 of file basic_radius_auth.cc.
Referenced by action(), commonCode(), connectTo(), getSocketNoDelay(), main(), serverSocket(), setSocketBuffers(), and setSocketNoDelay().
◆ svc_name
|
static |
Definition at line 112 of file basic_radius_auth.cc.
Referenced by main(), and rad_auth_config().
◆ vector
|
static |
Definition at line 108 of file basic_radius_auth.cc.
Referenced by authenticate(), Rock::SwapDir::getOptionTree(), and result_recv().