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

Go to the source code of this file.

Data Structures

struct  cf_file_callback_t
 
struct  cf_file_t
 
struct  conf_data
 Internal data that is associated with a configuration section. More...
 
struct  conf_item
 
struct  conf_pair
 Configuration AVP similar to a VALUE_PAIR. More...
 
struct  conf_part
 

Typedefs

typedef struct cf_file_callback_t cf_file_callback_t
 
typedef struct cf_file_t cf_file_t
 
typedef enum conf_include_type CONF_INCLUDE_TYPE
 
typedef enum conf_type CONF_ITEM_TYPE
 
typedef enum conf_property CONF_PROPERTY
 

Enumerations

enum  conf_include_type {
  CONF_INCLUDE_FILE,
  CONF_INCLUDE_DIR,
  CONF_INCLUDE_FROMDIR
}
 
enum  conf_property {
  CONF_PROPERTY_INVALID = 0,
  CONF_PROPERTY_NAME,
  CONF_PROPERTY_INSTANCE
}
 
enum  conf_type {
  CONF_ITEM_INVALID = 0,
  CONF_ITEM_PAIR,
  CONF_ITEM_SECTION,
  CONF_ITEM_DATA
}
 

Functions

static int _cf_data_free (CONF_DATA *cd)
 
static int _cf_section_free (CONF_SECTION *cs)
 
static void _pair_count (int *count, CONF_SECTION const *cs)
 
int cf_data_add (CONF_SECTION *cs, char const *name, void *data, void(*data_free)(void *))
 
static int cf_data_add_internal (CONF_SECTION *cs, char const *name, void *data, void(*data_free)(void *), int flag)
 
static CONF_DATAcf_data_alloc (CONF_SECTION *parent, char const *name, void *data, void(*data_free)(void *))
 
void * cf_data_find (CONF_SECTION const *cs, char const *name)
 
static void * cf_data_find_internal (CONF_SECTION const *cs, char const *name, int flag)
 
void * cf_data_remove (CONF_SECTION *cs, char const *name)
 Remove named data from a configuration section. More...
 
static CONF_ITEMcf_data_to_item (CONF_DATA const *cd)
 Cast CONF_DATA to a CONF_ITEM. More...
 
static char const * cf_expand_variables (char const *cf, int *lineno, CONF_SECTION *outercs, char *output, size_t outsize, char const *input, bool *soft_fail)
 
int cf_file_changed (CONF_SECTION *cs, rb_walker_t callback)
 
void cf_file_free (CONF_SECTION *cs)
 
static int cf_file_include (CONF_SECTION *cs, char const *filename_in, CONF_INCLUDE_TYPE file_type, char *buff[7])
 
static int cf_file_include (CONF_SECTION *cs, char const *filename_in, UNUSED CONF_INCLUDE_TYPE file_type, char *buff[7])
 
static bool cf_file_input (CONF_SECTION *cs, char const *filename)
 
static FILE * cf_file_open (CONF_SECTION *cs, char const *filename)
 
int cf_file_read (CONF_SECTION *cs, char const *filename)
 
void cf_item_add (CONF_SECTION *cs, CONF_ITEM *ci)
 
CONF_ITEMcf_item_find_next (CONF_SECTION const *section, CONF_ITEM const *item)
 Return the next item after a CONF_ITEM. More...
 
bool cf_item_is_pair (CONF_ITEM const *item)
 
bool cf_item_is_section (CONF_ITEM const *item)
 
CONF_SECTIONcf_item_parent (CONF_ITEM const *ci)
 
CONF_PAIRcf_item_to_pair (CONF_ITEM const *ci)
 Cast a CONF_ITEM to a CONF_PAIR. More...
 
CONF_SECTIONcf_item_to_section (CONF_ITEM const *ci)
 Cast a CONF_ITEM to a CONF_SECTION. More...
 
static char const * cf_local_file (char const *base, char const *filename, char *buffer, size_t bufsize)
 
void cf_log_err (CONF_ITEM const *ci, char const *fmt,...)
 
void cf_log_err_cp (CONF_PAIR const *cp, char const *fmt,...)
 
void cf_log_err_cs (CONF_SECTION const *cs, char const *fmt,...)
 
void cf_log_info (CONF_SECTION const *cs, char const *fmt,...)
 
void cf_log_module (CONF_SECTION const *cs, char const *fmt,...)
 
void cf_pair_add (CONF_SECTION *parent, CONF_PAIR *cp)
 Add a configuration pair to a section. More...
 
CONF_PAIRcf_pair_alloc (CONF_SECTION *parent, char const *attr, char const *value, FR_TOKEN op, FR_TOKEN lhs_type, FR_TOKEN rhs_type)
 Allocate a CONF_PAIR. More...
 
char const * cf_pair_attr (CONF_PAIR const *pair)
 
FR_TOKEN cf_pair_attr_type (CONF_PAIR const *pair)
 Return the value (lhs) type. More...
 
int cf_pair_count (CONF_SECTION const *cs)
 Count the number of conf pairs beneath a section. More...
 
static int cf_pair_default (CONF_PAIR **out, CONF_SECTION *cs, char const *name, int type, char const *dflt, FR_TOKEN dflt_quote)
 Allocate a pair using the dflt value and quotation. More...
 
CONF_PAIRcf_pair_dup (CONF_SECTION *parent, CONF_PAIR *cp)
 Duplicate a CONF_PAIR. More...
 
char const * cf_pair_filename (CONF_PAIR const *pair)
 
CONF_PAIRcf_pair_find (CONF_SECTION const *cs, char const *name)
 
CONF_PAIRcf_pair_find_next (CONF_SECTION const *cs, CONF_PAIR const *pair, char const *attr)
 Find a pair with a name matching attr, after specified pair. More...
 
int cf_pair_lineno (CONF_PAIR const *pair)
 
FR_TOKEN cf_pair_operator (CONF_PAIR const *pair)
 
int cf_pair_parse (CONF_SECTION *cs, char const *name, unsigned int type, void *data, char const *dflt, FR_TOKEN dflt_quote)
 Parses a CONF_PAIR into a C data type, with a default value. More...
 
static int cf_pair_parse_value (void *out, TALLOC_CTX *ctx, CONF_SECTION *cs, CONF_PAIR *cp, unsigned int type)
 Parses a CONF_PAIR into a C data type. More...
 
int cf_pair_replace (CONF_SECTION *cs, CONF_PAIR *cp, char const *value)
 Replace pair in a given section with a new pair, of the given value. More...
 
CONF_ITEMcf_pair_to_item (CONF_PAIR const *cp)
 Cast a CONF_PAIR to a CONF_ITEM. More...
 
char const * cf_pair_value (CONF_PAIR const *pair)
 
FR_TOKEN cf_pair_value_type (CONF_PAIR const *pair)
 Return the value (rhs) type. More...
 
VALUE_PAIRcf_pairtovp (CONF_PAIR *pair)
 
CONF_ITEMcf_reference_item (CONF_SECTION const *parentcs, CONF_SECTION *outercs, char const *ptr)
 
void cf_section_add (CONF_SECTION *parent, CONF_SECTION *cs)
 
CONF_SECTIONcf_section_alloc (CONF_SECTION *parent, char const *name1, char const *name2)
 Allocate a CONF_SECTION. More...
 
char const * cf_section_argv (CONF_SECTION const *cs, int argc)
 
FR_TOKEN cf_section_argv_type (CONF_SECTION const *cs, int argc)
 
CONF_SECTIONcf_section_dup (CONF_SECTION *parent, CONF_SECTION const *cs, char const *name1, char const *name2, bool copy_meta)
 Duplicate a configuration section. More...
 
char const * cf_section_filename (CONF_SECTION const *section)
 
CONF_SECTIONcf_section_find_name2 (CONF_SECTION const *cs, char const *name1, char const *name2)
 
CONF_SECTIONcf_section_find_next (CONF_SECTION const *section, CONF_SECTION const *subsection, char const *name1)
 
int cf_section_lineno (CONF_SECTION const *section)
 
char const * cf_section_name (CONF_SECTION const *cs)
 Return name2 if set, else name1. More...
 
char const * cf_section_name1 (CONF_SECTION const *cs)
 
char const * cf_section_name2 (CONF_SECTION const *cs)
 
FR_TOKEN cf_section_name2_type (CONF_SECTION const *cs)
 
int cf_section_parse (CONF_SECTION *cs, void *base, CONF_PARSER const *variables)
 Parse a configuration section into user-supplied variables. More...
 
static void cf_section_parse_init (CONF_SECTION *cs, void *base, CONF_PARSER const *variables)
 
int cf_section_parse_pass2 (CONF_SECTION *cs, void *base, CONF_PARSER const variables[])
 Fixup xlat expansions and attributes. More...
 
const CONF_PARSERcf_section_parse_table (CONF_SECTION *cs)
 
static void cf_section_parse_warn (CONF_SECTION *cs)
 
static int cf_section_pass2 (CONF_SECTION *cs)
 
static int cf_section_read (char const *filename, int *lineno, FILE *fp, CONF_SECTION *current, char *buff[7])
 
CONF_SECTIONcf_section_sub_find (CONF_SECTION const *cs, char const *name)
 Find a sub-section in a section. More...
 
CONF_SECTIONcf_section_sub_find_name2 (CONF_SECTION const *cs, char const *name1, char const *name2)
 Find a CONF_SECTION with both names. More...
 
CONF_ITEMcf_section_to_item (CONF_SECTION const *cs)
 Cast a CONF_SECTION to a CONF_ITEM. More...
 
char const * cf_section_value_find (CONF_SECTION const *cs, char const *attr)
 
CONF_SECTIONcf_subsection_find_next (CONF_SECTION const *section, CONF_SECTION const *subsection, char const *name1)
 
static bool cf_template_merge (CONF_SECTION *cs, CONF_SECTION const *template)
 
CONF_SECTIONcf_top_section (CONF_SECTION *cs)
 
static int data_cmp (void const *a, void const *b)
 
static int file_callback (void *ctx, void *data)
 
static int filename_cmp (void const *a, void const *b)
 
static int fr_item_validate_ipaddr (CONF_SECTION *cs, char const *name, PW_TYPE type, char const *value, fr_ipaddr_t *ipaddr)
 Validation function for ipaddr conffile types. More...
 
static bool invalid_location (CONF_SECTION *this, char const *name, char const *filename, int lineno)
 
static int name2_cmp (void const *a, void const *b)
 
static int pair_cmp (void const *a, void const *b)
 
static int section_cmp (void const *a, void const *b)
 

Variables

bool check_config = false
 
static const FR_NAME_NUMBER conf_property_name []
 
static char const parse_spaces [] = " "
 

Data Structure Documentation

struct cf_file_callback_t

Definition at line 443 of file conffile.c.

+ Collaboration diagram for cf_file_callback_t:
Data Fields
rb_walker_t callback
CONF_SECTION * modules
int rcode
struct cf_file_t

Definition at line 152 of file conffile.c.

+ Collaboration diagram for cf_file_t:
Data Fields
struct stat buf
CONF_SECTION * cs
char const * filename
bool input
struct conf_item

Definition at line 71 of file conffile.c.

+ Collaboration diagram for conf_item:
Data Fields
char const * filename The file the config item was parsed from.
int lineno The line number the config item began on.
struct conf_item * next Sibling.
struct conf_part * parent Parent.
CONF_ITEM_TYPE type Whether the config item is a config_pair, conf_section or conf_data.
struct conf_pair

Configuration AVP similar to a VALUE_PAIR.

Definition at line 82 of file conffile.c.

+ Collaboration diagram for conf_pair:
Data Fields
char const * attr Attribute name.
CONF_ITEM item
FR_TOKEN lhs_type Name quoting style T_(DOUBLE|SINGLE|BACK)_QUOTE_STRING or T_BARE_WORD.
FR_TOKEN op Operator e.g. =, :=.
bool parsed Was this item used during parsing?
bool pass2 do expansion in pass2.
FR_TOKEN rhs_type Value Quoting style T_(DOUBLE|SINGLE|BACK)_QUOTE_STRING or T_BARE_WORD.
char const * value Attribute value.
struct conf_part

Definition at line 107 of file conffile.c.

+ Collaboration diagram for conf_part:
Data Fields
int argc number of additional arguments
char const ** argv additional arguments
FR_TOKEN * argv_type
void * base
CONF_ITEM * children
rbtree_t * data_tree
int depth
CONF_ITEM item
char const * name1 First name token. Given foo bar {} would be foo.
char const * name2 Second name token. Given foo bar {} would be bar.
rbtree_t * name2_tree for sections of the same name2
FR_TOKEN name2_type The type of quoting around name2.
rbtree_t * pair_tree and a partridge..
rbtree_t * section_tree no jokes here.
CONF_ITEM * tail For speed.
CONF_SECTION * template
CONF_PARSER const * variables

Typedef Documentation

typedef struct cf_file_t cf_file_t
typedef enum conf_type CONF_ITEM_TYPE

Enumeration Type Documentation

Enumerator
CONF_INCLUDE_FILE 
CONF_INCLUDE_DIR 
CONF_INCLUDE_FROMDIR 

Definition at line 133 of file conffile.c.

Enumerator
CONF_PROPERTY_INVALID 
CONF_PROPERTY_NAME 
CONF_PROPERTY_INSTANCE 

Definition at line 47 of file conffile.c.

enum conf_type
Enumerator
CONF_ITEM_INVALID 
CONF_ITEM_PAIR 
CONF_ITEM_SECTION 
CONF_ITEM_DATA 

Definition at line 60 of file conffile.c.

Function Documentation

static int _cf_data_free ( CONF_DATA cd)
static

Definition at line 249 of file conffile.c.

+ Here is the caller graph for this function:

static int _cf_section_free ( CONF_SECTION cs)
static

Definition at line 508 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void _pair_count ( int *  count,
CONF_SECTION const *  cs 
)
static

Definition at line 3865 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int cf_data_add ( CONF_SECTION cs,
char const *  name,
void *  data,
void(*)(void *)  data_free 
)

Definition at line 4018 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int cf_data_add_internal ( CONF_SECTION cs,
char const *  name,
void *  data,
void(*)(void *)  data_free,
int  flag 
)
static

Definition at line 3993 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static CONF_DATA* cf_data_alloc ( CONF_SECTION parent,
char const *  name,
void *  data,
void(*)(void *)  data_free 
)
static

Definition at line 3934 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void* cf_data_find ( CONF_SECTION const *  cs,
char const *  name 
)

Definition at line 3981 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void * cf_data_find_internal ( CONF_SECTION const *  cs,
char const *  name,
int  flag 
)
static

Definition at line 3960 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void* cf_data_remove ( CONF_SECTION cs,
char const *  name 
)

Remove named data from a configuration section.

Definition at line 4027 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static CONF_ITEM* cf_data_to_item ( CONF_DATA const *  cd)
static

Cast CONF_DATA to a CONF_ITEM.

Definition at line 237 of file conffile.c.

+ Here is the caller graph for this function:

static char const * cf_expand_variables ( char const *  cf,
int *  lineno,
CONF_SECTION outercs,
char *  output,
size_t  outsize,
char const *  input,
bool *  soft_fail 
)
static

Definition at line 1056 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int cf_file_changed ( CONF_SECTION cs,
rb_walker_t  callback 
)

Definition at line 486 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void cf_file_free ( CONF_SECTION cs)

Definition at line 3469 of file conffile.c.

+ Here is the caller graph for this function:

static int cf_file_include ( CONF_SECTION cs,
char const *  filename_in,
CONF_INCLUDE_TYPE  file_type,
char *  buff[7] 
)
static

+ Here is the caller graph for this function:

static int cf_file_include ( CONF_SECTION cs,
char const *  filename_in,
UNUSED CONF_INCLUDE_TYPE  file_type,
char *  buff[7] 
)
static

Definition at line 3326 of file conffile.c.

+ Here is the call graph for this function:

static bool cf_file_input ( CONF_SECTION cs,
char const *  filename 
)
static

Definition at line 395 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static FILE* cf_file_open ( CONF_SECTION cs,
char const *  filename 
)
static

Definition at line 331 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int cf_file_read ( CONF_SECTION cs,
char const *  filename 
)

Definition at line 3421 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void cf_item_add ( CONF_SECTION cs,
CONF_ITEM ci 
)

Definition at line 803 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CONF_ITEM* cf_item_find_next ( CONF_SECTION const *  section,
CONF_ITEM const *  item 
)

Return the next item after a CONF_ITEM.

Definition at line 3850 of file conffile.c.

+ Here is the caller graph for this function:

bool cf_item_is_pair ( CONF_ITEM const *  item)

Definition at line 3928 of file conffile.c.

+ Here is the caller graph for this function:

bool cf_item_is_section ( CONF_ITEM const *  item)

Definition at line 3923 of file conffile.c.

+ Here is the caller graph for this function:

CONF_SECTION* cf_item_parent ( CONF_ITEM const *  ci)

Definition at line 3896 of file conffile.c.

+ Here is the caller graph for this function:

CONF_PAIR* cf_item_to_pair ( CONF_ITEM const *  ci)

Cast a CONF_ITEM to a CONF_PAIR.

Definition at line 181 of file conffile.c.

+ Here is the caller graph for this function:

CONF_SECTION* cf_item_to_section ( CONF_ITEM const *  ci)

Cast a CONF_ITEM to a CONF_SECTION.

Definition at line 196 of file conffile.c.

+ Here is the caller graph for this function:

static char const* cf_local_file ( char const *  base,
char const *  filename,
char *  buffer,
size_t  bufsize 
)
static

Definition at line 2415 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void cf_log_err ( CONF_ITEM const *  ci,
char const *  fmt,
  ... 
)

Definition at line 4059 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void cf_log_err_cp ( CONF_PAIR const *  cp,
char const *  fmt,
  ... 
)

Definition at line 4095 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void cf_log_err_cs ( CONF_SECTION const *  cs,
char const *  fmt,
  ... 
)

Definition at line 4078 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void cf_log_info ( CONF_SECTION const *  cs,
char const *  fmt,
  ... 
)

Definition at line 4112 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void cf_log_module ( CONF_SECTION const *  cs,
char const *  fmt,
  ... 
)

Definition at line 4124 of file conffile.c.

+ Here is the call graph for this function:

void cf_pair_add ( CONF_SECTION parent,
CONF_PAIR cp 
)

Add a configuration pair to a section.

Parameters
parentsection to add pair to.
cpto add.

Definition at line 612 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CONF_PAIR* cf_pair_alloc ( CONF_SECTION parent,
char const *  attr,
char const *  value,
FR_TOKEN  op,
FR_TOKEN  lhs_type,
FR_TOKEN  rhs_type 
)

Allocate a CONF_PAIR.

Parameters
parentCONF_SECTION to hang this CONF_PAIR off of.
attrname.
valueof CONF_PAIR.
opT_OP_EQ, T_OP_SET etc.
lhs_typeT_BARE_WORD, T_DOUBLE_QUOTED_STRING, T_BACK_QUOTED_STRING
rhs_typeT_BARE_WORD, T_DOUBLE_QUOTED_STRING, T_BACK_QUOTED_STRING
Returns

Definition at line 546 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

char const* cf_pair_attr ( CONF_PAIR const *  pair)

Definition at line 3497 of file conffile.c.

+ Here is the caller graph for this function:

FR_TOKEN cf_pair_attr_type ( CONF_PAIR const *  pair)

Return the value (lhs) type.

Parameters
pairto extract value type from.
Returns

Definition at line 3526 of file conffile.c.

+ Here is the caller graph for this function:

int cf_pair_count ( CONF_SECTION const *  cs)

Count the number of conf pairs beneath a section.

Parameters
[in]csto search for items in.
Returns
number of pairs nested within section.

Definition at line 3887 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int cf_pair_default ( CONF_PAIR **  out,
CONF_SECTION cs,
char const *  name,
int  type,
char const *  dflt,
FR_TOKEN  dflt_quote 
)
static

Allocate a pair using the dflt value and quotation.

The pair created by this function should fed to cf_pair_parse for parsing.

Parameters
[out]outWhere to write the CONF_PAIR we created with the default value.
[in]csto parent the CONF_PAIR from.
[in]nameof the CONF_PAIR to create.
[in]typeof conf item being parsed (determines default quoting).
[in]dfltvalue to assign the CONF_PAIR.
[in]dflt_quotesurrounding the CONF_PAIR.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1853 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CONF_PAIR* cf_pair_dup ( CONF_SECTION parent,
CONF_PAIR cp 
)

Duplicate a CONF_PAIR.

Parameters
parentto allocate new pair in.
cpto duplicate.
Returns
  • NULL on error.
  • A duplicate of the input pair.

Definition at line 589 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

char const* cf_pair_filename ( CONF_PAIR const *  pair)

Definition at line 3908 of file conffile.c.

+ Here is the caller graph for this function:

CONF_PAIR* cf_pair_find ( CONF_SECTION const *  cs,
char const *  name 
)

Definition at line 3478 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CONF_PAIR* cf_pair_find_next ( CONF_SECTION const *  cs,
CONF_PAIR const *  pair,
char const *  attr 
)

Find a pair with a name matching attr, after specified pair.

Parameters
csto search in.
pairto search from (may be NULL).
attrto find (may be NULL in which case any attribute matches).
Returns
the next matching CONF_PAIR or NULL if none matched.

Definition at line 3673 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int cf_pair_lineno ( CONF_PAIR const *  pair)

Definition at line 3918 of file conffile.c.

+ Here is the caller graph for this function:

FR_TOKEN cf_pair_operator ( CONF_PAIR const *  pair)

Definition at line 3511 of file conffile.c.

+ Here is the caller graph for this function:

int cf_pair_parse ( CONF_SECTION cs,
char const *  name,
unsigned int  type,
void *  data,
char const *  dflt,
FR_TOKEN  dflt_quote 
)

Parses a CONF_PAIR into a C data type, with a default value.

Takes fields from a CONF_PARSER struct and uses them to parse the string value of a CONF_PAIR into a C data type matching the type argument.

The format of the types are the same as value_data_t types.

Note
The dflt value will only be used if no matching CONF_PAIR is found. Empty strings will not result in the dflt value being used.

PW_TYPE to data type mappings

PW_TYPE Data type Dynamically allocated
PW_TYPE_TMPL vp_tmpl_t Yes
PW_TYPE_BOOLEAN bool No
PW_TYPE_INTEGER uint32_t No
PW_TYPE_SHORT uint16_t No
PW_TYPE_INTEGER64 uint64_t No
PW_TYPE_SIGNED int32_t No
PW_TYPE_STRING char const * Yes
PW_TYPE_IPV4_ADDR fr_ipaddr_t No
PW_TYPE_IPV4_PREFIX fr_ipaddr_t No
PW_TYPE_IPV6_ADDR fr_ipaddr_t No
PW_TYPE_IPV6_PREFIX fr_ipaddr_t No
PW_TYPE_COMBO_IP_ADDR fr_ipaddr_t No
PW_TYPE_COMBO_IP_PREFIX fr_ipaddr_t No
PW_TYPE_TIMEVAL struct timeval No
Parameters
csto search for matching CONF_PAIR in.
nameof CONF_PAIR to search for.
typeData type to parse CONF_PAIR value as. Should be one of the following data types, and one or more of the following flag types or'd together:
dataPointer to a global variable, or pointer to a field in the struct being populated with values.
dfltvalue to use, if no CONF_PAIR is found.
dflt_quotearound the dflt value.
Returns
  • 1 if default value was used, or if there was no CONF_PAIR or dflt.
  • 0 on success.
  • -1 on error.
  • -2 if deprecated.

Definition at line 1968 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int cf_pair_parse_value ( void *  out,
TALLOC_CTX *  ctx,
CONF_SECTION cs,
CONF_PAIR cp,
unsigned int  type 
)
static

Parses a CONF_PAIR into a C data type.

See Also
cf_pair_value
Parameters
[out]outWhere to write the parsed value.
[in]ctxto allocate any dynamic buffers in.
[in]cscontaining the cp.
[in]cpto parse.
[in]typeto parse to. May contain flags.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 1560 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int cf_pair_replace ( CONF_SECTION cs,
CONF_PAIR cp,
char const *  value 
)

Replace pair in a given section with a new pair, of the given value.

Parameters
csto replace pair in.
cpto replace.
valueNew value to assign to cp.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 768 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CONF_ITEM* cf_pair_to_item ( CONF_PAIR const *  cp)

Cast a CONF_PAIR to a CONF_ITEM.

Definition at line 211 of file conffile.c.

+ Here is the caller graph for this function:

char const* cf_pair_value ( CONF_PAIR const *  pair)

Definition at line 3506 of file conffile.c.

+ Here is the caller graph for this function:

FR_TOKEN cf_pair_value_type ( CONF_PAIR const *  pair)

Return the value (rhs) type.

Parameters
pairto extract value type from.
Returns

Definition at line 3541 of file conffile.c.

+ Here is the caller graph for this function:

VALUE_PAIR* cf_pairtovp ( CONF_PAIR pair)

Definition at line 3550 of file conffile.c.

+ Here is the call graph for this function:

CONF_ITEM* cf_reference_item ( CONF_SECTION const *  parentcs,
CONF_SECTION outercs,
char const *  ptr 
)

Definition at line 906 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void cf_section_add ( CONF_SECTION parent,
CONF_SECTION cs 
)

Definition at line 754 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CONF_SECTION* cf_section_alloc ( CONF_SECTION parent,
char const *  name1,
char const *  name2 
)

Allocate a CONF_SECTION.

Parameters
parentCONF_SECTION to hang this CONF_SECTION off of.
name1Primary name.
name2Secondary name.
Returns

Definition at line 626 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

char const* cf_section_argv ( CONF_SECTION const *  cs,
int  argc 
)

Definition at line 3619 of file conffile.c.

+ Here is the caller graph for this function:

FR_TOKEN cf_section_argv_type ( CONF_SECTION const *  cs,
int  argc 
)

Definition at line 4155 of file conffile.c.

+ Here is the caller graph for this function:

CONF_SECTION* cf_section_dup ( CONF_SECTION parent,
CONF_SECTION const *  cs,
char const *  name1,
char const *  name2,
bool  copy_meta 
)

Duplicate a configuration section.

Note
recursively duplicates any child sections.
does not duplicate any data associated with a section, or its child sections.
Parameters
parentsection (may be NULL).
csto duplicate.
name1of new section.
name2of new section.
copy_metaCopy additional meta data for a section (like template, base, depth and variables).
Returns
  • A duplicate of the existing section.
  • NULL on error.

Definition at line 697 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

char const* cf_section_filename ( CONF_SECTION const *  section)

Definition at line 3913 of file conffile.c.

+ Here is the caller graph for this function:

CONF_SECTION* cf_section_find_name2 ( CONF_SECTION const *  cs,
char const *  name1,
char const *  name2 
)

Definition at line 3639 of file conffile.c.

+ Here is the call graph for this function:

CONF_SECTION* cf_section_find_next ( CONF_SECTION const *  section,
CONF_SECTION const *  subsection,
char const *  name1 
)

Definition at line 3836 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int cf_section_lineno ( CONF_SECTION const *  section)

Definition at line 3903 of file conffile.c.

+ Here is the caller graph for this function:

char const* cf_section_name ( CONF_SECTION const *  cs)

Return name2 if set, else name1.

Definition at line 3609 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

char const* cf_section_name1 ( CONF_SECTION const *  cs)

Definition at line 3592 of file conffile.c.

+ Here is the caller graph for this function:

char const* cf_section_name2 ( CONF_SECTION const *  cs)

Definition at line 3601 of file conffile.c.

+ Here is the caller graph for this function:

FR_TOKEN cf_section_name2_type ( CONF_SECTION const *  cs)

Definition at line 4148 of file conffile.c.

+ Here is the caller graph for this function:

int cf_section_parse ( CONF_SECTION cs,
void *  base,
CONF_PARSER const *  variables 
)

Parse a configuration section into user-supplied variables.

Parameters
csto parse.
basepointer to a struct to fill with data. Any buffers will also be talloced using this parent as a pointer.
variablesmappings between struct fields and CONF_ITEM s.
Returns
  • 0 on success.
  • -1 on general error.
  • -2 if a deprecated CONF_ITEM was found.

Definition at line 2234 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void cf_section_parse_init ( CONF_SECTION cs,
void *  base,
CONF_PARSER const *  variables 
)
static

Definition at line 2145 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int cf_section_parse_pass2 ( CONF_SECTION cs,
void *  base,
CONF_PARSER const  variables[] 
)

Fixup xlat expansions and attributes.

Note
Despite the name, this is really the second phase of cf_pair_parse.
Parameters
csCONF_SECTION to fixup.
basestart of structure to write vp_tmpl_t s to.
variablesArray of CONF_PARSER structs to process.
Returns
  • 0 on success.
  • -1 on failure (parse errors etc...).

Definition at line 1364 of file conffile.c.

+ Here is the call graph for this function:

const CONF_PARSER* cf_section_parse_table ( CONF_SECTION cs)

Definition at line 4138 of file conffile.c.

+ Here is the caller graph for this function:

static void cf_section_parse_warn ( CONF_SECTION cs)
static

Definition at line 2194 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int cf_section_pass2 ( CONF_SECTION cs)
static

Definition at line 3383 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int cf_section_read ( char const *  filename,
int *  lineno,
FILE *  fp,
CONF_SECTION current,
char *  buff[7] 
)
static

Definition at line 2504 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CONF_SECTION* cf_section_sub_find ( CONF_SECTION const *  cs,
char const *  name 
)

Find a sub-section in a section.

This finds ANY section having the same first name. The second name is ignored.

Definition at line 3708 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CONF_SECTION* cf_section_sub_find_name2 ( CONF_SECTION const *  cs,
char const *  name1,
char const *  name2 
)

Find a CONF_SECTION with both names.

Definition at line 3728 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CONF_ITEM* cf_section_to_item ( CONF_SECTION const *  cs)

Cast a CONF_SECTION to a CONF_ITEM.

Definition at line 224 of file conffile.c.

+ Here is the caller graph for this function:

char const* cf_section_value_find ( CONF_SECTION const *  cs,
char const *  attr 
)

Definition at line 3629 of file conffile.c.

+ Here is the call graph for this function:

CONF_SECTION* cf_subsection_find_next ( CONF_SECTION const *  section,
CONF_SECTION const *  subsection,
char const *  name1 
)

Definition at line 3799 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool cf_template_merge ( CONF_SECTION cs,
CONF_SECTION const *  template 
)
static

Definition at line 2336 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CONF_SECTION* cf_top_section ( CONF_SECTION cs)

Definition at line 1041 of file conffile.c.

+ Here is the caller graph for this function:

static int data_cmp ( void const *  a,
void const *  b 
)
static

Definition at line 301 of file conffile.c.

+ Here is the caller graph for this function:

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

Definition at line 453 of file conffile.c.

+ Here is the caller graph for this function:

static int filename_cmp ( void const *  a,
void const *  b 
)
static

Definition at line 317 of file conffile.c.

+ Here is the caller graph for this function:

static int fr_item_validate_ipaddr ( CONF_SECTION cs,
char const *  name,
PW_TYPE  type,
char const *  value,
fr_ipaddr_t ipaddr 
)
inlinestatic

Validation function for ipaddr conffile types.

Definition at line 1307 of file conffile.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool invalid_location ( CONF_SECTION this,
char const *  name,
char const *  filename,
int  lineno 
)
static

Definition at line 2440 of file conffile.c.

+ Here is the caller graph for this function:

static int name2_cmp ( void const *  a,
void const *  b 
)
static

Definition at line 283 of file conffile.c.

+ Here is the caller graph for this function:

static int pair_cmp ( void const *  a,
void const *  b 
)
static

Definition at line 259 of file conffile.c.

+ Here is the caller graph for this function:

static int section_cmp ( void const *  a,
void const *  b 
)
static

Definition at line 271 of file conffile.c.

+ Here is the caller graph for this function:

Variable Documentation

bool check_config = false

Definition at line 45 of file conffile.c.

const FR_NAME_NUMBER conf_property_name[]
static
Initial value:
= {
{ "name", CONF_PROPERTY_NAME},
{ "instance", CONF_PROPERTY_INSTANCE},
{ NULL , -1 }
}

Definition at line 53 of file conffile.c.

char const parse_spaces[] = " "
static

Definition at line 1302 of file conffile.c.