The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Enumerations | Functions | Variables
xlat_builtin.c File Reference

String expansion ("translation"). More...

#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/tmpl_dcursor.h>
#include <freeradius-devel/unlang/interpret.h>
#include <freeradius-devel/unlang/xlat_priv.h>
#include <freeradius-devel/unlang/xlat_func.h>
#include <freeradius-devel/unlang/xlat.h>
#include <freeradius-devel/unlang/xlat_ctx.h>
#include <freeradius-devel/io/test_point.h>
#include <freeradius-devel/util/base64.h>
#include <freeradius-devel/util/base16.h>
#include <freeradius-devel/util/dlist.h>
#include <freeradius-devel/util/md5.h>
#include <freeradius-devel/util/misc.h>
#include <freeradius-devel/util/print.h>
#include <freeradius-devel/util/rand.h>
#include <freeradius-devel/util/regex.h>
#include <freeradius-devel/util/sbuff.h>
#include <freeradius-devel/util/sha1.h>
#include <freeradius-devel/util/value.h>
#include <sys/stat.h>
#include <fcntl.h>
+ Include dependency graph for xlat_builtin.c:

Go to the source code of this file.

Data Structures

struct  xlat_eval_inst_t
 
struct  xlat_eval_rctx_t
 

Macros

#define REPETITION_MAX   1024
 
#define XLAT_REGISTER_ARGS(_xlat, _func, _return_type, _args)
 
#define XLAT_REGISTER_ARGS(_xlat, _func, _return_type, _args)
 
#define XLAT_REGISTER_PURE(_xlat, _func, _return_type, _arg)
 

Enumerations

enum  hmac_type {
  HMAC_MD5 ,
  HMAC_SHA1
}
 

Functions

static int _log_dst_free (fr_log_t *log)
 
static int _xlat_global_free (UNUSED void *uctx)
 De-register all xlat functions we created. More...
 
static int _xlat_global_init (UNUSED void *uctx)
 Global initialisation for xlat. More...
 
static xlat_action_t protocol_decode_xlat (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 Decode any protocol attribute / options. More...
 
static xlat_action_t protocol_encode_xlat (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Encode protocol attributes / options. More...
 
static int protocol_xlat_instantiate (xlat_inst_ctx_t const *mctx)
 
static void ungroup (fr_dcursor_t *out, fr_value_box_list_t *in)
 
static xlat_action_t xlat_change_case (UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED request_t *request, fr_value_box_list_t *args, bool upper)
 Change case of a string. More...
 
void xlat_debug_attr_list (request_t *request, fr_pair_list_t const *list)
 
void xlat_debug_attr_vp (request_t *request, fr_pair_t *vp, tmpl_t const *vpt)
 
static int xlat_eval_instantiate (xlat_inst_ctx_t const *xctx)
 
static xlat_action_t xlat_eval_resume (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, UNUSED request_t *request, UNUSED fr_value_box_list_t *in)
 Just serves to push the result up the stack. More...
 
static ssize_t xlat_file_escape_path (fr_sbuff_t *in, fr_value_box_t *vb)
 Escape the paths as necessary. More...
 
static const char * xlat_file_name (fr_value_box_t *vb)
 
static xlat_action_t xlat_func_base64_decode (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Decode base64 string. More...
 
static xlat_action_t xlat_func_base64_encode (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Encode string or attribute as base64. More...
 
static xlat_action_t xlat_func_bin (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Convert hex string to binary. More...
 
static xlat_action_t xlat_func_cast (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Cast one or more output value-boxes to the given type. More...
 
static xlat_action_t xlat_func_concat (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Concatenate string representation of values of given attributes using separator. More...
 
static xlat_action_t xlat_func_debug (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Dynamically change the debugging level for the current request. More...
 
static xlat_action_t xlat_func_debug_attr (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Print out attribute info. More...
 
static xlat_action_t xlat_func_eval (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Dynamically evaluate an expansion string. More...
 
static xlat_action_t xlat_func_explode (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Split a string into multiple new strings based on a delimiter. More...
 
static xlat_action_t xlat_func_file_escape (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
 
static xlat_action_t xlat_func_file_exists (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
 
static xlat_action_t xlat_func_file_head (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 
static xlat_action_t xlat_func_file_rm (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 
static xlat_action_t xlat_func_file_size (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 
static xlat_action_t xlat_func_file_tail (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 
static xlat_action_t xlat_func_hex (UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
 Print data as hex, not as VALUE. More...
 
static xlat_action_t xlat_func_hmac_md5 (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
 Generate the HMAC-MD5 of a string or attribute. More...
 
static xlat_action_t xlat_func_hmac_sha1 (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
 Generate the HMAC-SHA1 of a string or attribute. More...
 
static xlat_action_t xlat_func_immutable_attr (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Mark one or more attributes as immutable. More...
 
static xlat_action_t xlat_func_integer (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Print data as integer, not as VALUE. More...
 
static xlat_action_t xlat_func_join (UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
 Join a series of arguments to form a single list. More...
 
static xlat_action_t xlat_func_length (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
 Return the on-the-wire size of the boxes in bytes. More...
 
static xlat_action_t xlat_func_log_debug (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Log something at DEBUG level. More...
 
static xlat_action_t xlat_func_log_dst (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Change the log destination to the named one. More...
 
static xlat_action_t xlat_func_log_err (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Log something at DEBUG level. More...
 
static xlat_action_t xlat_func_log_info (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Log something at INFO level. More...
 
static xlat_action_t xlat_func_log_warn (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Log something at WARN level. More...
 
static xlat_action_t xlat_func_lpad (UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 lpad a string More...
 
static xlat_action_t xlat_func_map (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Processes fmt as a map string and applies it to the current request. More...
 
static xlat_action_t xlat_func_md4 (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
 Calculate the MD4 hash of a string or attribute. More...
 
static xlat_action_t xlat_func_md5 (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
 Calculate the MD5 hash of a string or attribute. More...
 
static xlat_action_t xlat_func_next_time (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Calculate number of seconds until the next n hour(s), day(s), week(s), year(s). More...
 
static xlat_action_t xlat_func_pairs (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Encode attributes as a series of string attribute/value pairs. More...
 
static xlat_action_t xlat_func_rand (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
 Generate a random integer value. More...
 
static xlat_action_t xlat_func_randstr (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Generate a string of random chars. More...
 
static xlat_action_t xlat_func_rpad (UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Right pad a string. More...
 
static xlat_action_t xlat_func_sha1 (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
 Calculate the SHA1 hash of a string or attribute. More...
 
static xlat_action_t xlat_func_str_printable (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
 Return whether a string has only printable chars. More...
 
static xlat_action_t xlat_func_str_utf8 (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
 Return whether a string is valid UTF-8. More...
 
static xlat_action_t xlat_func_string (UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
 Print data as string, if possible. More...
 
static xlat_action_t xlat_func_strlen (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
 Print length of given string. More...
 
static xlat_action_t xlat_func_subnet_broadcast (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
 Calculate the broadcast address from a IPv4 prefix. More...
 
static xlat_action_t xlat_func_subnet_netmask (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
 Calculate the subnet mask from a IPv4 prefix. More...
 
static xlat_action_t xlat_func_subst (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Perform regex substitution. More...
 
static xlat_action_t xlat_func_substr (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Extract a substring from string / octets data. More...
 
static xlat_action_t xlat_func_taint (UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
 
static xlat_action_t xlat_func_time (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 Return the time as a FR_TYPE_DATE. More...
 
static xlat_action_t xlat_func_tolower (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 Convert a string to lowercase. More...
 
static xlat_action_t xlat_func_toupper (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in)
 Convert a string to uppercase. More...
 
static xlat_action_t xlat_func_ungroup (UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
 Ungroups all of its arguments into one flat list. More...
 
static xlat_action_t xlat_func_untaint (UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *in)
 
static xlat_action_t xlat_func_urlquote (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
 URLencode special characters. More...
 
static xlat_action_t xlat_func_urlunquote (TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
 URLdecode special characters. More...
 
int xlat_global_init (void)
 
static xlat_action_t xlat_hmac (TALLOC_CTX *ctx, fr_dcursor_t *out, fr_value_box_list_t *args, uint8_t *digest, int digest_len, hmac_type type)
 
static int xlat_protocol_register (fr_dict_t const *dict)
 
static int xlat_protocol_register_by_name (dl_t *dl, char const *name)
 
static int xlat_protocol_register_cbor (void)
 
int xlat_protocols_register (void)
 Register xlats for any loaded dictionaries. More...
 
xlat_action_t xlat_transparent (UNUSED TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, fr_value_box_list_t *args)
 Common function to move boxes form input list to output list. More...
 

Variables

static dl_loader_tcbor_loader = NULL
 
static char const hextab [] = "0123456789abcdef"
 
static xlat_arg_parser_t const protocol_decode_xlat_args []
 
static xlat_arg_parser_t const protocol_encode_xlat_args []
 
return XLAT_ACTION_DONE
 
static xlat_arg_parser_t const xlat_change_case_arg []
 
static TALLOC_CTX * xlat_ctx
 
static const fr_sbuff_escape_rules_t xlat_filename_escape
 
static const fr_sbuff_escape_rules_t xlat_filename_escape_dots
 
static xlat_arg_parser_t const xlat_func_base64_decode_arg []
 
static xlat_arg_parser_t const xlat_func_base64_encode_arg []
 
static xlat_arg_parser_t const xlat_func_bin_arg []
 
static xlat_arg_parser_t const xlat_func_cast_args []
 
static xlat_arg_parser_t const xlat_func_concat_args []
 
static xlat_arg_parser_t const xlat_func_debug_args []
 
static xlat_arg_parser_t const xlat_func_debug_attr_args []
 
static xlat_arg_parser_t const xlat_func_eval_arg []
 
static xlat_arg_parser_t const xlat_func_explode_args []
 
static xlat_arg_parser_t const xlat_func_file_name_args []
 
static xlat_arg_parser_t const xlat_func_file_name_count_args []
 
static xlat_arg_parser_t const xlat_func_hex_arg []
 
static xlat_arg_parser_t const xlat_func_immutable_attr_args []
 
static xlat_arg_parser_t const xlat_func_integer_args []
 
static xlat_arg_parser_t const xlat_func_join_args []
 
static xlat_arg_parser_t const xlat_func_length_args []
 
static xlat_arg_parser_t const xlat_func_log_arg []
 
static xlat_arg_parser_t const xlat_func_log_dst_args []
 
static xlat_arg_parser_t const xlat_func_map_arg []
 
static xlat_arg_parser_t const xlat_func_md4_arg []
 
static xlat_arg_parser_t const xlat_func_md5_arg []
 
static xlat_arg_parser_t const xlat_func_next_time_args []
 
static xlat_arg_parser_t const xlat_func_pad_args []
 
static xlat_arg_parser_t const xlat_func_pairs_args []
 
static xlat_arg_parser_t const xlat_func_rand_arg []
 
static xlat_arg_parser_t const xlat_func_randstr_arg []
 
static xlat_arg_parser_t const xlat_func_sha_arg []
 
static xlat_arg_parser_t const xlat_func_str_printable_arg []
 
static xlat_arg_parser_t const xlat_func_str_utf8_arg []
 
static xlat_arg_parser_t const xlat_func_string_arg []
 Calculate any digest supported by OpenSSL EVP_MD. More...
 
static xlat_arg_parser_t const xlat_func_strlen_arg []
 
static xlat_arg_parser_t const xlat_func_subnet_args []
 
static xlat_arg_parser_t const xlat_func_subst_args []
 
static xlat_arg_parser_t const xlat_func_substr_args []
 
static xlat_arg_parser_t const xlat_func_time_args []
 
static xlat_arg_parser_t const xlat_func_urlquote_arg []
 
static xlat_arg_parser_t const xlat_func_urlunquote_arg []
 
static xlat_arg_parser_t const xlat_hmac_args []
 

Detailed Description

String expansion ("translation").

Id
89796b4ba8acbc885f05caddda3526f76823fa36

Baked in expansions.

Definition in file xlat_builtin.c.


Data Structure Documentation

◆ xlat_eval_inst_t

struct xlat_eval_inst_t

Definition at line 1418 of file xlat_builtin.c.

◆ xlat_eval_rctx_t

struct xlat_eval_rctx_t

Definition at line 1398 of file xlat_builtin.c.

+ Collaboration diagram for xlat_eval_rctx_t:
Data Fields
xlat_exp_head_t * ex
bool last_success

Macro Definition Documentation

◆ REPETITION_MAX

#define REPETITION_MAX   1024

◆ XLAT_REGISTER_ARGS [1/2]

#define XLAT_REGISTER_ARGS (   _xlat,
  _func,
  _return_type,
  _args 
)
Value:
do { \
if (unlikely((xlat = xlat_func_register(xlat_ctx, _xlat, _func, _return_type)) == NULL)) return -1; \
xlat_func_args_set(xlat, _args); \
xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_PURE | XLAT_FUNC_FLAG_INTERNAL); \
} while (0)
#define unlikely(_x)
Definition: build.h:379
static TALLOC_CTX * xlat_ctx
Definition: xlat_builtin.c:65
xlat_t * xlat_func_register(TALLOC_CTX *ctx, char const *name, xlat_func_t func, fr_type_t return_type)
Register an xlat function.
Definition: xlat_func.c:218
@ XLAT_FUNC_FLAG_PURE
Definition: xlat_func.h:38
@ XLAT_FUNC_FLAG_INTERNAL
Definition: xlat_func.h:39

◆ XLAT_REGISTER_ARGS [2/2]

#define XLAT_REGISTER_ARGS (   _xlat,
  _func,
  _return_type,
  _args 
)
Value:
do { \
if (unlikely((xlat = xlat_func_register(xlat_ctx, _xlat, _func, _return_type)) == NULL)) return -1; \
xlat_func_args_set(xlat, _args); \
xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_INTERNAL); \
} while (0)

◆ XLAT_REGISTER_PURE

#define XLAT_REGISTER_PURE (   _xlat,
  _func,
  _return_type,
  _arg 
)
Value:
do { \
if (unlikely((xlat = xlat_func_register(xlat_ctx, _xlat, _func, _return_type)) == NULL)) return -1; \
xlat_func_args_set(xlat, _arg); \
xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_PURE | XLAT_FUNC_FLAG_INTERNAL); \
} while (0)

Enumeration Type Documentation

◆ hmac_type

enum hmac_type
Enumerator
HMAC_MD5 
HMAC_SHA1 

Definition at line 2115 of file xlat_builtin.c.

Function Documentation

◆ _log_dst_free()

static int _log_dst_free ( fr_log_t log)
static

Definition at line 1145 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _xlat_global_free()

static int _xlat_global_free ( UNUSED void *  uctx)
static

De-register all xlat functions we created.

Definition at line 4065 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _xlat_global_init()

static int _xlat_global_init ( UNUSED void *  uctx)
static

Global initialisation for xlat.

Note
Free memory with #xlat_free
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 4085 of file xlat_builtin.c.

+ Here is the caller graph for this function:

◆ protocol_xlat_instantiate()

static int protocol_xlat_instantiate ( xlat_inst_ctx_t const *  mctx)
static

Definition at line 3841 of file xlat_builtin.c.

+ Here is the caller graph for this function:

◆ ungroup()

static void ungroup ( fr_dcursor_t out,
fr_value_box_list_t *  in 
)
static

Definition at line 2209 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_change_case()

static xlat_action_t xlat_change_case ( UNUSED TALLOC_CTX *  ctx,
fr_dcursor_t out,
UNUSED request_t request,
fr_value_box_list_t *  args,
bool  upper 
)
static

Change case of a string.

If upper is true, change to uppercase, otherwise, change to lowercase

Definition at line 3516 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_debug_attr_list()

void xlat_debug_attr_list ( request_t request,
fr_pair_list_t const *  list 
)

Definition at line 221 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_debug_attr_vp()

void xlat_debug_attr_vp ( request_t request,
fr_pair_t vp,
tmpl_t const *  vpt 
)

Definition at line 123 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_eval_instantiate()

static int xlat_eval_instantiate ( xlat_inst_ctx_t const *  xctx)
static

Definition at line 1422 of file xlat_builtin.c.

+ Here is the caller graph for this function:

◆ xlat_eval_resume()

static xlat_action_t xlat_eval_resume ( UNUSED TALLOC_CTX *  ctx,
UNUSED fr_dcursor_t out,
xlat_ctx_t const *  xctx,
UNUSED request_t request,
UNUSED fr_value_box_list_t *  in 
)
static

Just serves to push the result up the stack.

Definition at line 1406 of file xlat_builtin.c.

+ Here is the call graph for this function:

◆ xlat_file_escape_path()

static ssize_t xlat_file_escape_path ( fr_sbuff_t in,
fr_value_box_t vb 
)
static

Escape the paths as necessary.

Definition at line 351 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_file_name()

static const char* xlat_file_name ( fr_value_box_t vb)
static

Definition at line 414 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_func_file_escape()

static xlat_action_t xlat_func_file_escape ( TALLOC_CTX *  ctx,
fr_dcursor_t out,
UNUSED xlat_ctx_t const *  xctx,
UNUSED request_t request,
fr_value_box_list_t *  args 
)
static

Definition at line 439 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_func_file_exists()

static xlat_action_t xlat_func_file_exists ( TALLOC_CTX *  ctx,
fr_dcursor_t out,
UNUSED xlat_ctx_t const *  xctx,
UNUSED request_t request,
fr_value_box_list_t *  args 
)
static

Definition at line 462 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_func_file_head()

static xlat_action_t xlat_func_file_head ( TALLOC_CTX *  ctx,
fr_dcursor_t out,
UNUSED xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 483 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_func_file_rm()

static xlat_action_t xlat_func_file_rm ( TALLOC_CTX *  ctx,
fr_dcursor_t out,
UNUSED xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 705 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_func_file_size()

static xlat_action_t xlat_func_file_size ( TALLOC_CTX *  ctx,
fr_dcursor_t out,
UNUSED xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 541 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_func_file_tail()

static xlat_action_t xlat_func_file_tail ( TALLOC_CTX *  ctx,
fr_dcursor_t out,
UNUSED xlat_ctx_t const *  xctx,
request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 567 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_func_join()

static xlat_action_t xlat_func_join ( UNUSED TALLOC_CTX *  ctx,
fr_dcursor_t out,
UNUSED xlat_ctx_t const *  xctx,
UNUSED request_t request,
fr_value_box_list_t *  in 
)
static

Join a series of arguments to form a single list.

null boxes are not preserved.

Definition at line 2194 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_func_taint()

static xlat_action_t xlat_func_taint ( UNUSED TALLOC_CTX *  ctx,
fr_dcursor_t out,
UNUSED xlat_ctx_t const *  xctx,
UNUSED request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 742 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_func_ungroup()

static xlat_action_t xlat_func_ungroup ( UNUSED TALLOC_CTX *  ctx,
fr_dcursor_t out,
UNUSED xlat_ctx_t const *  xctx,
UNUSED request_t request,
fr_value_box_list_t *  in 
)
static

Ungroups all of its arguments into one flat list.

Definition at line 2225 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_func_untaint()

static xlat_action_t xlat_func_untaint ( UNUSED TALLOC_CTX *  ctx,
fr_dcursor_t out,
UNUSED xlat_ctx_t const *  xctx,
UNUSED request_t request,
fr_value_box_list_t *  in 
)
static

Definition at line 728 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_global_init()

int xlat_global_init ( void  )

Definition at line 4241 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_hmac()

static xlat_action_t xlat_hmac ( TALLOC_CTX *  ctx,
fr_dcursor_t out,
fr_value_box_list_t *  args,
uint8_t digest,
int  digest_len,
hmac_type  type 
)
static

Definition at line 2120 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_protocol_register()

static int xlat_protocol_register ( fr_dict_t const *  dict)
static

Definition at line 3998 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_protocol_register_by_name()

static int xlat_protocol_register_by_name ( dl_t dl,
char const *  name 
)
static

Definition at line 3953 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_protocol_register_cbor()

static int xlat_protocol_register_cbor ( void  )
static

Definition at line 4020 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_protocols_register()

int xlat_protocols_register ( void  )

Register xlats for any loaded dictionaries.

Definition at line 4038 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xlat_transparent()

xlat_action_t xlat_transparent ( UNUSED TALLOC_CTX *  ctx,
fr_dcursor_t out,
UNUSED xlat_ctx_t const *  xctx,
UNUSED request_t request,
fr_value_box_list_t *  args 
)

Common function to move boxes form input list to output list.

This can be used to implement safe_for functions, as the xlat framework can be used for concatenation, casting, and marking up output boxes as safe_for.

Definition at line 238 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ cbor_loader

dl_loader_t* cbor_loader = NULL
static

Definition at line 4018 of file xlat_builtin.c.

◆ hextab

char const hextab[] = "0123456789abcdef"
static

Definition at line 64 of file xlat_builtin.c.

◆ protocol_decode_xlat_args

xlat_arg_parser_t const protocol_decode_xlat_args[]
static
Initial value:
= {
{ .single = true, .variadic = XLAT_ARG_VARIADIC_EMPTY_SQUASH, .type = FR_TYPE_VOID },
}
@ FR_TYPE_VOID
User data.
Definition: merged_model.c:127
@ XLAT_ARG_VARIADIC_EMPTY_SQUASH
Empty argument groups are removed.
Definition: xlat.h:136
#define XLAT_ARG_PARSER_TERMINATOR
Definition: xlat.h:166

Definition at line 3741 of file xlat_builtin.c.

◆ protocol_encode_xlat_args

xlat_arg_parser_t const protocol_encode_xlat_args[]
static
Initial value:
= {
{ .required = true, .single = true, .type = FR_TYPE_STRING },
}
@ FR_TYPE_STRING
String of printable characters.
Definition: merged_model.c:83

Definition at line 3847 of file xlat_builtin.c.

◆ XLAT_ACTION_DONE

return XLAT_ACTION_DONE

Definition at line 247 of file xlat_builtin.c.

◆ xlat_change_case_arg

xlat_arg_parser_t const xlat_change_case_arg[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
}

Definition at line 3539 of file xlat_builtin.c.

◆ xlat_ctx

TALLOC_CTX* xlat_ctx
static

Definition at line 65 of file xlat_builtin.c.

◆ xlat_filename_escape

const fr_sbuff_escape_rules_t xlat_filename_escape
static
Initial value:
= {
.name = "filename",
.chr = '_',
.do_utf8 = true,
.do_hex = true,
.esc = {
[ 0x00 ... 0x2d ] = true,
[ 0x2f ] = true,
[ 0x3A ... 0x3f ] = true,
[ 0x5b ... 0x5e ] = true,
[ 0x60 ] = true,
[ 0x7b ... 0xff ] = true,
},
}

Definition at line 317 of file xlat_builtin.c.

◆ xlat_filename_escape_dots

const fr_sbuff_escape_rules_t xlat_filename_escape_dots
static
Initial value:
= {
.name = "filename",
.chr = '_',
.do_utf8 = true,
.do_hex = true,
.esc = {
[ 0x00 ... 0x2f ] = true,
[ 0x3A ... 0x3f ] = true,
[ 0x5b ... 0x5e ] = true,
[ 0x60 ] = true,
[ 0x7b ... 0xff ] = true,
},
}

Definition at line 333 of file xlat_builtin.c.

◆ xlat_func_base64_decode_arg

xlat_arg_parser_t const xlat_func_base64_decode_arg[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_OCTETS },
}
@ FR_TYPE_OCTETS
Raw octets.
Definition: merged_model.c:84

Definition at line 1757 of file xlat_builtin.c.

◆ xlat_func_base64_encode_arg

xlat_arg_parser_t const xlat_func_base64_encode_arg[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_OCTETS },
}

Definition at line 1708 of file xlat_builtin.c.

◆ xlat_func_bin_arg

xlat_arg_parser_t const xlat_func_bin_arg[]
static
Initial value:
= {
{ .required = true, .type = FR_TYPE_STRING },
}

Definition at line 1816 of file xlat_builtin.c.

◆ xlat_func_cast_args

xlat_arg_parser_t const xlat_func_cast_args[]
static
Initial value:
= {
{ .required = true, .single = true, .type = FR_TYPE_VOID },
{ .type = FR_TYPE_VOID },
{ .variadic = XLAT_ARG_VARIADIC_EMPTY_KEEP, .type = FR_TYPE_VOID },
}
@ XLAT_ARG_VARIADIC_EMPTY_KEEP
Empty argument groups are left alone, and either passed through as empty groups or null boxes.
Definition: xlat.h:137

Definition at line 1885 of file xlat_builtin.c.

◆ xlat_func_concat_args

xlat_arg_parser_t const xlat_func_concat_args[]
static
Initial value:
= {
{ .required = true, .type = FR_TYPE_VOID },
{ .concat = true, .type = FR_TYPE_STRING },
}

Definition at line 2014 of file xlat_builtin.c.

◆ xlat_func_debug_args

xlat_arg_parser_t const xlat_func_debug_args[]
static
Initial value:
= {
{ .single = true, .type = FR_TYPE_INT8 },
}
@ FR_TYPE_INT8
8 Bit signed integer.
Definition: merged_model.c:103

Definition at line 70 of file xlat_builtin.c.

◆ xlat_func_debug_attr_args

xlat_arg_parser_t const xlat_func_debug_attr_args[]
static
Initial value:
= {
{ .required = true, .single = true, .type = FR_TYPE_STRING },
}

Definition at line 118 of file xlat_builtin.c.

◆ xlat_func_eval_arg

xlat_arg_parser_t const xlat_func_eval_arg[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
}

Definition at line 1431 of file xlat_builtin.c.

◆ xlat_func_explode_args

xlat_arg_parser_t const xlat_func_explode_args[]
static
Initial value:
= {
{ .required = true, .type = FR_TYPE_STRING },
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
}

Definition at line 763 of file xlat_builtin.c.

◆ xlat_func_file_name_args

xlat_arg_parser_t const xlat_func_file_name_args[]
static
Initial value:
= {
{ .required = true, .type = FR_TYPE_STRING },
}

Definition at line 427 of file xlat_builtin.c.

◆ xlat_func_file_name_count_args

xlat_arg_parser_t const xlat_func_file_name_count_args[]
static
Initial value:
= {
{ .required = true, .type = FR_TYPE_STRING },
{ .required = false, .type = FR_TYPE_UINT32 },
}
@ FR_TYPE_UINT32
32 Bit unsigned integer.
Definition: merged_model.c:99

Definition at line 432 of file xlat_builtin.c.

◆ xlat_func_hex_arg

xlat_arg_parser_t const xlat_func_hex_arg[]
static
Initial value:
= {
{ .required = true, .type = FR_TYPE_OCTETS },
}

Definition at line 2067 of file xlat_builtin.c.

◆ xlat_func_immutable_attr_args

xlat_arg_parser_t const xlat_func_immutable_attr_args[]
static
Initial value:
= {
{ .required = true, .single = true, .type = FR_TYPE_STRING },
}

Definition at line 854 of file xlat_builtin.c.

◆ xlat_func_integer_args

xlat_arg_parser_t const xlat_func_integer_args[]
static
Initial value:
= {
{ .required = true, .single = true, .type = FR_TYPE_VOID },
}

Definition at line 912 of file xlat_builtin.c.

◆ xlat_func_join_args

xlat_arg_parser_t const xlat_func_join_args[]
static
Initial value:
= {
{ .required = true, .type = FR_TYPE_VOID },
{ .variadic = XLAT_ARG_VARIADIC_EMPTY_SQUASH, .type = FR_TYPE_VOID },
}

Definition at line 2184 of file xlat_builtin.c.

◆ xlat_func_length_args

xlat_arg_parser_t const xlat_func_length_args[]
static
Initial value:
= {
{ .single = true, .variadic = XLAT_ARG_VARIADIC_EMPTY_KEEP, .type = FR_TYPE_VOID },
}

Definition at line 2239 of file xlat_builtin.c.

◆ xlat_func_log_arg

xlat_arg_parser_t const xlat_func_log_arg[]
static
Initial value:
= {
{ .concat = true, .type = FR_TYPE_STRING },
}

Definition at line 1041 of file xlat_builtin.c.

◆ xlat_func_log_dst_args

xlat_arg_parser_t const xlat_func_log_dst_args[]
static
Initial value:
= {
{ .required = false, .type = FR_TYPE_STRING, .concat = true },
{ .required = false, .type = FR_TYPE_UINT32, .single = true },
{ .required = false, .type = FR_TYPE_STRING, .concat = true },
}

Definition at line 1151 of file xlat_builtin.c.

◆ xlat_func_map_arg

xlat_arg_parser_t const xlat_func_map_arg[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
}

Definition at line 1220 of file xlat_builtin.c.

◆ xlat_func_md4_arg

xlat_arg_parser_t const xlat_func_md4_arg[]
static
Initial value:
= {
{ .concat = true, .type = FR_TYPE_OCTETS },
}

Definition at line 2275 of file xlat_builtin.c.

◆ xlat_func_md5_arg

xlat_arg_parser_t const xlat_func_md5_arg[]
static
Initial value:
= {
{ .concat = true, .type = FR_TYPE_OCTETS },
}

Definition at line 2315 of file xlat_builtin.c.

◆ xlat_func_next_time_args

xlat_arg_parser_t const xlat_func_next_time_args[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
}

Definition at line 1305 of file xlat_builtin.c.

◆ xlat_func_pad_args

xlat_arg_parser_t const xlat_func_pad_args[]
static
Initial value:
= {
{ .required = true, .type = FR_TYPE_STRING },
{ .required = true, .single = true, .type = FR_TYPE_UINT64 },
{ .concat = true, .type = FR_TYPE_STRING },
}
@ FR_TYPE_UINT64
64 Bit unsigned integer.
Definition: merged_model.c:100

Definition at line 1520 of file xlat_builtin.c.

◆ xlat_func_pairs_args

xlat_arg_parser_t const xlat_func_pairs_args[]
static
Initial value:
= {
{ .required = true, .single = true, .type = FR_TYPE_STRING },
}

Definition at line 2355 of file xlat_builtin.c.

◆ xlat_func_rand_arg

xlat_arg_parser_t const xlat_func_rand_arg[]
static
Initial value:
= {
{ .required = true, .single = true, .type = FR_TYPE_UINT32 },
}

Definition at line 2424 of file xlat_builtin.c.

◆ xlat_func_randstr_arg

xlat_arg_parser_t const xlat_func_randstr_arg[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
}

Definition at line 2464 of file xlat_builtin.c.

◆ xlat_func_sha_arg

xlat_arg_parser_t const xlat_func_sha_arg[]
static
Initial value:
= {
{ .concat = true, .type = FR_TYPE_OCTETS },
}

Definition at line 2776 of file xlat_builtin.c.

◆ xlat_func_str_printable_arg

xlat_arg_parser_t const xlat_func_str_printable_arg[]
static
Initial value:
= {
{ .concat = true, .type = FR_TYPE_STRING },
{ .single = true, .type = FR_TYPE_BOOL },
}
@ FR_TYPE_BOOL
A truth value.
Definition: merged_model.c:95

Definition at line 2955 of file xlat_builtin.c.

◆ xlat_func_str_utf8_arg

xlat_arg_parser_t const xlat_func_str_utf8_arg[]
static
Initial value:
= {
{ .concat = true, .type = FR_TYPE_STRING },
}

Definition at line 3015 of file xlat_builtin.c.

◆ xlat_func_strlen_arg

xlat_arg_parser_t const xlat_func_strlen_arg[]
static
Initial value:
= {
{ .concat = true, .type = FR_TYPE_STRING },
}

Definition at line 2917 of file xlat_builtin.c.

◆ xlat_func_subnet_args

xlat_arg_parser_t const xlat_func_subnet_args[]
static
Initial value:
= {
{ .required = true, .single = true, .type = FR_TYPE_IPV4_PREFIX },
}
@ FR_TYPE_IPV4_PREFIX
IPv4 Prefix.
Definition: merged_model.c:87

Definition at line 3792 of file xlat_builtin.c.

◆ xlat_func_subst_args

xlat_arg_parser_t const xlat_func_subst_args[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
}

Definition at line 3303 of file xlat_builtin.c.

◆ xlat_func_substr_args

xlat_arg_parser_t const xlat_func_substr_args[]
static
Initial value:
= {
{ .single = true, .required = true, .type = FR_TYPE_VOID },
{ .single = true, .required = true, .type = FR_TYPE_INT32 },
{ .single = true, .type = FR_TYPE_INT32 },
}
@ FR_TYPE_INT32
32 Bit signed integer.
Definition: merged_model.c:105

Definition at line 3050 of file xlat_builtin.c.

◆ xlat_func_time_args

xlat_arg_parser_t const xlat_func_time_args[]
static
Initial value:
= {
{ .required = false, .single = true, .type = FR_TYPE_STRING },
}

Definition at line 3412 of file xlat_builtin.c.

◆ xlat_func_urlquote_arg

xlat_arg_parser_t const xlat_func_urlquote_arg[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
}

Definition at line 3583 of file xlat_builtin.c.

◆ xlat_func_urlunquote_arg

xlat_arg_parser_t const xlat_func_urlunquote_arg[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
}

Definition at line 3665 of file xlat_builtin.c.

◆ xlat_hmac_args

xlat_arg_parser_t const xlat_hmac_args[]
static
Initial value:
= {
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
{ .required = true, .concat = true, .type = FR_TYPE_STRING },
}

Definition at line 2143 of file xlat_builtin.c.