26 RCSID(
"$Id: a86e91dd477cd5d55dde20e4551b37e5dd3fa34b $")
28 #include "rlm_cache.h"
43 TALLOC_CTX *value_pool = NULL;
47 char *to_store = NULL;
49 to_store = talloc_asprintf(ctx,
"&Cache-Expires = %" PRIu64
"\n&Cache-Created = %" PRIu64
"\n",
51 if (!to_store)
return -1;
56 if (!c->
maps)
goto finish;
58 value_pool = talloc_pool(ctx, 512);
61 talloc_free(to_store);
62 talloc_free(value_pool);
66 for (map = c->
maps; map; map = map->
next) {
73 "bytes, got %zu bytes", len);
78 map->
lhs->tmpl_da, &map->
rhs->tmpl_data_value,
'\'');
79 if (!value)
goto error;
81 to_store = talloc_asprintf_append_buffer(to_store,
"%s %s %s\n", attr,
84 if (!to_store)
goto error;
87 talloc_free(value_pool);
108 if (inlen < 0) inlen = strlen(in);
112 while (((
size_t)(p - in)) < (
size_t)inlen) {
130 "Check local dictionaries", map->
lhs->
name,
137 "Check serialized data quoting", map->
rhs->
name,
151 if (map->
lhs->tmpl_da->vendor == 0)
switch (map->
lhs->tmpl_da->attr) {
152 case PW_CACHE_CREATED:
157 case PW_CACHE_EXPIRES:
168 last = &(*last)->
next;
char const * name
Raw string used to create the template.
vp_tmpl_t * lhs
Typically describes the attribute to add, modify or compare.
int cache_serialize(TALLOC_CTX *ctx, char **out, rlm_cache_entry_t const *c)
Serialize a cache entry as a humanly readable string.
vp_tmpl_t * rhs
Typically describes a literal value or a src attribute to copy or compare.
const FR_NAME_NUMBER fr_tokens_table[]
struct vp_map * next
The next valuepair map.
#define is_truncated(_ret, _max)
time_t expires
When the entry expires.
Attributes in incoming or internally proxied request.
tmpl_type_t type
What type of value tmpl refers to.
time_t created
When the entry was created.
int int map_afrom_attr_str(TALLOC_CTX *ctx, vp_map_t **out, char const *raw, request_refs_t dst_request_def, pair_lists_t dst_list_def, request_refs_t src_request_def, pair_lists_t src_list_def)
Convert a value pair string to valuepair map.
FR_TOKEN op
The operator that controls insertion of the dst attribute.
size_t tmpl_snprint(char *buffer, size_t bufsize, vp_tmpl_t const *vpt, fr_dict_attr_t const *values)
Print a vp_tmpl_t to a string.
void fr_strerror_printf(char const *,...) CC_HINT(format(printf
char const * fr_int2str(FR_NAME_NUMBER const *table, int number, char const *def)
vp_map_t * maps
Head of the maps list.
int tmpl_cast_in_place(vp_tmpl_t *vpt, PW_TYPE type, fr_dict_attr_t const *enumv)
Convert vp_tmpl_t of type TMPL_TYPE_UNPARSED or TMPL_TYPE_DATA to TMPL_TYPE_DATA of type specified...
char * value_data_asprint(TALLOC_CTX *ctx, PW_TYPE type, fr_dict_attr_t const *enumv, value_data_t const *data, char quote)
Print one attribute value to a string.
int cache_deserialize(rlm_cache_entry_t *c, char *in, ssize_t inlen)
Converts a serialized cache entry back into a structure.
const FR_NAME_NUMBER tmpl_names[]
Map tmpl_type_t values to descriptive strings.