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/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_MONO(_xlat, _func, _return_type, _arg)
 
#define XLAT_REGISTER_MONO(_xlat, _func, _return_type, _arg)
 

Enumerations

enum  hmac_type {
  HMAC_MD5 ,
  HMAC_SHA1
}
 

Functions

static int _log_dst_free (fr_log_t *log)
 
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)
 
int xlat_fmt_get_vp (fr_pair_t **out, request_t *request, char const *name)
 Return a VP from the specified request. More...
 
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_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_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...
 
void xlat_global_free (void)
 De-register all xlat functions we created. More...
 
int xlat_global_init (TALLOC_CTX *ctx)
 Global initialisation for xlat. More...
 
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)
 
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 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 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_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_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
1236b4853171f69746d054f86eca82823c475870

Baked in expansions.

Definition in file xlat_builtin.c.


Data Structure Documentation

◆ xlat_eval_inst_t

struct xlat_eval_inst_t

Definition at line 1449 of file xlat_builtin.c.

◆ xlat_eval_rctx_t

struct xlat_eval_rctx_t

Definition at line 1429 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(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:378
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:195
@ 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(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_MONO [1/2]

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

◆ XLAT_REGISTER_MONO [2/2]

#define XLAT_REGISTER_MONO (   _xlat,
  _func,
  _return_type,
  _arg 
)
Value:
do { \
if (unlikely((xlat = xlat_func_register(ctx, _xlat, _func, _return_type)) == NULL)) return -1; \
xlat_func_mono_set(xlat, _arg); \
xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_INTERNAL); \
} while (0)

Enumeration Type Documentation

◆ hmac_type

enum hmac_type
Enumerator
HMAC_MD5 
HMAC_SHA1 

Definition at line 2141 of file xlat_builtin.c.

Function Documentation

◆ _log_dst_free()

static int _log_dst_free ( fr_log_t log)
static

Definition at line 1176 of file xlat_builtin.c.

+ Here is the call graph for this function:
+ 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 3717 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 2235 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 3441 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 252 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 154 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 1453 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 1437 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 382 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 445 of file xlat_builtin.c.

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

◆ xlat_fmt_get_vp()

int xlat_fmt_get_vp ( fr_pair_t **  out,
request_t request,
char const *  name 
)

Return a VP from the specified request.

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

Definition at line 76 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 470 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 493 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 514 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 736 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 572 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 598 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 2220 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 773 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 2251 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 759 of file xlat_builtin.c.

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

◆ xlat_global_free()

void xlat_global_free ( void  )

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

int xlat_global_init ( TALLOC_CTX *  ctx)

Global initialisation for xlat.

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

Definition at line 3919 of file xlat_builtin.c.

+ 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 2146 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 3829 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 3889 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 269 of file xlat_builtin.c.

+ Here is the call graph for this function:

Variable Documentation

◆ hextab

char const hextab[] = "0123456789abcdef"
static

Definition at line 62 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 3666 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 3723 of file xlat_builtin.c.

◆ XLAT_ACTION_DONE

return XLAT_ACTION_DONE

Definition at line 278 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 3464 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 348 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 364 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 1788 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 1739 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 1847 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 1916 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 2040 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 101 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 149 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 1462 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 794 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 458 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 463 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 2093 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 885 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 943 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 2210 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 2265 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 1072 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 1182 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 1251 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 2301 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 2341 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 1336 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 1551 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 2381 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 2450 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 2490 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 2802 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 2937 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 3228 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 2975 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 3337 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 3508 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 3590 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 2169 of file xlat_builtin.c.