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

Go to the source code of this file.

Data Structures

struct  realm_config
 

Functions

static int add_pool_to_realm (realm_config_t *rc, CONF_SECTION *cs, char const *name, home_pool_t **dest, home_type_t server_type, bool do_print)
 
static size_t CC_HINT (nonnull)
 
home_pool_thome_pool_byname (char const *name, int type)
 
static int home_pool_name_cmp (void const *one, void const *two)
 
static int home_server_addr_cmp (void const *one, void const *two)
 
home_server_thome_server_afrom_cs (TALLOC_CTX *ctx, realm_config_t *rc, CONF_SECTION *cs)
 Alloc a new home server defined by a CONF_SECTION. More...
 
home_server_thome_server_byname (char const *name, int type)
 
home_server_thome_server_bynumber (int number)
 
CONF_SECTIONhome_server_cs_afrom_client (CONF_SECTION *client)
 Fixup a client configuration section to specify a home server. More...
 
home_server_thome_server_find (fr_ipaddr_t *ipaddr, uint16_t port, int proto)
 
static void home_server_free (void *data)
 
static bool home_server_insert (home_server_t *home, CONF_SECTION *cs)
 Insert a new home server into the various internal lookup trees. More...
 
home_server_thome_server_ldb (char const *realmname, home_pool_t *pool, REQUEST *request)
 
static int home_server_name_cmp (void const *one, void const *two)
 
static int home_server_number_cmp (void const *one, void const *two)
 
void home_server_update_request (home_server_t *home, REQUEST *request)
 
static void null_free (UNUSED void *data)
 
static int old_realm_config (realm_config_t *rc, CONF_SECTION *cs, REALM *r)
 
static int old_server_add (realm_config_t *rc, CONF_SECTION *cs, char const *realm, char const *name, char const *secret, home_pool_type_t ldflag, home_pool_t **pool_p, home_type_t type, char const *server)
 
static int pool_check_home_server (UNUSED realm_config_t *rc, CONF_PAIR *cp, char const *name, home_type_t server_type, home_server_t **phome)
 
static int pool_peek_type (CONF_SECTION *config, CONF_SECTION *cs)
 
static int realm_add (realm_config_t *rc, CONF_SECTION *cs)
 
REALMrealm_find (char const *name)
 
REALMrealm_find2 (char const *name)
 
bool realm_home_server_add (home_server_t *home)
 Add an already allocate home_server_t to the various trees. More...
 
void realm_home_server_sanitize (home_server_t *home, CONF_SECTION *cs)
 
static int realm_name_cmp (void const *one, void const *two)
 
int realm_pool_add (home_pool_t *pool, UNUSED CONF_SECTION *cs)
 
void realm_pool_free (home_pool_t *pool)
 
int realm_realm_add (REALM *r, UNUSED CONF_SECTION *cs)
 
void realms_free (void)
 
int realms_init (CONF_SECTION *config)
 
static int server_pool_add (realm_config_t *rc, CONF_SECTION *cs, home_type_t server_type, bool do_print)
 
static home_pool_tserver_pool_alloc (realm_config_t *rc, char const *name, home_pool_type_t type, home_type_t server_type, int num_home_servers)
 
static ssize_t xlat_home_server (char **out, size_t outlen, UNUSED void const *mod_inst, UNUSED void const *xlat_inst, REQUEST *request, char const *fmt) CC_HINT(nonnull)
 xlat for %{home_server:foo} More...
 
static ssize_t xlat_server_pool (char **out, size_t outlen, UNUSED void const *mod_inst, UNUSED void const *xlat_inst, REQUEST *request, char const *fmt) CC_HINT(nonnull)
 xlat for %{home_server_pool:foo} More...
 

Variables

static const FR_NAME_NUMBER home_ping_check []
 
static rbtree_thome_pools_byname = NULL
 
static CONF_PARSER home_server_coa []
 
static CONF_PARSER home_server_config []
 
static int home_server_max_number = 0
 
static const FR_NAME_NUMBER home_server_types []
 
static rbtree_thome_servers_byaddr = NULL
 
static rbtree_thome_servers_byname = NULL
 
static rbtree_thome_servers_bynumber = NULL
 
bool home_servers_udp = false
 Whether there are any UDP home servers. More...
 
static CONF_PARSER limit_config []
 
static const CONF_PARSER proxy_config []
 
static realm_config_trealm_config = NULL
 
static rbtree_trealms_byname = NULL
 

Data Structure Documentation

struct realm_config

Definition at line 55 of file realms.c.

+ Collaboration diagram for realm_config:
Data Fields
CONF_SECTION * cs
uint32_t dead_time
bool dynamic
bool fallback
uint32_t retry_count
uint32_t retry_delay
bool wake_all_if_all_dead

Function Documentation

static int add_pool_to_realm ( realm_config_t rc,
CONF_SECTION cs,
char const *  name,
home_pool_t **  dest,
home_type_t  server_type,
bool  do_print 
)
static

Definition at line 1712 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static size_t CC_HINT ( nonnull  )
static

Definition at line 189 of file realms.c.

+ Here is the call graph for this function:

home_pool_t* home_pool_byname ( char const *  name,
int  type 
)

Definition at line 2704 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int home_pool_name_cmp ( void const *  one,
void const *  two 
)
static

Definition at line 177 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int home_server_addr_cmp ( void const *  one,
void const *  two 
)
static

Definition at line 139 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

home_server_t* home_server_afrom_cs ( TALLOC_CTX *  ctx,
realm_config_t rc,
CONF_SECTION cs 
)

Alloc a new home server defined by a CONF_SECTION.

Parameters
ctxto allocate home_server_t in.
rcRealm config, may be NULL in which case the global realm_config will be used.
csConfiguration section containing home server parameters.
Returns

Definition at line 569 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

home_server_t* home_server_byname ( char const *  name,
int  type 
)

Definition at line 2679 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

home_server_t* home_server_bynumber ( int  number)

Definition at line 2692 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CONF_SECTION* home_server_cs_afrom_client ( CONF_SECTION client)

Fixup a client configuration section to specify a home server.

This is used to create the equivalent CoA home server entry for a client, so that the server can originate CoA messages.

The server section automatically inherits the following fields from the client:

  • ipaddr/ipv4addr/ipv6addr
  • secret
  • src_ipaddr
Note
new CONF_SECTION will be allocated in the context of the client, but the client C::ONF_SECTION will not be modified.
Parameters
clientCONF_SECTION to inherit values from.
Returns

Definition at line 889 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

home_server_t* home_server_find ( fr_ipaddr_t ipaddr,
uint16_t  port,
int  proto 
)

Definition at line 2660 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void home_server_free ( void *  data)
static

Definition at line 121 of file realms.c.

+ Here is the caller graph for this function:

static bool home_server_insert ( home_server_t home,
CONF_SECTION cs 
)
static

Insert a new home server into the various internal lookup trees.

Parameters
homeserver to add.
csThat defined the home server.
Returns
  • true on success.
  • false on failure.

Definition at line 450 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

home_server_t* home_server_ldb ( char const *  realmname,
home_pool_t pool,
REQUEST request 
)

Definition at line 2352 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int home_server_name_cmp ( void const *  one,
void const *  two 
)
static

Definition at line 128 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int home_server_number_cmp ( void const *  one,
void const *  two 
)
static

Definition at line 168 of file realms.c.

+ Here is the caller graph for this function:

void home_server_update_request ( home_server_t home,
REQUEST request 
)

Definition at line 2285 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void null_free ( UNUSED void *  data)
static

Definition at line 355 of file realms.c.

+ Here is the caller graph for this function:

static int old_realm_config ( realm_config_t rc,
CONF_SECTION cs,
REALM r 
)
static

Definition at line 1581 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int old_server_add ( realm_config_t rc,
CONF_SECTION cs,
char const *  realm,
char const *  name,
char const *  secret,
home_pool_type_t  ldflag,
home_pool_t **  pool_p,
home_type_t  type,
char const *  server 
)
static

Definition at line 1319 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int pool_check_home_server ( UNUSED realm_config_t rc,
CONF_PAIR cp,
char const *  name,
home_type_t  server_type,
home_server_t **  phome 
)
static

Definition at line 970 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int pool_peek_type ( CONF_SECTION config,
CONF_SECTION cs 
)
static

Definition at line 2023 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int realm_add ( realm_config_t rc,
CONF_SECTION cs 
)
static

Definition at line 1761 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

REALM* realm_find ( char const *  name)

Definition at line 2235 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

REALM* realm_find2 ( char const *  name)

Definition at line 2201 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool realm_home_server_add ( home_server_t home)

Add an already allocate home_server_t to the various trees.

Parameters
homeserver to add.
Returns
  • true on success.
  • false on error.

Definition at line 485 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void realm_home_server_sanitize ( home_server_t home,
CONF_SECTION cs 
)

Definition at line 362 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int realm_name_cmp ( void const *  one,
void const *  two 
)
static

Definition at line 111 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int realm_pool_add ( home_pool_t pool,
UNUSED CONF_SECTION cs 
)

Definition at line 1111 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void realm_pool_free ( home_pool_t pool)

Definition at line 1011 of file realms.c.

+ Here is the caller graph for this function:

int realm_realm_add ( REALM r,
UNUSED CONF_SECTION cs 
)

Definition at line 1959 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void realms_free ( void  )

Definition at line 256 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int realms_init ( CONF_SECTION config)

Definition at line 2070 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int server_pool_add ( realm_config_t rc,
CONF_SECTION cs,
home_type_t  server_type,
bool  do_print 
)
static

Definition at line 1130 of file realms.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static home_pool_t* server_pool_alloc ( realm_config_t rc,
char const *  name,
home_pool_type_t  type,
home_type_t  server_type,
int  num_home_servers 
)
static

Definition at line 944 of file realms.c.

+ Here is the caller graph for this function:

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

xlat for %{home_server:foo}

Definition at line 224 of file realms.c.

+ Here is the caller graph for this function:

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

xlat for %{home_server_pool:foo}

Definition at line 243 of file realms.c.

+ Here is the caller graph for this function:

Variable Documentation

const FR_NAME_NUMBER home_ping_check[]
static
Initial value:

Definition at line 73 of file realms.c.

rbtree_t* home_pools_byname = NULL
static

Definition at line 90 of file realms.c.

CONF_PARSER home_server_coa[]
static
Initial value:
= {
{ FR_CONF_OFFSET("irt", PW_TYPE_INTEGER, home_server_t, coa_irt), .dflt = STRINGIFY(2) },
{ FR_CONF_OFFSET("mrt", PW_TYPE_INTEGER, home_server_t, coa_mrt), .dflt = STRINGIFY(16) },
{ FR_CONF_OFFSET("mrc", PW_TYPE_INTEGER, home_server_t, coa_mrc), .dflt = STRINGIFY(5) },
{ FR_CONF_OFFSET("mrd", PW_TYPE_INTEGER, home_server_t, coa_mrd), .dflt = STRINGIFY(30) },
}
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
#define STRINGIFY(x)
Definition: build.h:34
32 Bit unsigned integer.
Definition: radius.h:34
#define FR_CONF_OFFSET(_n, _t, _s, _f)
Definition: conffile.h:168

Definition at line 294 of file realms.c.

CONF_PARSER home_server_config[]
static

Definition at line 303 of file realms.c.

int home_server_max_number = 0
static

Definition at line 86 of file realms.c.

const FR_NAME_NUMBER home_server_types[]
static
Initial value:
= {
{ "auth", HOME_TYPE_AUTH },
{ "acct", HOME_TYPE_ACCT },
{ "auth+acct", HOME_TYPE_AUTH_ACCT },
{ "coa", HOME_TYPE_COA },
{ NULL, 0 }
}
Authentication and accounting server.
Definition: realms.h:38
CoA destination (NAS or Proxy)
Definition: realms.h:41
Accounting server.
Definition: realms.h:37
Authentication server.
Definition: realms.h:36

Definition at line 65 of file realms.c.

rbtree_t* home_servers_byaddr = NULL
static

Definition at line 83 of file realms.c.

rbtree_t* home_servers_byname = NULL
static

Definition at line 84 of file realms.c.

rbtree_t* home_servers_bynumber = NULL
static

Definition at line 87 of file realms.c.

bool home_servers_udp = false

Whether there are any UDP home servers.

Definition at line 38 of file realms.c.

CONF_PARSER limit_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("max_connections", PW_TYPE_INTEGER, home_server_t, limit.max_connections), .dflt = "16" },
{ FR_CONF_OFFSET("max_requests", PW_TYPE_INTEGER, home_server_t, limit.max_requests), .dflt = "0" },
{ FR_CONF_OFFSET("lifetime", PW_TYPE_INTEGER, home_server_t, limit.lifetime), .dflt = "0" },
{ FR_CONF_OFFSET("idle_timeout", PW_TYPE_INTEGER, home_server_t, limit.idle_timeout), .dflt = "0" },
}
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
32 Bit unsigned integer.
Definition: radius.h:34
#define FR_CONF_OFFSET(_n, _t, _s, _f)
Definition: conffile.h:168

Definition at line 285 of file realms.c.

const CONF_PARSER proxy_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("retry_delay", PW_TYPE_INTEGER, realm_config_t, retry_delay), .dflt = STRINGIFY(RETRY_DELAY) },
{ FR_CONF_OFFSET("retry_count", PW_TYPE_INTEGER, realm_config_t, retry_count), .dflt = STRINGIFY(RETRY_COUNT) },
{ FR_CONF_OFFSET("default_fallback", PW_TYPE_BOOLEAN, realm_config_t, fallback), .dflt = "no" },
{ FR_CONF_OFFSET("dynamic", PW_TYPE_BOOLEAN, realm_config_t, dynamic) },
{ FR_CONF_OFFSET("dead_time", PW_TYPE_INTEGER, realm_config_t, dead_time), .dflt = STRINGIFY(DEAD_TIME) },
{ FR_CONF_OFFSET("wake_all_if_all_dead", PW_TYPE_BOOLEAN, realm_config_t, wake_all_if_all_dead), .dflt = "no" },
}
#define RETRY_COUNT
Definition: radiusd.h:327
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
#define DEAD_TIME
Definition: radiusd.h:328
#define STRINGIFY(x)
Definition: build.h:34
A truth value.
Definition: radius.h:56
32 Bit unsigned integer.
Definition: radius.h:34
#define RETRY_DELAY
Definition: radiusd.h:326
#define FR_CONF_OFFSET(_n, _t, _s, _f)
Definition: conffile.h:168

Definition at line 95 of file realms.c.

realm_config_t* realm_config = NULL
static

Definition at line 80 of file realms.c.

rbtree_t* realms_byname = NULL
static

Definition at line 36 of file realms.c.