All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
mainconfig.c File Reference
#include <freeradius-devel/radiusd.h>
#include <freeradius-devel/modules.h>
#include <freeradius-devel/modpriv.h>
#include <freeradius-devel/rad_assert.h>
#include <sys/stat.h>
#include <pwd.h>
#include <grp.h>
+ Include dependency graph for mainconfig.c:

Go to the source code of this file.

Data Structures

struct  cached_config_t
 

Macros

#define DICT_READ_OPTIONAL(_d, _n)
 

Typedefs

typedef struct cached_config_t cached_config_t
 

Functions

static size_t config_escape_func (UNUSED REQUEST *request, char *out, size_t outlen, char const *in, UNUSED void *arg)
 
char const * get_radius_dir (void)
 Get the global radius config directory. More...
 
static int hup_callback (void *ctx, void *data)
 
void hup_logfile (void)
 
int main_config_free (void)
 
void main_config_hup (void)
 
int main_config_init (void)
 
void set_radius_dir (TALLOC_CTX *ctx, char const *path)
 Set the global radius config directory. More...
 
static ssize_t xlat_client (char **out, size_t outlen, UNUSED void const *mod_inst, UNUSED void const *xlat_inst, REQUEST *request, char const *fmt)
 
static ssize_t xlat_config (char **out, size_t outlen, UNUSED void const *mod_inst, UNUSED void const *xlat_inst, REQUEST *request, char const *fmt)
 
static ssize_t xlat_getclient (char **out, size_t outlen, UNUSED void const *mod_inst, UNUSED void const *xlat_inst, REQUEST *request, char const *fmt)
 
static ssize_t xlat_listen (char **out, size_t outlen, UNUSED void const *mod_inst, UNUSED void const *xlat_inst, REQUEST *request, char const *fmt)
 

Variables

static bool allow_core_dumps = false
 
static const CONF_PARSER bootstrap_config []
 
static const CONF_PARSER bootstrap_security_config []
 
static char const * chroot_dir = NULL
 
static cached_config_tcs_cache = NULL
 
fr_cond_tdebug_condition = NULL
 Condition used to mark packets up for checking. More...
 
fr_log_t debug_log = { .fd = -1, .dst = L_DST_NULL }
 
static bool do_colourise = false
 
bool event_loop_started = false
 Whether the main event loop has been started yet. More...
 
static char const * localstatedir = NULL
 
static const CONF_PARSER log_config []
 
main_config_t main_config
 Main server configuration. More...
 
static char const * my_name = NULL
 
static char const * prefix = NULL
 
static char const * radius_dir = NULL
 Path to raddb directory. More...
 
static char const * radlog_dest = NULL
 
static const CONF_PARSER resources []
 
static char const * run_dir = NULL
 
static char const * sbindir = NULL
 
static const CONF_PARSER security_config []
 
static const CONF_PARSER server_config []
 
static const CONF_PARSER startup_log_config []
 
static const CONF_PARSER startup_server_config []
 
static char const * syslog_facility = NULL
 

Data Structure Documentation

struct cached_config_t

Definition at line 52 of file mainconfig.c.

+ Collaboration diagram for cached_config_t:
Data Fields
time_t created
CONF_SECTION * cs
struct cached_config_t * next

Macro Definition Documentation

#define DICT_READ_OPTIONAL (   _d,
  _n 
)
Value:
do {\
switch (fr_dict_read(main_config.dict, _d, _n)) {\
case -1:\
ERROR("Errors reading %s/%s: %s", _d, _n, fr_strerror());\
return -1;\
case 0:\
DEBUG2("including dictionary file %s/%s", _d,_n);\
break;\
default:\
break;\
}\
} while (0)
Main server configuration.
Definition: radiusd.h:108
int fr_dict_read(fr_dict_t *dict, char const *dir, char const *filename)
Definition: dict.c:2291
fr_dict_t * dict
Main dictionary.
Definition: radiusd.h:177
#define DEBUG2(fmt,...)
Definition: log.h:176
char const * fr_strerror(void)
Get the last library error.
Definition: log.c:212
#define ERROR(fmt,...)
Definition: log.h:145

Typedef Documentation

Function Documentation

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

Definition at line 278 of file mainconfig.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.

static int hup_callback ( void *  ctx,
void *  data 
)
static

Definition at line 1097 of file mainconfig.c.

+ Here is the call graph for this function:

+ 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:

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 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

Definition at line 705 of file mainconfig.c.

+ Here is the call graph for this function:

static ssize_t xlat_client ( char **  out,
size_t  outlen,
UNUSED void const *  mod_inst,
UNUSED void const *  xlat_inst,
REQUEST request,
char const *  fmt 
)
static

Definition at line 375 of file mainconfig.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ssize_t xlat_config ( char **  out,
size_t  outlen,
UNUSED void const *  mod_inst,
UNUSED void const *  xlat_inst,
REQUEST request,
char const *  fmt 
)
static

Definition at line 333 of file mainconfig.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ssize_t xlat_getclient ( char **  out,
size_t  outlen,
UNUSED void const *  mod_inst,
UNUSED void const *  xlat_inst,
REQUEST request,
char const *  fmt 
)
static

Definition at line 408 of file mainconfig.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ssize_t xlat_listen ( char **  out,
size_t  outlen,
UNUSED void const *  mod_inst,
UNUSED void const *  xlat_inst,
REQUEST request,
char const *  fmt 
)
static

Definition at line 458 of file mainconfig.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

bool allow_core_dumps = false
static

Definition at line 74 of file mainconfig.c.

const CONF_PARSER bootstrap_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("security", PW_TYPE_SUBSECTION, NULL), .dflt = (void const *) bootstrap_security_config },
{ FR_CONF_POINTER("name", PW_TYPE_STRING, &my_name), .dflt = "radiusd" },
{ FR_CONF_POINTER("prefix", PW_TYPE_STRING, &prefix), .dflt = "/usr/local" },
{ FR_CONF_POINTER("localstatedir", PW_TYPE_STRING, &localstatedir), .dflt = "${prefix}/var"},
{ FR_CONF_POINTER("logdir", PW_TYPE_STRING, &radlog_dir), .dflt = "${localstatedir}/log"},
{ FR_CONF_POINTER("run_dir", PW_TYPE_STRING, &run_dir), .dflt = "${localstatedir}/run/${name}"},
}
static const CONF_PARSER bootstrap_security_config[]
Definition: mainconfig.c:245
char const * radlog_dir
Definition: radiusd.c:59
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
#define PW_TYPE_DEPRECATED
If a matching CONF_PAIR is found, error out with a deprecated message.
Definition: conffile.h:199
#define PW_TYPE_SUBSECTION
Definition: conffile.h:188
static char const * chroot_dir
Definition: mainconfig.c:73
static char const * localstatedir
Definition: mainconfig.c:80
A truth value.
Definition: radius.h:56
static char const * run_dir
Definition: mainconfig.c:84
static bool allow_core_dumps
Definition: mainconfig.c:74
static char const * prefix
Definition: mainconfig.c:81
static char const * my_name
Definition: mainconfig.c:82
String of printable characters.
Definition: radius.h:33
#define FR_CONF_POINTER(_n, _t, _p)
Definition: conffile.h:172

Definition at line 255 of file mainconfig.c.

const CONF_PARSER bootstrap_security_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("allow_core_dumps", PW_TYPE_BOOLEAN, &allow_core_dumps), .dflt = "no" },
}
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
static char const * chroot_dir
Definition: mainconfig.c:73
A truth value.
Definition: radius.h:56
static bool allow_core_dumps
Definition: mainconfig.c:74
String of printable characters.
Definition: radius.h:33
#define FR_CONF_POINTER(_n, _t, _p)
Definition: conffile.h:172

Definition at line 245 of file mainconfig.c.

char const* chroot_dir = NULL
static

Definition at line 73 of file mainconfig.c.

cached_config_t* cs_cache = NULL
static

Definition at line 58 of file mainconfig.c.

fr_cond_t* debug_condition = NULL

Condition used to mark packets up for checking.

Definition at line 48 of file mainconfig.c.

fr_log_t debug_log = { .fd = -1, .dst = L_DST_NULL }

Definition at line 49 of file mainconfig.c.

bool do_colourise = false
static

Definition at line 86 of file mainconfig.c.

bool event_loop_started = false

Whether the main event loop has been started yet.

Definition at line 50 of file mainconfig.c.

char const* localstatedir = NULL
static

Definition at line 80 of file mainconfig.c.

const CONF_PARSER log_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("stripped_names", PW_TYPE_BOOLEAN, &log_stripped_names), .dflt = "no" },
{ FR_CONF_POINTER("auth", PW_TYPE_BOOLEAN, &main_config.log_auth), .dflt = "no" },
{ FR_CONF_POINTER("auth_badpass", PW_TYPE_BOOLEAN, &main_config.log_auth_badpass), .dflt = "no" },
{ FR_CONF_POINTER("auth_goodpass", PW_TYPE_BOOLEAN, &main_config.log_auth_goodpass), .dflt = "no" },
{ FR_CONF_POINTER("msg_denied", PW_TYPE_STRING, &main_config.denied_msg), .dflt = "You are already logged in - access denied" },
}
Main server configuration.
Definition: radiusd.h:108
char const * auth_badpass_msg
Additional text to append to successful auth messages.
Definition: radiusd.h:115
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
static bool do_colourise
Definition: mainconfig.c:86
bool log_stripped_names
Definition: radiusd.c:61
bool log_auth_goodpass
Log failed authentications.
Definition: radiusd.h:114
A truth value.
Definition: radius.h:56
bool log_auth
Log authentication attempts.
Definition: radiusd.h:112
bool log_dates_utc
Definition: log.c:214
bool log_auth_badpass
Log successful authentications.
Definition: radiusd.h:113
String of printable characters.
Definition: radius.h:33
#define FR_CONF_POINTER(_n, _t, _p)
Definition: conffile.h:172
char const * auth_goodpass_msg
Additional text to append to failed auth messages.
Definition: radiusd.h:116
char const * denied_msg
Additional text to append if the user is already logged in (simultaneous use check failed)...
Definition: radiusd.h:118

Definition at line 139 of file mainconfig.c.

Main server configuration.

Definition at line 43 of file mainconfig.c.

char const* my_name = NULL
static

Definition at line 82 of file mainconfig.c.

char const* prefix = NULL
static

Definition at line 81 of file mainconfig.c.

char const* radius_dir = NULL
static

Path to raddb directory.

Definition at line 88 of file mainconfig.c.

char const* radlog_dest = NULL
static

Definition at line 75 of file mainconfig.c.

const CONF_PARSER resources[]
static
Initial value:
= {
}
Main server configuration.
Definition: radiusd.h:108
uint32_t talloc_pool_size
Size of pool to allocate to hold each REQUEST.
Definition: radiusd.h:155
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
32 Bit unsigned integer.
Definition: radius.h:34
#define FR_CONF_POINTER(_n, _t, _p)
Definition: conffile.h:172

Definition at line 170 of file mainconfig.c.

char const* run_dir = NULL
static

Definition at line 84 of file mainconfig.c.

char const* sbindir = NULL
static

Definition at line 83 of file mainconfig.c.

const CONF_PARSER security_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("max_attributes", PW_TYPE_INTEGER, &fr_max_attributes), .dflt = STRINGIFY(0) },
{ FR_CONF_POINTER("status_server", PW_TYPE_BOOLEAN, &main_config.status_server), .dflt = "no" },
}
struct timeval reject_delay
How long to wait before sending an Access-Reject.
Definition: radiusd.h:128
Time value (struct timeval), only for config items.
Definition: radius.h:55
Main server configuration.
Definition: radiusd.h:108
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
uint32_t fr_max_attributes
Definition: radius.c:80
#define STRINGIFY(x)
Definition: build.h:34
A truth value.
Definition: radius.h:56
32 Bit unsigned integer.
Definition: radius.h:34
uint32_t state_seed
magic for proxying
Definition: radiusd.h:165
bool status_server
Whether to respond to status-server messages.
Definition: radiusd.h:129
#define FR_CONF_POINTER(_n, _t, _p)
Definition: conffile.h:172

Definition at line 159 of file mainconfig.c.

const CONF_PARSER server_config[]
static

Definition at line 180 of file mainconfig.c.

const CONF_PARSER startup_log_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("destination", PW_TYPE_STRING, &radlog_dest), .dflt = "files" },
{ FR_CONF_POINTER("syslog_facility", PW_TYPE_STRING, &syslog_facility), .dflt = STRINGIFY(0) },
{ FR_CONF_POINTER("localstatedir", PW_TYPE_STRING, &localstatedir), .dflt = "${prefix}/var"},
{ FR_CONF_POINTER("logdir", PW_TYPE_STRING, &radlog_dir), .dflt = "${localstatedir}/log"},
{ FR_CONF_POINTER("file", PW_TYPE_STRING, &main_config.log_file), .dflt = "${logdir}/radius.log" },
}
Main server configuration.
Definition: radiusd.h:108
char const * radlog_dir
Definition: radiusd.c:59
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
#define PW_TYPE_DEPRECATED
If a matching CONF_PAIR is found, error out with a deprecated message.
Definition: conffile.h:199
fr_log_t default_log
Definition: log.c:216
char const * log_file
Definition: radiusd.h:139
static char const * syslog_facility
Definition: mainconfig.c:85
#define STRINGIFY(x)
Definition: build.h:34
static char const * localstatedir
Definition: mainconfig.c:80
char const * file
Path to log file.
Definition: log.h:73
static char const * radlog_dest
Definition: mainconfig.c:75
String of printable characters.
Definition: radius.h:33
#define FR_CONF_POINTER(_n, _t, _p)
Definition: conffile.h:172

Definition at line 105 of file mainconfig.c.

const CONF_PARSER startup_server_config[]
static
Initial value:
= {
{ FR_CONF_POINTER("log", PW_TYPE_SUBSECTION, NULL), .dflt = (void const *) startup_log_config },
{ FR_CONF_POINTER("name", PW_TYPE_STRING, &my_name), .dflt = "radiusd" },
{ FR_CONF_POINTER("prefix", PW_TYPE_STRING, &prefix), .dflt = "/usr/local" },
{ FR_CONF_POINTER("log_destination", PW_TYPE_STRING, &radlog_dest) },
}
static const CONF_PARSER startup_log_config[]
Definition: mainconfig.c:105
Main server configuration.
Definition: radiusd.h:108
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
char const * log_file
Definition: radiusd.h:139
#define PW_TYPE_SUBSECTION
Definition: conffile.h:188
A truth value.
Definition: radius.h:56
static char const * prefix
Definition: mainconfig.c:81
bool log_dates_utc
Definition: log.c:214
static char const * radlog_dest
Definition: mainconfig.c:75
static char const * my_name
Definition: mainconfig.c:82
String of printable characters.
Definition: radius.h:33
#define FR_CONF_POINTER(_n, _t, _p)
Definition: conffile.h:172

Definition at line 120 of file mainconfig.c.

char const* syslog_facility = NULL
static

Definition at line 85 of file mainconfig.c.