26 RCSID(
"$Id: 735ca3fe9d000d29d3187c7adba09d61ff9b3d1c $")
28 #include "rlm_cache.h"
43 TALLOC_CTX *value_pool = NULL;
47 char *to_store = NULL;
51 if (!to_store)
return -1;
56 if (map_list_empty(&c->
maps))
goto finish;
58 value_pool = talloc_pool(ctx, 512);
66 while ((map = map_list_next(&c->
maps, map))) {
73 "bytes, needed %zu additional bytes", (
size_t)(slen * -1));
78 if (!
value)
goto error;
80 to_store = talloc_asprintf_append_buffer(to_store,
"%s %s %s\n", attr,
83 if (!to_store)
goto error;
111 while (((
size_t)(p -
in)) < (
size_t)
inlen) {
134 "Check local dictionaries", map->
lhs->name,
141 "Check serialized data quoting", map->
rhs->name,
156 case FR_CACHE_CREATED:
161 case FR_CACHE_EXPIRES:
173 map_list_insert_tail(&c->
maps, map);
static bool fr_dict_attr_is_top_level(fr_dict_attr_t const *da)
Return true if this attribute is parented directly off the dictionary root.
int map_afrom_attr_str(TALLOC_CTX *ctx, map_t **out, char const *vp_str, tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules)
Convert a value pair string to valuepair map.
@ TMPL_ATTR_REF_PREFIX_NO
Attribute refs have no '&' prefix.
fr_slen_t tmpl_print(fr_sbuff_t *out, tmpl_t const *vpt, tmpl_attr_prefix_t ar_prefix, fr_sbuff_escape_rules_t const *e_rules)
fr_dict_attr_t const * request_attr_request
map_list_t maps
Head of the maps list.
fr_unix_time_t created
When the entry was created.
fr_unix_time_t expires
When the entry expires.
#define FR_SBUFF_OUT(_start, _len_or_end)
int cache_serialize(TALLOC_CTX *ctx, char **out, rlm_cache_entry_t const *c)
Serialize a cache entry as a humanly readable string.
int cache_deserialize(rlm_cache_entry_t *c, fr_dict_t const *dict, char *in, ssize_t inlen)
Converts a serialized cache entry back into a structure.
#define tmpl_value(_tmpl)
static fr_dict_attr_t const * tmpl_attr_tail_da(tmpl_t const *vpt)
Return the last attribute reference da.
#define tmpl_is_attr(vpt)
int tmpl_cast_in_place(tmpl_t *vpt, fr_type_t type, fr_dict_attr_t const *enumv))
Convert tmpl_t of type TMPL_TYPE_DATA_UNRESOLVED or TMPL_TYPE_DATA to TMPL_TYPE_DATA of type specifie...
#define tmpl_is_data_unresolved(vpt)
tmpl_attr_rules_t attr
Rules/data for parsing attribute references.
static char const * tmpl_type_to_str(tmpl_type_t type)
Return a static string containing the type name.
Optional arguments passed to vp_tmpl functions.
fr_token_t op
The operator that controls insertion of the dst attribute.
tmpl_t * lhs
Typically describes the attribute to add, modify or compare.
tmpl_t * rhs
Typically describes a literal value or a src attribute to copy or compare.
fr_dict_t const * dict_def
Default dictionary to use with unqualified attribute references.
#define fr_table_str_by_value(_table, _number, _def)
Convert an integer to a string.
char * talloc_typed_asprintf(TALLOC_CTX *ctx, char const *fmt,...)
Call talloc vasprintf, setting the type on the new chunk correctly.
fr_table_num_ordered_t const fr_tokens_table[]
#define fr_strerror_printf(_fmt,...)
Log to thread local error buffer.
static size_t char fr_sbuff_t size_t inlen
static fr_slen_t static e_rules fr_slen_t fr_value_box_aprint_quoted(TALLOC_CTX *ctx, char **out, fr_value_box_t const *data, fr_token_t quote) 1(fr_value_box_print_quoted
static size_t char ** out
#define fr_box_date(_val)