All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
radiusd.h File Reference

Structures, prototypes and global variables for the FreeRADIUS server. More...

#include <freeradius-devel/libradius.h>
#include <freeradius-devel/conf.h>
#include <freeradius-devel/conffile.h>
#include <freeradius-devel/event.h>
#include <freeradius-devel/connection.h>
#include <freeradius-devel/log.h>
#include <sys/wait.h>
#include <freeradius-devel/stats.h>
#include <freeradius-devel/realms.h>
#include <freeradius-devel/xlat.h>
#include <freeradius-devel/tmpl.h>
#include <freeradius-devel/map.h>
#include <freeradius-devel/clients.h>
#include <freeradius-devel/process.h>
#include <pwd.h>
#include <grp.h>
+ Include dependency graph for radiusd.h:

Go to the source code of this file.

Data Structures

struct  main_config
 Main server configuration. More...
 
struct  rad_request
 
struct  rad_request.log
 

Macros

#define CLEANUP_DELAY   5
 
#define DEAD_TIME   120
 
#define EXEC_TIMEOUT   10
 
#define MAX_REQUEST_TIME   30
 
#define MAX_REQUESTS   256
 
#define MEM(x)   if (!(x)) { ERROR("%s[%u] OUT OF MEMORY", __FILE__, __LINE__); _fr_exit_now(__FILE__, __LINE__, 1); }
 
#define pair_make_config(_a, _b, _c)   fr_pair_make(request, &request->config, _a, _b, _c)
 
#define pair_make_reply(_a, _b, _c)   fr_pair_make(request->reply, &request->reply->vps, _a, _b, _c)
 
#define pair_make_request(_a, _b, _c)   fr_pair_make(request->packet, &request->packet->vps, _a, _b, _c)
 
#define PW_RADMIN_PORT   18120
 
#define rad_fork(n)   fork()
 
#define RAD_REQUEST_LVL_DEBUG   (1)
 
#define RAD_REQUEST_LVL_DEBUG2   (2)
 
#define RAD_REQUEST_LVL_DEBUG3   (3)
 
#define RAD_REQUEST_LVL_DEBUG4   (4)
 
#define RAD_REQUEST_LVL_NONE   (0)
 No debug messages should be printed. More...
 
#define RAD_REQUEST_OPTION_COA   (1 << 0)
 
#define RAD_REQUEST_OPTION_CTX   (1 << 1)
 
#define rad_waitpid(a, b)   waitpid(a,b, 0)
 
#define REQUEST_CHILD_NUM_STATES   (REQUEST_DONE + 1)
 
#define REQUEST_MAGIC   (0xdeadbeef)
 
#define REQUEST_MASTER_NUM_STATES   (REQUEST_COUNTED + 1)
 
#define RETRY_COUNT   3
 
#define RETRY_DELAY   5
 
#define SECONDS_PER_DAY   86400
 
#define VERIFY_REQUEST(_x)   rad_assert(_x)
 

Typedefs

typedef enum event_corral_t event_corral_t
 
typedef struct fr_cond_t fr_cond_t
 
typedef struct main_config main_config_t
 Main server configuration. More...
 
typedef int(* RAD_COMPARE_FUNC )(void *instance, REQUEST *, VALUE_PAIR *, VALUE_PAIR *, VALUE_PAIR *, VALUE_PAIR **)
 
typedef struct rad_request REQUEST
 
typedef struct request_data_t request_data_t
 
typedef enum request_fail request_fail_t
 
typedef enum rlm_rcodes rlm_rcode_t
 Return codes indicating the result of the module call. More...
 

Enumerations

enum  event_corral_t {
  EVENT_CORRAL_MAIN = 0,
  EVENT_CORRAL_AUX
}
 
enum  rad_child_state_t {
  REQUEST_QUEUED = 1,
  REQUEST_RUNNING,
  REQUEST_PROXIED,
  REQUEST_RESPONSE_DELAY,
  REQUEST_CLEANUP_DELAY,
  REQUEST_DONE
}
 
enum  rad_master_state_t {
  REQUEST_ACTIVE = 1,
  REQUEST_STOP_PROCESSING,
  REQUEST_COUNTED
}
 
enum  radius_signal_t {
  RADIUS_SIGNAL_SELF_NONE = (0),
  RADIUS_SIGNAL_SELF_HUP = (1 << 0),
  RADIUS_SIGNAL_SELF_TERM = (1 << 1),
  RADIUS_SIGNAL_SELF_EXIT = (1 << 2),
  RADIUS_SIGNAL_SELF_DETAIL = (1 << 3),
  RADIUS_SIGNAL_SELF_NEW_FD = (1 << 4),
  RADIUS_SIGNAL_SELF_MAX = (1 << 5)
}
 
enum  request_fail {
  REQUEST_FAIL_UNKNOWN = 0,
  REQUEST_FAIL_NO_THREADS,
  REQUEST_FAIL_DECODE,
  REQUEST_FAIL_PROXY,
  REQUEST_FAIL_PROXY_SEND,
  REQUEST_FAIL_NO_RESPONSE,
  REQUEST_FAIL_HOME_SERVER,
  REQUEST_FAIL_HOME_SERVER2,
  REQUEST_FAIL_HOME_SERVER3,
  REQUEST_FAIL_NORMAL_REJECT,
  REQUEST_FAIL_SERVER_TIMEOUT
}
 
enum  rlm_rcodes {
  RLM_MODULE_REJECT = 0,
  RLM_MODULE_FAIL,
  RLM_MODULE_OK,
  RLM_MODULE_HANDLED,
  RLM_MODULE_INVALID,
  RLM_MODULE_USERLOCK,
  RLM_MODULE_NOTFOUND,
  RLM_MODULE_NOOP,
  RLM_MODULE_UPDATED,
  RLM_MODULE_NUMCODES,
  RLM_MODULE_UNKNOWN
}
 Return codes indicating the result of the module call. More...
 

Functions

char * auth_name (char *buf, size_t buflen, REQUEST *request, bool do_cli)
 
void debug_pair (VALUE_PAIR *)
 Print a single valuepair to stderr or error log. More...
 
void exec_trigger (REQUEST *request, CONF_SECTION *cs, char const *name, bool quench) CC_HINT(nonnull(3))
 Execute a trigger - call an executable to process an event. More...
 
int void exec_trigger_set_conf (CONF_SECTION *cs)
 Set the global trigger section exec_trigger will search in. More...
 
char const * get_radius_dir (void)
 Get the global radius config directory. More...
 
void hup_logfile (void)
 
rad_listen_tlistener_find_byipaddr (fr_ipaddr_t const *ipaddr, uint16_t port, int proto)
 Find a listener associated with an IP address/port/transport proto. More...
 
RADCLIENT_LISTlistener_find_client_list (fr_ipaddr_t const *ipaddr, uint16_t port, int proto)
 Find client list associated with a listener. More...
 
int log_err (char *)
 
int main_config_free (void)
 
void main_config_hup (void)
 
int main_config_init (void)
 
void mark_home_server_dead (home_server_t *home, struct timeval *when)
 
void module_failure_msg (REQUEST *request, char const *fmt,...) CC_HINT(format(printf
 
int paircompare (REQUEST *request, VALUE_PAIR *req_list, VALUE_PAIR *check, VALUE_PAIR **rep_list)
 Compare two pair lists except for the password information. More...
 
int paircompare_register (fr_dict_attr_t const *attribute, fr_dict_attr_t const *from, bool first_only, RAD_COMPARE_FUNC func, void *instance)
 Register a function as compare function. More...
 
int paircompare_register_byname (char const *name, fr_dict_attr_t const *from, bool first_only, RAD_COMPARE_FUNC func, void *instance)
 Register a function as compare function. More...
 
void paircompare_unregister (fr_dict_attr_t const *attr, RAD_COMPARE_FUNC func)
 Unregister comparison function for an attribute. More...
 
void paircompare_unregister_instance (void *instance)
 Unregister comparison function for a module. More...
 
void pairlist_free (PAIR_LIST **)
 
int pairlist_read (TALLOC_CTX *ctx, char const *file, PAIR_LIST **list, int complain)
 
int rad_accounting (REQUEST *)
 
char * rad_ajoin (TALLOC_CTX *ctx, char const **argv, int argc, char c)
 talloc a buffer to hold the concatenated value of all elements of argv More...
 
char * rad_asprint_gid (TALLOC_CTX *ctx, gid_t gid)
 
char * rad_asprint_uid (TALLOC_CTX *ctx, uid_t uid)
 Print uid to a string. More...
 
int rad_authenticate (REQUEST *)
 
int rad_check_lib_magic (uint64_t magic)
 Check if the application linking to the library has the correct magic number. More...
 
int rad_check_ts (uint32_t nasaddr, uint32_t nas_port, char const *user, char const *sessionid)
 
int rad_coa_recv (REQUEST *request)
 
void rad_const_free (void const *ptr)
 
int rad_copy_string (char *dst, char const *src)
 
int rad_copy_string_bare (char *dst, char const *src)
 
int rad_copy_variable (char *dst, char const *from)
 
char const * rad_default_lib_dir (void)
 Return the default lib dir. More...
 
char const * rad_default_log_dir (void)
 Return the default log dir. More...
 
char const * rad_default_raddb_dir (void)
 Return the default raddb dir. More...
 
char const * rad_default_run_dir (void)
 Return the default run dir. More...
 
char const * rad_default_sbin_dir (void)
 Return the default sbin dir. More...
 
int rad_expand_xlat (REQUEST *request, char const *cmd, int max_argc, char const *argv[], bool can_fail, size_t argv_buflen, char *argv_buf)
 Split string into words and expand each one. More...
 
void rad_file_error (int num)
 Write a file access error to the fr_strerror buffer, including euid/egid. More...
 
size_t rad_filename_escape (UNUSED REQUEST *request, char *out, size_t outlen, char const *in, UNUSED void *arg)
 Escapes the raw string such that it should be safe to use as part of a file path. More...
 
size_t rad_filename_make_safe (UNUSED REQUEST *request, char *out, size_t outlen, char const *in, UNUSED void *arg)
 Ensures that a filename cannot walk up the directory structure. More...
 
ssize_t rad_filename_unescape (char *out, size_t outlen, char const *in, size_t inlen)
 Converts data stored in a file name back to its original form. More...
 
pid_t rad_fork (void)
 
int rad_getgid (TALLOC_CTX *ctx, gid_t *out, char const *name)
 Resolve a group name to a GID. More...
 
int rad_getgrgid (TALLOC_CTX *ctx, struct group **out, gid_t gid)
 Resolve a gid to a group database entry. More...
 
int rad_getgrnam (TALLOC_CTX *ctx, struct group **out, char const *name)
 Resolve a group name to a group database entry. More...
 
int rad_getpwnam (TALLOC_CTX *ctx, struct passwd **out, char const *name)
 Resolve a username to a passwd entry. More...
 
int rad_getpwuid (TALLOC_CTX *ctx, struct passwd **out, uid_t uid)
 Resolve a uid to a passwd entry. More...
 
void * rad_malloc (size_t size)
 
int rad_mkdir (char *directory, mode_t mode, uid_t uid, gid_t gid)
 Create possibly many directories. More...
 
void rad_mode_to_oct (char out[5], mode_t mode)
 
void rad_mode_to_str (char out[10], mode_t mode)
 Convert mode_t into humanly readable permissions flags. More...
 
int rad_postauth (REQUEST *)
 
uint32_t rad_pps (uint32_t *past, uint32_t *present, time_t *then, struct timeval *now)
 
char const * rad_radacct_dir (void)
 Return the default radacct dir. More...
 
int rad_segid (gid_t gid)
 Alter the effective user id. More...
 
int rad_seuid (uid_t uid)
 Alter the effective user id. More...
 
int rad_status_server (REQUEST *request)
 
void rad_suid_down (void)
 
void rad_suid_down_permanent (void)
 
void rad_suid_set_down_uid (uid_t uid)
 
void rad_suid_up (void)
 
int rad_virtual_server (REQUEST *)
 
pid_t rad_waitpid (pid_t pid, int *status)
 
int radius_callback_compare (REQUEST *request, VALUE_PAIR *req, VALUE_PAIR *check, VALUE_PAIR *check_pairs, VALUE_PAIR **reply_pairs)
 Compare check and vp. More...
 
int radius_compare_vps (REQUEST *request, VALUE_PAIR *check, VALUE_PAIR *vp)
 
int radius_copy_vp (TALLOC_CTX *ctx, VALUE_PAIR **out, REQUEST *request, char const *name)
 Copy VP(s) from the specified request. More...
 
int radius_evaluate_cond (REQUEST *request, int modreturn, int depth, fr_cond_t const *c)
 Evaluate a fr_cond_t;. More...
 
int radius_evaluate_map (REQUEST *request, int modreturn, int depth, fr_cond_t const *c)
 
int radius_evaluate_tmpl (REQUEST *request, int modreturn, int depth, vp_tmpl_t const *vpt)
 
void radius_event_free (void)
 
int radius_event_init (TALLOC_CTX *ctx)
 
fr_event_list_tradius_event_list_corral (event_corral_t hint)
 
int radius_event_process (void)
 
int radius_event_start (bool spawn_flag)
 
int radius_exec_program (TALLOC_CTX *ctx, char *out, size_t outlen, VALUE_PAIR **output_pairs, REQUEST *request, char const *cmd, VALUE_PAIR *input_pairs, bool exec_wait, bool shell_escape, int timeout) CC_HINT(nonnull(5
 
int radius_find_compare (fr_dict_attr_t const *attribute)
 Find a comparison function for two attributes. More...
 
void void int radius_get_vp (VALUE_PAIR **out, REQUEST *request, char const *name)
 Return a VP from the specified request. More...
 
VALUE_PAIRradius_pair_create (TALLOC_CTX *ctx, VALUE_PAIR **vps, unsigned int attribute, unsigned int vendor)
 Create a VALUE_PAIR and add it to a list of VALUE_PAIR s. More...
 
void radius_pairmove (REQUEST *request, VALUE_PAIR **to, VALUE_PAIR *from, bool do_xlat) CC_HINT(nonnull)
 
int radius_readfrom_program (int fd, pid_t pid, int timeout, char *answer, int left)
 Read from the child process. More...
 
void radius_signal_self (int flag)
 
pid_t radius_start_program (char const *cmd, REQUEST *request, bool exec_wait, int *input_fd, int *output_fd, VALUE_PAIR *input_pairs, bool shell_escape)
 Start a process. More...
 
void radius_update_listener (rad_listen_t *listener)
 
int radius_xlat_do (REQUEST *request, VALUE_PAIR *vp)
 Expands an attribute marked with fr_pair_mark_xlat. More...
 
void rdebug_pair (log_lvl_t level, REQUEST *, VALUE_PAIR *, char const *)
 Print a single valuepair to stderr or error log. More...
 
void rdebug_pair_list (log_lvl_t level, REQUEST *, VALUE_PAIR *, char const *)
 Print a list of VALUE_PAIRs. More...
 
void rdebug_proto_pair_list (log_lvl_t level, REQUEST *, VALUE_PAIR *, char const *)
 Print a list of protocol VALUE_PAIRs. More...
 
REQUESTrequest_alloc (TALLOC_CTX *ctx)
 Create a new REQUEST data structure. More...
 
REQUESTrequest_alloc_coa (REQUEST *request)
 
REQUESTrequest_alloc_fake (REQUEST *oldreq)
 
int request_data_add (REQUEST *request, void *unique_ptr, int unique_int, void *opaque, bool free_on_replace, bool free_on_parent, bool persist)
 Add opaque data to a REQUEST. More...
 
int request_data_by_persistance (request_data_t **out, REQUEST *request, bool persist)
 Loop over all the request data, pulling out ones matching persist state. More...
 
void * request_data_get (REQUEST *request, void *unique_ptr, int unique_int)
 Get opaque data from a request. More...
 
void * request_data_reference (REQUEST *request, void *unique_ptr, int unique_int)
 Get opaque data from a request without removing it. More...
 
void request_data_restore (REQUEST *request, request_data_t *entry)
 Add request data back to a request. More...
 
void revive_home_server (void *ctx, struct timeval *now)
 
int session_zap (REQUEST *request, uint32_t nasaddr, uint32_t nas_port, char const *user, char const *sessionid, uint32_t cliaddr, char proto, int session_time)
 
void set_radius_dir (TALLOC_CTX *ctx, char const *path)
 Set the global radius config directory. More...
 
int ssl_check_consistency (void)
 
char const * ssl_version (void)
 
char const * ssl_version_by_num (uint32_t version)
 
char const * ssl_version_num (void)
 
char const * ssl_version_range (uint32_t low, uint32_t high)
 
int thread_pool_addrequest (REQUEST *, RAD_REQUEST_FUNP)
 
int thread_pool_bootstrap (CONF_SECTION *cs, bool *spawn_workers)
 
int thread_pool_init (void)
 
void thread_pool_lock (void)
 
uint32_t thread_pool_max_threads (void)
 
void thread_pool_queue_stats (int array[RAD_LISTEN_MAX], int pps[2])
 
void thread_pool_stop (void)
 
void thread_pool_unlock (void)
 
int total_active_threads (void)
 
void verify_request (char const *file, int line, REQUEST *request)
 
int version_add_feature (CONF_SECTION *cs, char const *name, bool enabled)
 Add a feature flag to the main configuration. More...
 
int version_add_number (CONF_SECTION *cs, char const *name, char const *version)
 Add a library/server version pair to the main configuration. More...
 
void version_init_features (CONF_SECTION *cs)
 Initialise core feature flags. More...
 
void version_init_numbers (CONF_SECTION *cs)
 Initialise core version flags. More...
 
void version_print (void)
 
void void vmodule_failure_msg (REQUEST *request, char const *fmt, va_list ap) CC_HINT(format(printf
 
xlat_exp_txlat_from_tmpl_attr (TALLOC_CTX *ctx, vp_tmpl_t *vpt)
 Try to convert attr tmpl to an xlat for &attr[*] and artificially constructing expansions. More...
 
vp_tmpl_txlat_to_tmpl_attr (TALLOC_CTX *ctx, xlat_exp_t *xlat)
 Try to convert an xlat to a tmpl for efficiency. More...
 

Variables

bool event_loop_started
 Whether the main event loop has been started yet. More...
 
bool log_dates_utc
 
bool log_stripped_names
 
main_config_t main_config
 Main server configuration. More...
 
const FR_NAME_NUMBER modreturn_table []
 
log_lvl_t rad_debug_lvl
 Global debugging level. More...
 
char const * radacct_dir
 
char const * radiusd_version
 
char const * radiusd_version_short
 
char const * radlib_dir
 Path to search for modules in. More...
 
char const * radlog_dir
 
void(*)(int) reset_signal (int signo, void(*func)(int))
 

Detailed Description

Structures, prototypes and global variables for the FreeRADIUS server.

Id:
e838db640ebbe5ac06eace2004b9bba8d9004a65

Definition in file radiusd.h.


Data Structure Documentation

struct main_config

Main server configuration.

The parsed version of the main server config.

Definition at line 108 of file radiusd.h.

+ Collaboration diagram for main_config:
Data Fields
bool allow_core_dumps Whether the server is allowed to drop a core when receiving a fatal signal.
char const * auth_badpass_msg Additional text to append to successful auth messages.
char const * auth_goodpass_msg Additional text to append to failed auth messages.
char const * checkrad Script to use to determine if a user is already connected.
uint32_t cleanup_delay How long before cleaning up cached responses.
CONF_SECTION * config Root of the server config.
uint32_t continuation_timeout How long to wait before cleaning up state entries.
bool daemonize Should the server daemonize on startup.
uint32_t debug_level
bool debug_memory Cleanup the server properly on exit, freeing up any memory we allocated.
char const * denied_msg Additional text to append if the user is already logged in (simultaneous use check failed).
fr_dict_t * dict Main dictionary.
char const * dictionary_dir Where to load dictionaries from.
struct timeval init_delay Initial request processing delay.
rad_listen_t * listen Head of a linked list of listeners.
bool log_auth Log authentication attempts.
bool log_auth_badpass Log successful authentications.
bool log_auth_goodpass Log failed authentications.
char const * log_file
uint32_t max_request_time How long a request can be processed for before timing out.
uint32_t max_requests
bool memory_report Print a memory report on what's left unfreed.

Can only be used when the server is running in single threaded mode.

char const * name Name of the daemon, usually 'radiusd'.
char const * panic_action Command to execute if the server receives a fatal signal.
char const * pid_file Path to write out PID file.
bool proxy_requests Toggle to enable/disable proxying globally.
struct timeval reject_delay How long to wait before sending an Access-Reject.
bool spawn_workers Should the server spawn threads.
uint32_t state_seed magic for proxying
bool status_server Whether to respond to status-server messages.
int syslog_facility
uint32_t talloc_pool_size Size of pool to allocate to hold each REQUEST.
bool write_pid write the PID file
struct rad_request

Definition at line 208 of file radiusd.h.

+ Collaboration diagram for rad_request:
Data Fields
rad_child_state_t child_state
RADCLIENT * client The client that originally sent us the request.
REQUEST * coa CoA request originated by this request.
char const * component Section the request is in.
VALUE_PAIR * config VALUE_PAIR (s) used to set per request parameters for modules and the server core at runtime.
request_data_t * data Request metadata.
int delay incrementing delay for various timers
fr_event_t * ev Event in event loop tied to this request.
RAD_REQUEST_FUNP handle The function to call to move the request through the various server configuration sections.
int heap_id entry in the queue / heap of incoming packets
home_pool_t * home_pool For dynamic failover.
home_server_t * home_server
bool in_proxy_hash
bool in_request_hash
rad_listen_t * listener The listener that received the request.
struct rad_request log
uint32_t magic Magic number used to detect memory corruption, or request structs that have not been properly initialised.
rad_master_state_t master_state Set by the master thread to signal the child that's currently working with the request, to do something.
char const * module Module the request is currently being processed by.
uint32_t num_coa_requests Counter for number of requests sent including.

retransmits.

uint32_t num_proxied_requests How many times this request was proxied.

Retransmissions are driven by requests from the NAS.

uint32_t num_proxied_responses
unsigned int number Monotonically increasing request number. Reset on server restart.
uint32_t options mainly for proxying EAP-MSCHAPv2.
RADIUS_PACKET * packet Incoming request.
REQUEST * parent
VALUE_PAIR * password Cached password VALUE_PAIR from request RADIUS_PACKET.
RAD_LISTEN_TYPE priority
fr_request_process_t process The function to call to move the request through the state machine.
RADIUS_PACKET * proxy Outgoing request to proxy server.
rad_listen_t * proxy_listener Listener for outgoing requests.
RADIUS_PACKET * proxy_reply Incoming response from proxy server.
struct timeval proxy_retransmit
rlm_rcode_t rcode Last rcode returned by a module.
RADIUS_PACKET * reply Outgoing response.
struct timeval response_delay How long to wait before sending Access-Rejects.
main_config_t * root Pointer to the main config hack to try and deal with hup.
char const * server
int simul_count The current number of sessions for this user.
int simul_max Maximum number of concurrent sessions for this user.
int simul_mpp WEIRD: 1 is false, 2 is true.
VALUE_PAIR * state VALUE_PAIR (s) available over the lifetime of the authentication attempt.

Useful where the attempt involves a sequence of many request/challenge packets, like OTP, and EAP.

TALLOC_CTX * state_ctx for request->state
fr_state_action_t timer_action What action to perform when the timer event fires.
struct timeval timestamp When we started processing the request.
VALUE_PAIR * username Cached username VALUE_PAIR from request RADIUS_PACKET.
struct rad_request.log

Definition at line 292 of file radiusd.h.

Data Fields
radlog_func_t func Function to call to output log messages about this request.
uint8_t indent By how much to indent log messages.

uin8_t so it's obvious when a request has been exdented too much.

log_lvl_t lvl Controls the verbosity of debug statements regarding the request.
fr_log_t * output Output log destination. Over-rides the global one.

Macro Definition Documentation

#define CLEANUP_DELAY   5

Definition at line 324 of file radiusd.h.

#define DEAD_TIME   120

Definition at line 328 of file radiusd.h.

#define EXEC_TIMEOUT   10

Definition at line 329 of file radiusd.h.

#define MAX_REQUEST_TIME   30

Definition at line 323 of file radiusd.h.

#define MAX_REQUESTS   256

Definition at line 325 of file radiusd.h.

#define MEM (   x)    if (!(x)) { ERROR("%s[%u] OUT OF MEMORY", __FILE__, __LINE__); _fr_exit_now(__FILE__, __LINE__, 1); }

Definition at line 396 of file radiusd.h.

#define pair_make_config (   _a,
  _b,
  _c 
)    fr_pair_make(request, &request->config, _a, _b, _c)

Definition at line 547 of file radiusd.h.

#define pair_make_reply (   _a,
  _b,
  _c 
)    fr_pair_make(request->reply, &request->reply->vps, _a, _b, _c)

Definition at line 546 of file radiusd.h.

#define pair_make_request (   _a,
  _b,
  _c 
)    fr_pair_make(request->packet, &request->packet->vps, _a, _b, _c)

Definition at line 545 of file radiusd.h.

#define PW_RADMIN_PORT   18120

Definition at line 624 of file radiusd.h.

#define rad_fork (   n)    fork()

Definition at line 563 of file radiusd.h.

#define RAD_REQUEST_LVL_DEBUG   (1)

Definition at line 314 of file radiusd.h.

#define RAD_REQUEST_LVL_DEBUG2   (2)

Definition at line 315 of file radiusd.h.

#define RAD_REQUEST_LVL_DEBUG3   (3)

Definition at line 316 of file radiusd.h.

#define RAD_REQUEST_LVL_DEBUG4   (4)

Definition at line 317 of file radiusd.h.

#define RAD_REQUEST_LVL_NONE   (0)

No debug messages should be printed.

Definition at line 313 of file radiusd.h.

#define RAD_REQUEST_OPTION_COA   (1 << 0)

Definition at line 319 of file radiusd.h.

#define RAD_REQUEST_OPTION_CTX   (1 << 1)

Definition at line 320 of file radiusd.h.

#define rad_waitpid (   a,
 
)    waitpid(a,b, 0)

Definition at line 564 of file radiusd.h.

#define REQUEST_CHILD_NUM_STATES   (REQUEST_DONE + 1)

Definition at line 206 of file radiusd.h.

#define REQUEST_MAGIC   (0xdeadbeef)

Definition at line 45 of file radiusd.h.

#define REQUEST_MASTER_NUM_STATES   (REQUEST_COUNTED + 1)

Definition at line 196 of file radiusd.h.

#define RETRY_COUNT   3

Definition at line 327 of file radiusd.h.

#define RETRY_DELAY   5

Definition at line 326 of file radiusd.h.

#define SECONDS_PER_DAY   86400

Definition at line 322 of file radiusd.h.

#define VERIFY_REQUEST (   _x)    rad_assert(_x)

Definition at line 188 of file radiusd.h.

Typedef Documentation

typedef struct fr_cond_t fr_cond_t

Definition at line 602 of file radiusd.h.

typedef struct main_config main_config_t

Main server configuration.

The parsed version of the main server config.

typedef int(* RAD_COMPARE_FUNC)(void *instance, REQUEST *, VALUE_PAIR *, VALUE_PAIR *, VALUE_PAIR *, VALUE_PAIR **)

Definition at line 332 of file radiusd.h.

typedef struct rad_request REQUEST

Definition at line 34 of file radiusd.h.

Definition at line 79 of file radiusd.h.

typedef enum rlm_rcodes rlm_rcode_t

Return codes indicating the result of the module call.

All module functions must return one of the codes listed below (apart from RLM_MODULE_NUMCODES, which is used to check for validity).

Enumeration Type Documentation

Enumerator
EVENT_CORRAL_MAIN 

Always main thread event list.

EVENT_CORRAL_AUX 

Maybe main thread or one shared by modules.

Definition at line 587 of file radiusd.h.

Enumerator
REQUEST_QUEUED 
REQUEST_RUNNING 
REQUEST_PROXIED 
REQUEST_RESPONSE_DELAY 
REQUEST_CLEANUP_DELAY 
REQUEST_DONE 

Definition at line 198 of file radiusd.h.

Enumerator
REQUEST_ACTIVE 
REQUEST_STOP_PROCESSING 
REQUEST_COUNTED 

Definition at line 191 of file radiusd.h.

Enumerator
RADIUS_SIGNAL_SELF_NONE 
RADIUS_SIGNAL_SELF_HUP 
RADIUS_SIGNAL_SELF_TERM 
RADIUS_SIGNAL_SELF_EXIT 
RADIUS_SIGNAL_SELF_DETAIL 
RADIUS_SIGNAL_SELF_NEW_FD 
RADIUS_SIGNAL_SELF_MAX 

Definition at line 362 of file radiusd.h.

Enumerator
REQUEST_FAIL_UNKNOWN 
REQUEST_FAIL_NO_THREADS 

No threads to handle it.

REQUEST_FAIL_DECODE 

Rad_decode didn't like it.

REQUEST_FAIL_PROXY 

Call to proxy modules failed.

REQUEST_FAIL_PROXY_SEND 

Proxy_send didn't like it.

REQUEST_FAIL_NO_RESPONSE 

We weren't told to respond, so we reject.

REQUEST_FAIL_HOME_SERVER 

The home server didn't respond.

REQUEST_FAIL_HOME_SERVER2 

Another case of the above.

REQUEST_FAIL_HOME_SERVER3 

Another case of the above.

REQUEST_FAIL_NORMAL_REJECT 

Authentication failure.

REQUEST_FAIL_SERVER_TIMEOUT 

The server took too long to process the request.

Definition at line 334 of file radiusd.h.

enum rlm_rcodes

Return codes indicating the result of the module call.

All module functions must return one of the codes listed below (apart from RLM_MODULE_NUMCODES, which is used to check for validity).

Enumerator
RLM_MODULE_REJECT 

Immediately reject the request.

RLM_MODULE_FAIL 

Module failed, don't reply.

RLM_MODULE_OK 

The module is OK, continue.

RLM_MODULE_HANDLED 

The module handled the request, so stop.

RLM_MODULE_INVALID 

The module considers the request invalid.

RLM_MODULE_USERLOCK 

Reject the request (user is locked out).

RLM_MODULE_NOTFOUND 

User not found.

RLM_MODULE_NOOP 

Module succeeded without doing anything.

RLM_MODULE_UPDATED 

OK (pairs modified).

RLM_MODULE_NUMCODES 

How many valid return codes there are.

RLM_MODULE_UNKNOWN 

Error resolving rcode (should not be returned by modules).

Definition at line 88 of file radiusd.h.

Function Documentation

char* auth_name ( char *  buf,
size_t  buflen,
REQUEST request,
bool  do_cli 
)

Definition at line 37 of file auth.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void debug_pair ( VALUE_PAIR vp)

Print a single valuepair to stderr or error log.

Parameters
[in]vplist to print.

Definition at line 725 of file pair.c.

+ Here is the call graph for this function:

void exec_trigger ( REQUEST request,
CONF_SECTION cs,
char const *  name,
bool  quench 
)

Execute a trigger - call an executable to process an event.

Parameters
requestThe current request.
csto search for triggers in. If not NULL, only the portion after the last '.' in name is used for the trigger. If cs is NULL, the entire name is used to find the trigger in the global trigger section.
namethe path relative to the global trigger section ending in the trigger name e.g. module.ldap.pool.start.
quenchwhether to rate limit triggers.

Definition at line 686 of file exec.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int void exec_trigger_set_conf ( CONF_SECTION cs)

Set the global trigger section exec_trigger will search in.

Note
Triggers are used by the connection pool, which is used in the server library which may not have the mainconfig available. Additionally, utilities may want to set their own root config sections.
Parameters
csto use as global trigger section

Definition at line 670 of file exec.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

char const* get_radius_dir ( void  )

Get the global radius config directory.

Returns
the global radius config directory.

Definition at line 721 of file mainconfig.c.

+ Here is the caller graph for this function:

void hup_logfile ( void  )

Definition at line 1074 of file mainconfig.c.

+ Here is the caller graph for this function:

rad_listen_t* listener_find_byipaddr ( fr_ipaddr_t const *  ipaddr,
uint16_t  port,
int  proto 
)

Find a listener associated with an IP address/port/transport proto.

Parameters
[in]ipaddrlistener is bound to.
[in]portlistener is bound to.
[in]protoof listener, one of the IPPROTO_* macros.
Returns
  • Listener matching ipaddr/port/proto.
  • NULL if no listeners match.

Definition at line 3302 of file listen.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RADCLIENT_LIST* listener_find_client_list ( fr_ipaddr_t const *  ipaddr,
uint16_t  port,
int  proto 
)

Find client list associated with a listener.

Parameters
[in]ipaddrlistener is bound to.
[in]portlistener is bound to.
[in]protoof listener, one of the IPPROTO_* macros.
Returns
  • List of clients.
  • NULL if no matching listeners found.

Definition at line 3264 of file listen.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int log_err ( char *  )
int main_config_free ( void  )

Definition at line 1055 of file mainconfig.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void main_config_hup ( void  )

Definition at line 1134 of file mainconfig.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int main_config_init ( void  )

Definition at line 731 of file mainconfig.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mark_home_server_dead ( home_server_t home,
struct timeval *  when 
)

Definition at line 3652 of file process.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void module_failure_msg ( REQUEST request,
char const *  fmt,
  ... 
)

+ Here is the caller graph for this function:

int paircompare ( REQUEST request,
VALUE_PAIR req_list,
VALUE_PAIR check,
VALUE_PAIR **  rep_list 
)

Compare two pair lists except for the password information.

For every element in "check" at least one matching copy must be present in "reply".

Parameters
[in]requestCurrent request.
[in]req_listrequest valuepairs.
[in]checkCheck/control valuepairs.
[in,out]rep_listReply value pairs.
Returns
0 on match.

Definition at line 479 of file pair.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int paircompare_register ( fr_dict_attr_t const *  attribute,
fr_dict_attr_t const *  from,
bool  first_only,
RAD_COMPARE_FUNC  func,
void *  instance 
)

Register a function as compare function.

Parameters
attributeto register comparison function for.
fromthe attribute we want to compare with. Normally this is the same as attribute. If null call the comparison function on every attributes in the request if first_only is false.
first_onlywill decide if we loop over the request attributes or stop on the first one.
funccomparison function.
instanceargument to comparison function.
Returns
0

Definition at line 395 of file pair.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int paircompare_register_byname ( char const *  name,
fr_dict_attr_t const *  from,
bool  first_only,
RAD_COMPARE_FUNC  func,
void *  instance 
)

Register a function as compare function.

Parameters
namethe attribute comparison to register
fromthe attribute we want to compare with. Normally this is the same as attribute. If null call the comparison function on every attributes in the request if first_only is false.
first_onlywill decide if we loop over the request attributes or stop on the first one.
funccomparison function.
instanceargument to comparison function.
Returns
0

Definition at line 351 of file pair.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void paircompare_unregister ( fr_dict_attr_t const *  attribute,
RAD_COMPARE_FUNC  func 
)

Unregister comparison function for an attribute.

Parameters
attributedict reference to unregister for.
funccomparison function to remove.

Definition at line 422 of file pair.c.

+ Here is the caller graph for this function:

void paircompare_unregister_instance ( void *  instance)

Unregister comparison function for a module.

All paircompare() functions for this module will be unregistered.

Parameters
instancethe module instance

Definition at line 451 of file pair.c.

+ Here is the caller graph for this function:

void pairlist_free ( PAIR_LIST **  )

Definition at line 65 of file files.c.

+ Here is the caller graph for this function:

int pairlist_read ( TALLOC_CTX *  ctx,
char const *  file,
PAIR_LIST **  list,
int  complain 
)

Definition at line 80 of file files.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int rad_accounting ( REQUEST )

Definition at line 38 of file acct.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

char* rad_ajoin ( TALLOC_CTX *  ctx,
char const **  argv,
int  argc,
char  c 
)

talloc a buffer to hold the concatenated value of all elements of argv

Parameters
ctxto allocate buffer in.
argvarray of substrings.
argclength of array.
cseparation character. Optional, may be '\0' for no separator.
Returns
the concatenation of the elements of argv, separated by c.

Definition at line 441 of file util.c.

+ Here is the call graph for this function:

char* rad_asprint_gid ( TALLOC_CTX *  ctx,
gid_t  gid 
)
char* rad_asprint_uid ( TALLOC_CTX *  ctx,
uid_t  uid 
)

Print uid to a string.

Parameters
ctxTALLOC_CTX for temporary allocations.
uidto resolve.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1269 of file util.c.

+ Here is the call graph for this function:

int rad_authenticate ( REQUEST )

Definition at line 348 of file auth.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int rad_check_lib_magic ( uint64_t  magic)

Check if the application linking to the library has the correct magic number.

Parameters
magicnumber as defined by RADIUSD_MAGIC_NUMBER
Returns
  • 0 on success.
  • -1 on prefix mismatch.
  • -2 on version mismatch.
  • -3 on commit mismatch.

Definition at line 208 of file version.c.

+ Here is the caller graph for this function:

int rad_check_ts ( uint32_t  nasaddr,
uint32_t  nas_port,
char const *  user,
char const *  sessionid 
)

Definition at line 126 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int rad_coa_recv ( REQUEST request)

Definition at line 2045 of file listen.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void rad_const_free ( void const *  ptr)

Definition at line 424 of file util.c.

+ Here is the caller graph for this function:

int rad_copy_string ( char *  dst,
char const *  src 
)

Definition at line 491 of file util.c.

+ Here is the caller graph for this function:

int rad_copy_string_bare ( char *  dst,
char const *  src 
)

Definition at line 519 of file util.c.

+ Here is the caller graph for this function:

int rad_copy_variable ( char *  dst,
char const *  from 
)

Definition at line 545 of file util.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

char const* rad_default_lib_dir ( void  )

Return the default lib dir.

This is set at build time from –prefix

Returns
the value of LIBDIR

Definition at line 823 of file util.c.

char const* rad_default_log_dir ( void  )

Return the default log dir.

This is set at build time from –prefix

Returns
the value of LOGDIR

Definition at line 813 of file util.c.

char const* rad_default_raddb_dir ( void  )

Return the default raddb dir.

This is set at build time from –prefix

Returns
the value of RADDBDIR

Definition at line 833 of file util.c.

char const* rad_default_run_dir ( void  )

Return the default run dir.

This is set at build time from –prefix

Returns
the value of RUNDIR

Definition at line 843 of file util.c.

char const* rad_default_sbin_dir ( void  )

Return the default sbin dir.

This is set at build time from –prefix

Returns
the value of SBINDIR

Definition at line 853 of file util.c.

int rad_expand_xlat ( REQUEST request,
char const *  cmd,
int  max_argc,
char const *  argv[],
bool  can_fail,
size_t  argv_buflen,
char *  argv_buf 
)

Split string into words and expand each one.

Parameters
requestCurrent request.
cmdstring to split.
max_argcthe maximum number of arguments to split into.
argvWhere to write the pointers into argv_buf.
can_failIf false, stop processing if any of the xlat expansions fail.
argv_buflensize of argv_buf.
argv_buftemporary buffer we used to mangle/expand cmd. Pointers to offsets of this buffer will be written to argv.
Returns
argc or -1 on failure.

Definition at line 658 of file util.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void rad_file_error ( int  num)

Write a file access error to the fr_strerror buffer, including euid/egid.

Note
retrieve error with fr_strerror()
Parameters
numUsually num, unless the error is returned by the function.

Definition at line 1306 of file util.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t rad_filename_escape ( UNUSED REQUEST request,
char *  out,
size_t  outlen,
char const *  in,
UNUSED void *  arg 
)

Escapes the raw string such that it should be safe to use as part of a file path.

This function is designed to produce a string that's still readable but portable across the majority of file systems.

For security reasons it cannot remove characters from the name, and must not allow collisions to occur between different strings.

With that in mind '-' has been chosen as the escape character, and will be double escaped '-' -> '–' to avoid collisions.

Escaping should be reversible if the original string needs to be extracted.

Note
function takes additional arguments so that it may be used as an xlat escape function but it's fine to call it directly.
OSX/Unix/NTFS/VFAT have a max filename size of 255 bytes.
Parameters
requestCurrent request (may be NULL).
outOutput buffer.
outlenSize of the output buffer.
instring to escape.
argContext arguments (unused, should be NULL).

Definition at line 269 of file util.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t rad_filename_make_safe ( UNUSED REQUEST request,
char *  out,
size_t  outlen,
char const *  in,
UNUSED void *  arg 
)

Ensures that a filename cannot walk up the directory structure.

Also sanitizes control chars.

Parameters
requestCurrent request (may be NULL).
outOutput buffer.
outlenSize of the output buffer.
instring to escape.
argContext arguments (unused, should be NULL).

Definition at line 175 of file util.c.

+ Here is the caller graph for this function:

ssize_t rad_filename_unescape ( char *  out,
size_t  outlen,
char const *  in,
size_t  inlen 
)

Converts data stored in a file name back to its original form.

Parameters
outWhere to write the unescaped string (may be the same as in).
outlenLength of the output buffer.
inInput filename.
inlenLength of input.
Returns
  • Number of bytes written to output buffer
  • offset where parse error occurred on failure.

Definition at line 354 of file util.c.

+ Here is the call graph for this function:

pid_t rad_fork ( void  )

Definition at line 53 of file radattr.c.

int rad_getgid ( TALLOC_CTX *  ctx,
gid_t *  out,
char const *  name 
)

Resolve a group name to a GID.

Parameters
ctxTALLOC_CTX for temporary allocations.
nameof group.
outwhere to write gid.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1248 of file util.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int rad_getgrgid ( TALLOC_CTX *  ctx,
struct group **  out,
gid_t  gid 
)

Resolve a gid to a group database entry.

Resolves a gid to a group database entry. The memory to hold the group entry is talloced under ctx, and must be freed when no longer required.

Parameters
ctxto allocate passwd entry in.
outWhere to write pointer to entry.
gidto resolve.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1118 of file util.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int rad_getgrnam ( TALLOC_CTX *  ctx,
struct group **  out,
char const *  name 
)

Resolve a group name to a group database entry.

Resolves a group name to a group database entry. The memory to hold the group entry is talloced under ctx, and must be freed when no longer required.

Parameters
ctxto allocate passwd entry in.
outWhere to write pointer to entry.
nameto resolve.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1185 of file util.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int rad_getpwnam ( TALLOC_CTX *  ctx,
struct passwd **  out,
char const *  name 
)

Resolve a username to a passwd entry.

Resolves a username to a passwd entry. The memory to hold the passwd entry is talloced under ctx, and must be freed when no longer required.

Parameters
ctxto allocate passwd entry in.
outWhere to write pointer to entry.
nameto resolve.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1051 of file util.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int rad_getpwuid ( TALLOC_CTX *  ctx,
struct passwd **  out,
uid_t  uid 
)

Resolve a uid to a passwd entry.

Resolves a uid to a passwd entry. The memory to hold the passwd entry is talloced under ctx, and must be freed when no longer required.

Parameters
ctxto allocate passwd entry in.
outWhere to write pointer to entry.
uidto resolve.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 984 of file util.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void* rad_malloc ( size_t  size)

Definition at line 411 of file util.c.

+ Here is the caller graph for this function:

int rad_mkdir ( char *  dir,
mode_t  mode,
uid_t  uid,
gid_t  gid 
)

Create possibly many directories.

Note
that the input directory name is NOT treated as a constant. This is so that if an error is returned, the 'directory' ptr points to the name of the file which caused the error.
Parameters
dirpath to directory to create.
modefor new directories.
uidto set on new directories, may be -1 to use effective uid.
gidto set on new directories, may be -1 to use effective gid.
Returns
  • 0 on success.
  • -1 on failure. Error available as errno.

Definition at line 90 of file util.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void rad_mode_to_oct ( char  out[5],
mode_t  mode 
)

Definition at line 962 of file util.c.

void rad_mode_to_str ( char  out[10],
mode_t  mode 
)

Convert mode_t into humanly readable permissions flags.

Author
Jonathan Leffler.
Parameters
modeto convert.
outWhere to write the string to, must be exactly 10 bytes long.

Definition at line 949 of file util.c.

int rad_postauth ( REQUEST )

Definition at line 287 of file auth.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t rad_pps ( uint32_t *  past,
uint32_t *  present,
time_t *  then,
struct timeval *  now 
)

Definition at line 608 of file util.c.

+ Here is the caller graph for this function:

char const* rad_radacct_dir ( void  )

Return the default radacct dir.

This is set at build time from –prefix

Returns
the value of RADIR

Definition at line 863 of file util.c.

int rad_segid ( gid_t  gid)

Alter the effective user id.

Parameters
gidto set
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1512 of file util.c.

+ Here is the call graph for this function:

int rad_seuid ( uid_t  uid)

Alter the effective user id.

Parameters
uidto set
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1491 of file util.c.

+ Here is the call graph for this function:

int rad_status_server ( REQUEST request)

Definition at line 596 of file listen.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void rad_suid_down ( void  )

Definition at line 1474 of file util.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void rad_suid_down_permanent ( void  )

Definition at line 1478 of file util.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void rad_suid_set_down_uid ( uid_t  uid)

Definition at line 1468 of file util.c.

void rad_suid_up ( void  )

Definition at line 1471 of file util.c.

+ Here is the caller graph for this function:

int rad_virtual_server ( REQUEST )

Definition at line 659 of file auth.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pid_t rad_waitpid ( pid_t  pid,
int *  status 
)

Definition at line 58 of file radattr.c.

int radius_callback_compare ( REQUEST request,
VALUE_PAIR req,
VALUE_PAIR check,
VALUE_PAIR check_pairs,
VALUE_PAIR **  reply_pairs 
)

Compare check and vp.

May call the attribute comparison function.

Unlike radius_compare_vps() this function will call any attribute-specific comparison functions registered.

Parameters
requestCurrent request.
reqlist pairs.
checkitem to compare.
check_pairslist.
reply_pairslist.
Returns
  • 0 if check and vp are equal.
  • -1 if vp value is less than check value.
  • 1 is vp value is more than check value.

Definition at line 265 of file pair.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int radius_compare_vps ( REQUEST request,
VALUE_PAIR check,
VALUE_PAIR vp 
)

+ Here is the caller graph for this function:

int radius_copy_vp ( TALLOC_CTX *  ctx,
VALUE_PAIR **  out,
REQUEST request,
char const *  name 
)

Copy VP(s) from the specified request.

Parameters
ctxto alloc new VALUE_PAIRs in.
outwhere to write the pointer to the copied VP. Will be NULL if the attribute couldn't be resolved.
requestcurrent request.
nameattribute name including qualifiers.
Returns
  • -4 if either the attribute or qualifier were invalid.
  • The same error codes as tmpl_find_vp for other error conditions.

Definition at line 842 of file pair.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int radius_evaluate_cond ( REQUEST request,
int  modreturn,
int  depth,
fr_cond_t const *  c 
)

Evaluate a fr_cond_t;.

Parameters
[in]requestthe REQUEST
[in]modreturnthe previous module return code
[in]depthof the recursion (only used for debugging)
[in]cthe condition to evaluate
Returns
  • -1 on failure.
  • -2 on attribute not found.
  • 0 for "no match".
  • 1 for "match".

Definition at line 701 of file evaluate.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int radius_evaluate_map ( REQUEST request,
int  modreturn,
int  depth,
fr_cond_t const *  c 
)

+ Here is the caller graph for this function:

int radius_evaluate_tmpl ( REQUEST request,
int  modreturn,
int  depth,
vp_tmpl_t const *  vpt 
)
void radius_event_free ( void  )

Definition at line 5524 of file process.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int radius_event_init ( TALLOC_CTX *  ctx)

Definition at line 5197 of file process.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

fr_event_list_t* radius_event_list_corral ( event_corral_t  hint)

+ Here is the caller graph for this function:

int radius_event_process ( void  )

Definition at line 5581 of file process.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int radius_event_start ( bool  spawn_flag)

Definition at line 5317 of file process.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int radius_exec_program ( TALLOC_CTX *  ctx,
char *  out,
size_t  outlen,
VALUE_PAIR **  output_pairs,
REQUEST request,
char const *  cmd,
VALUE_PAIR input_pairs,
bool  exec_wait,
bool  shell_escape,
int  timeout 
)

+ Here is the caller graph for this function:

int radius_find_compare ( fr_dict_attr_t const *  attribute)

Find a comparison function for two attributes.

Todo:
this should probably take DA's.
Parameters
attributeto find comparison function for.
Returns
  • true if a comparison function was found
  • false.

Definition at line 303 of file pair.c.

+ Here is the caller graph for this function:

void void int radius_get_vp ( VALUE_PAIR **  out,
REQUEST request,
char const *  name 
)

Return a VP from the specified request.

Parameters
outwhere to write the pointer to the resolved VP. Will be NULL if the attribute couldn't be resolved.
requestcurrent request.
nameattribute name including qualifiers.
Returns
  • -4 if either the attribute or qualifier were invalid.
  • The same error codes as tmpl_find_vp for other error conditions.

Definition at line 815 of file pair.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

VALUE_PAIR* radius_pair_create ( TALLOC_CTX *  ctx,
VALUE_PAIR **  vps,
unsigned int  attribute,
unsigned int  vendor 
)

Create a VALUE_PAIR and add it to a list of VALUE_PAIR s.

Note
This function ALWAYS returns. If we're OOM, then it causes the
server to exit, so you don't need to check the return value.
Parameters
[in]ctxfor talloc
[out]vpsList to add new VALUE_PAIR to, if NULL will just return VALUE_PAIR.
[in]attributenumber.
[in]vendornumber.
Returns
a new VALUE_PAIR or causes server to exit on error.

Definition at line 704 of file pair.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void radius_pairmove ( REQUEST request,
VALUE_PAIR **  to,
VALUE_PAIR from,
bool  do_xlat 
)

Definition at line 774 of file evaluate.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int radius_readfrom_program ( int  fd,
pid_t  pid,
int  timeout,
char *  answer,
int  left 
)

Read from the child process.

Parameters
fdfile descriptor to read from.
pidpid of child, will be reaped if it dies.
timeoutamount of time to wait, in seconds.
answerbuffer to write into.
leftlength of buffer.
Returns
  • -1 on failure.
  • Length of output.

Definition at line 386 of file exec.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void radius_signal_self ( int  flag)

Definition at line 5132 of file process.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pid_t radius_start_program ( char const *  cmd,
REQUEST request,
bool  exec_wait,
int *  input_fd,
int *  output_fd,
VALUE_PAIR input_pairs,
bool  shell_escape 
)

Start a process.

Parameters
cmdCommand to execute. This is parsed into argv[] parts, then each individual argv part is xlat'ed.
requestCurrent reuqest
exec_waitset to true to read from or write to child.
[in,out]input_fdpointer to int, receives the stdin file descriptor. Set to NULL and the child will have /dev/null on stdin.
[in,out]output_fdpinter to int, receives the stdout file descriptor. Set to NULL and child will have /dev/null on stdout.
input_pairslist of value pairs - these will be put into the environment variables of the child.
shell_escapevalues before passing them as arguments.
Returns
  • PID of the child process.
  • -1 on failure.

Definition at line 87 of file exec.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void radius_update_listener ( rad_listen_t listener)

Definition at line 336 of file process.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int radius_xlat_do ( REQUEST request,
VALUE_PAIR vp 
)

Expands an attribute marked with fr_pair_mark_xlat.

Writes the new value to the vp.

Parameters
requestCurrent request.
vpto expand.
Returns
On failure pair will still no longer be marked for xlat expansion.
  • 0 if successful.
  • -1 On xlat failure.
  • -2 On parse failure.

Definition at line 655 of file pair.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void rdebug_pair ( log_lvl_t  level,
REQUEST request,
VALUE_PAIR vp,
char const *  prefix 
)

Print a single valuepair to stderr or error log.

Parameters
[in]levelDebug level (1-4).
[in]requestto read logging params from.
[in]vpto print.
[in]prefix(optional).

Definition at line 739 of file pair.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void rdebug_pair_list ( log_lvl_t  level,
REQUEST request,
VALUE_PAIR vp,
char const *  prefix 
)

Print a list of VALUE_PAIRs.

Parameters
[in]levelDebug level (1-4).
[in]requestto read logging params from.
[in]vpto print.
[in]prefix(optional).

Definition at line 757 of file pair.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void rdebug_proto_pair_list ( log_lvl_t  level,
REQUEST request,
VALUE_PAIR vp,
char const *  prefix 
)

Print a list of protocol VALUE_PAIRs.

Parameters
[in]levelDebug level (1-4).
[in]requestto read logging params from.
[in]vpto print.
[in]prefix(optional).

Definition at line 784 of file pair.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

REQUEST* request_alloc ( TALLOC_CTX *  ctx)

Create a new REQUEST data structure.

Definition at line 85 of file request.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

REQUEST* request_alloc_coa ( REQUEST request)

Definition at line 208 of file request.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

REQUEST* request_alloc_fake ( REQUEST oldreq)

Definition at line 124 of file request.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int request_data_add ( REQUEST request,
void *  unique_ptr,
int  unique_int,
void *  opaque,
bool  free_on_replace,
bool  free_on_parent,
bool  persist 
)

Add opaque data to a REQUEST.

The unique ptr is meant to be a module configuration, and the unique integer allows the caller to have multiple opaque data associated with a REQUEST.

Parameters
[in]requestto associate data with.
[in]unique_ptrIdentifier for the data.
[in]unique_intQualifier for the identifier.
[in]opaqueData to associate with the request
[in]free_on_replaceIf true and the opaque data is replaced via a subsequent call to request_data_add, talloc_free will be called to free the opaque data pointer.
[in]free_on_parentIf True and the request data is present in the request or state when it is freed, free the opaque data too. Must not be set if the opaque data is also parented by the request or state.
[in]persistIf true, before the request is freed, the opaque data will be transferred to an fr_state_entry_t, and restored to a subsequent linked request should we receive one.
Returns
  • -2 on bad arguments.
  • -1 on memory allocation error.
  • 0 on success.

Definition at line 279 of file request.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int request_data_by_persistance ( request_data_t **  out,
REQUEST request,
bool  persist 
)

Loop over all the request data, pulling out ones matching persist state.

Parameters
[out]outHead of result list.
[in]requestto search for request_data_t in.
[in]persistWhether to pull persistable or non-persistable data.
Returns
number of request_data_t retrieved.

Definition at line 413 of file request.c.

+ Here is the caller graph for this function:

void* request_data_get ( REQUEST request,
void *  unique_ptr,
int  unique_int 
)

Get opaque data from a request.

Note
The unique ptr is meant to be a module configuration, and the unique integer allows the caller to have multiple opaque data associated with a REQUEST.
Parameters
[in]requestto retrieve data from.
[in]unique_ptrIdentifier for the data.
[in]unique_intQualifier for the identifier.
Returns
  • NULL if no opaque data could be found.
  • the opaque data. The entry holding the opaque data is removed from the request.

Definition at line 374 of file request.c.

+ Here is the caller graph for this function:

void* request_data_reference ( REQUEST request,
void *  unique_ptr,
int  unique_int 
)

Get opaque data from a request without removing it.

Note
The unique ptr is meant to be a module configuration, and the unique integer allows the caller to have multiple opaque data associated with a REQUEST.
Parameters
requestto retrieve data from.
unique_ptrIdentifier for the data.
unique_intQualifier for the identifier.
Returns
  • NULL if no opaque data could be found.
  • the opaque data.

Definition at line 484 of file request.c.

+ Here is the caller graph for this function:

void request_data_restore ( REQUEST request,
request_data_t entry 
)

Add request data back to a request.

Note
May add multiple entries (if they're linked).
Will not check for duplicates.
Parameters
requestto add data to.
entrythe data to add.

Definition at line 453 of file request.c.

+ Here is the caller graph for this function:

void revive_home_server ( void *  ctx,
struct timeval *  now 
)

+ Here is the caller graph for this function:

int session_zap ( REQUEST request,
uint32_t  nasaddr,
uint32_t  nas_port,
char const *  user,
char const *  sessionid,
uint32_t  cliaddr,
char  proto,
int  session_time 
)

Definition at line 37 of file session.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void set_radius_dir ( TALLOC_CTX *  ctx,
char const *  path 
)

Set the global radius config directory.

Parameters
ctxWhere to allocate the memory for the path string.
pathto config dir root e.g. /usr/local/etc/raddb

(copied from main/mainconfig.c)

Definition at line 705 of file mainconfig.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ssl_check_consistency ( void  )

Definition at line 184 of file version.c.

+ Here is the caller graph for this function:

char const* ssl_version ( void  )

Definition at line 193 of file version.c.

char const* ssl_version_by_num ( uint32_t  version)
char const* ssl_version_num ( void  )

Definition at line 188 of file version.c.

+ Here is the caller graph for this function:

char const* ssl_version_range ( uint32_t  low,
uint32_t  high 
)
int thread_pool_addrequest ( REQUEST ,
RAD_REQUEST_FUNP   
)
int thread_pool_bootstrap ( CONF_SECTION cs,
bool *  spawn_workers 
)

+ Here is the caller graph for this function:

int thread_pool_init ( void  )

+ Here is the caller graph for this function:

void thread_pool_lock ( void  )
uint32_t thread_pool_max_threads ( void  )
void thread_pool_queue_stats ( int  array[RAD_LISTEN_MAX],
int  pps[2] 
)

+ Here is the caller graph for this function:

void thread_pool_stop ( void  )

+ Here is the caller graph for this function:

void thread_pool_unlock ( void  )
int total_active_threads ( void  )
void verify_request ( char const *  file,
int  line,
REQUEST request 
)

Definition at line 905 of file util.c.

+ Here is the call graph for this function:

int version_add_feature ( CONF_SECTION cs,
char const *  name,
bool  enabled 
)

Add a feature flag to the main configuration.

Add a feature flag (yes/no) to the 'feature' subsection off the main config.

This allows the user to create configurations that work with across multiple environments.

Parameters
csto add feature pair to.
nameof feature.
enabledWhether the feature is present/enabled.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 249 of file version.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int version_add_number ( CONF_SECTION cs,
char const *  name,
char const *  version 
)

Add a library/server version pair to the main configuration.

Add a version number to the 'version' subsection off the main config.

Because of the optimisations in the configuration parser, these may be checked using regular expressions without a performance penalty.

The version pairs are there primarily to work around defects in libraries or the server.

Parameters
csto add feature pair to.
nameof library or feature.
versionHumanly readable version text.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 284 of file version.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void version_init_features ( CONF_SECTION cs)

Initialise core feature flags.

Parameters
csWhere to add the CONF_PAIRS, if null pairs will be added to the 'feature' section of the main config.

Definition at line 313 of file version.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void version_init_numbers ( CONF_SECTION cs)

Initialise core version flags.

Parameters
csWhere to add the CONF_PAIRS, if null pairs will be added to the 'version' section of the main config.

Definition at line 491 of file version.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void version_print ( void  )

Definition at line 512 of file version.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void void vmodule_failure_msg ( REQUEST request,
char const *  fmt,
va_list  ap 
)

+ Here is the caller graph for this function:

xlat_exp_t* xlat_from_tmpl_attr ( TALLOC_CTX *  ctx,
vp_tmpl_t vpt 
)

Try to convert attr tmpl to an xlat for &attr[*] and artificially constructing expansions.

Parameters
ctxto allocate new xlat_expt_t in.
vptto convert.
Returns
  • NULL if unable to convert (not necessarily error).
  • a new vp_tmpl_t.

Definition at line 2626 of file xlat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vp_tmpl_t* xlat_to_tmpl_attr ( TALLOC_CTX *  ctx,
xlat_exp_t node 
)

Try to convert an xlat to a tmpl for efficiency.

Parameters
ctxto allocate new vp_tmpl_t in.
nodeto convert.
Returns
  • NULL if unable to convert (not necessarily error).
  • A new vp_tmpl_t.

Definition at line 2597 of file xlat.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

bool event_loop_started

Whether the main event loop has been started yet.

Definition at line 50 of file mainconfig.c.

bool log_dates_utc

Definition at line 214 of file log.c.

bool log_stripped_names

Definition at line 61 of file radiusd.c.

Main server configuration.

Definition at line 43 of file mainconfig.c.

const FR_NAME_NUMBER modreturn_table[]

Definition at line 40 of file evaluate.c.

log_lvl_t rad_debug_lvl

Global debugging level.

Definition at line 49 of file log.c.

char const* radacct_dir

Definition at line 58 of file radiusd.c.

char const* radiusd_version

Definition at line 63 of file radiusd.c.

char const* radiusd_version_short

Definition at line 31 of file version.c.

char const* radlib_dir

Path to search for modules in.

Definition at line 36 of file modules.c.

char const* radlog_dir

Definition at line 59 of file radiusd.c.

void(*)(int) reset_signal(int signo, void(*func)(int))

Definition at line 397 of file radiusd.h.