int rcode;
char const *name1, *name2;
CONF_SECTION *cs;
- vp_map_t *head, *map;
+ map_t *head, *map;
char buffer[8192];
main_config_t *config;
* Verify the result of the map.
*/
static int map_proc_verify(CONF_SECTION *cs, UNUSED void *mod_inst, UNUSED void *proc_inst,
- tmpl_t const *src, UNUSED vp_map_t const *maps)
+ tmpl_t const *src, UNUSED map_t const *maps)
{
if (!src) {
cf_log_err(cs, "Missing source");
}
static rlm_rcode_t mod_map_proc(UNUSED void *mod_inst, UNUSED void *proc_inst, UNUSED request_t *request,
- UNUSED fr_value_box_t **src, UNUSED vp_map_t const *maps)
+ UNUSED fr_value_box_t **src, UNUSED map_t const *maps)
{
return RLM_MODULE_FAIL;
}
* Used to store the array of attributes we'll be querying for.
*/
typedef struct {
- vp_map_t const *maps; //!< Head of list of maps we expanded the RHS of.
+ map_t const *maps; //!< Head of list of maps we expanded the RHS of.
char const *attrs[LDAP_MAX_ATTRMAP + LDAP_MAP_RESERVED + 1]; //!< Reserve some space for access attributes
//!< and NULL termination.
TALLOC_CTX *ctx; //!< Context to allocate new attributes in.
* map.c - Attribute mapping code.
*/
int fr_ldap_map_getvalue(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request,
- vp_map_t const *map, void *uctx);
+ map_t const *map, void *uctx);
-int fr_ldap_map_verify(vp_map_t *map, void *instance);
+int fr_ldap_map_verify(map_t *map, void *instance);
-int fr_ldap_map_expand(fr_ldap_map_exp_t *expanded, request_t *request, vp_map_t const *maps);
+int fr_ldap_map_expand(fr_ldap_map_exp_t *expanded, request_t *request, map_t const *maps);
int fr_ldap_map_do(request_t *request, fr_ldap_connection_t *conn,
char const *valuepair_attr, fr_ldap_map_exp_t const *expanded, LDAPMessage *entry);
*
* @see map_to_vp
*/
-int fr_ldap_map_getvalue(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, vp_map_t const *map, void *uctx)
+int fr_ldap_map_getvalue(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, map_t const *map, void *uctx)
{
fr_ldap_result_t *self = uctx;
fr_pair_t *head = NULL, *vp;
*/
case TMPL_TYPE_LIST:
for (i = 0; i < self->count; i++) {
- vp_map_t *attr = NULL;
+ map_t *attr = NULL;
char *attr_str;
tmpl_rules_t lhs_rules = {
return 0;
}
-int fr_ldap_map_verify(vp_map_t *map, UNUSED void *instance)
+int fr_ldap_map_verify(map_t *map, UNUSED void *instance)
{
/*
* Destinations where we can put the fr_pair_ts we
* - 0 on success.
* - -1 on failure.
*/
-int fr_ldap_map_expand(fr_ldap_map_exp_t *expanded, request_t *request, vp_map_t const *maps)
+int fr_ldap_map_expand(fr_ldap_map_exp_t *expanded, request_t *request, map_t const *maps)
{
- vp_map_t const *map;
+ map_t const *map;
unsigned int total = 0;
TALLOC_CTX *ctx = NULL;
int fr_ldap_map_do(request_t *request, fr_ldap_connection_t *conn,
char const *valuepair_attr, fr_ldap_map_exp_t const *expanded, LDAPMessage *entry)
{
- vp_map_t const *map;
+ map_t const *map;
unsigned int total = 0;
int applied = 0; /* How many maps have been applied to the current request */
count = ldap_count_values_len(values);
for (i = 0; i < count; i++) {
- vp_map_t *attr;
+ map_t *attr;
char *value;
tmpl_rules_t parse_rules = {
int fr_redis_reply_to_value_box(TALLOC_CTX *ctx, fr_value_box_t *out, redisReply *reply,
fr_type_t dst_type, fr_dict_attr_t const *dst_enumv);
-int fr_redis_reply_to_map(TALLOC_CTX *ctx, vp_map_t **out,
+int fr_redis_reply_to_map(TALLOC_CTX *ctx, map_t **out,
request_t *request, redisReply *key, redisReply *op, redisReply *value);
-int fr_redis_tuple_from_map(TALLOC_CTX *pool, char const *out[], size_t out_len[], vp_map_t *map);
+int fr_redis_tuple_from_map(TALLOC_CTX *pool, char const *out[], size_t out_len[], map_t *map);
fr_redis_rcode_t fr_redis_get_version(char *out, size_t out_len, fr_redis_conn_t *conn);
* - 0 on success.
* - -1 on failure.
*/
-int fr_redis_reply_to_map(TALLOC_CTX *ctx, vp_map_t **out, request_t *request,
+int fr_redis_reply_to_map(TALLOC_CTX *ctx, map_t **out, request_t *request,
redisReply *key, redisReply *op, redisReply *value)
{
- vp_map_t *map = NULL;
+ map_t *map = NULL;
ssize_t slen;
*out = NULL;
RDEBUG3("Got op : %s", op->str);
RDEBUG3("Got value : %pV", fr_box_strvalue_len(value->str, value->len));
- MEM(map = talloc_zero(ctx, vp_map_t));
+ MEM(map = talloc_zero(ctx, map_t));
slen = tmpl_afrom_attr_str(map, NULL, &map->lhs, key->str, &(tmpl_rules_t){ .dict_def = request->dict });
if (slen < 0) {
REMARKER(key->str, -slen, "%s", fr_strerror());
* 0 on success.
* -1 on failure.
*/
-int fr_redis_tuple_from_map(TALLOC_CTX *pool, char const *out[], size_t out_len[], vp_map_t *map)
+int fr_redis_tuple_from_map(TALLOC_CTX *pool, char const *out[], size_t out_len[], map_t *map)
{
char *new;
///< is derived from.
union {
- vp_map_t *map; //!< Binary expression.
+ map_t *map; //!< Binary expression.
tmpl_t *vpt; //!< Unary expression.
fr_cond_t *child; //!< Nested condition.
rlm_rcode_t rcode; //!< Rcode check. We handle this outside of
fr_value_box_t const *lhs,
fr_value_box_t const *rhs)
{
- vp_map_t const *map = c->data.map;
+ map_t const *map = c->data.map;
ssize_t slen;
uint32_t subcaptures;
*/
static int cond_cmp_values(request_t *request, fr_cond_t const *c, fr_value_box_t const *lhs, fr_value_box_t const *rhs)
{
- vp_map_t const *map = c->data.map;
+ map_t const *map = c->data.map;
int rcode;
#ifdef WITH_EVAL_DEBUG
*/
static int cond_normalise_and_cmp(request_t *request, fr_cond_t const *c, fr_value_box_t const *lhs)
{
- vp_map_t const *map = c->data.map;
+ map_t const *map = c->data.map;
int rcode;
{
int rcode = 0;
- vp_map_t const *map = c->data.map;
+ map_t const *map = c->data.map;
EVAL_DEBUG(">>> MAP TYPES LHS: %s, RHS: %s",
fr_table_str_by_value(tmpl_type_table, map->lhs->type, "???"),
fr_sbuff_adv_past_whitespace(&our_in, SIZE_MAX);
{
- vp_map_t *map;
+ map_t *map;
tmpl_t *rhs;
/*
goto error;
}
- MEM(c->data.map = map = talloc(c, vp_map_t));
+ MEM(c->data.map = map = talloc(c, map_t));
/*
* Grab the RHS
*/
if (cond_forbid_groups(rhs, &our_in, &m_rhs) < 0) goto error;
- *map = (vp_map_t) {
+ *map = (map_t) {
.ci = cf_section_to_item(cs),
.lhs = lhs,
.op = op,
#include <ctype.h>
#ifdef DEBUG_MAP
-static void map_dump(request_t *request, vp_map_t const *map)
+static void map_dump(request_t *request, map_t const *map)
{
RDEBUG2(">>> MAP TYPES LHS: %s, RHS: %s",
fr_table_str_by_value(tmpl_type_table, map->lhs->type, "???"),
}
#endif
-static inline vp_map_t *map_alloc(TALLOC_CTX *ctx)
+static inline map_t *map_alloc(TALLOC_CTX *ctx)
{
- return talloc_zero(ctx, vp_map_t);
+ return talloc_zero(ctx, map_t);
}
/** re-parse a map where the lhs is an unknown attribute.
* @param rhs_quote quotation type around rhs.
* @param rhs string to re-parse.
*/
-bool map_cast_from_hex(vp_map_t *map, fr_token_t rhs_quote, char const *rhs)
+bool map_cast_from_hex(map_t *map, fr_token_t rhs_quote, char const *rhs)
{
size_t len;
uint8_t *ptr;
return true;
}
-/** Convert CONFIG_PAIR (which may contain refs) to vp_map_t.
+/** Convert CONFIG_PAIR (which may contain refs) to map_t.
*
* Treats the left operand as an attribute reference
* @verbatim<request>.<list>.<attribute>@endverbatim
* Return must be freed with talloc_free
*
* @param[in] ctx for talloc.
- * @param[in] out Where to write the pointer to the new #vp_map_t.
+ * @param[in] out Where to write the pointer to the new #map_t.
* @param[in] cp to convert to map.
* @param[in] lhs_rules rules for parsing LHS attribute references.
* @param[in] rhs_rules rules for parsing RHS attribute references.
* @return
- * - #vp_map_t if successful.
+ * - #map_t if successful.
* - NULL on error.
*/
-int map_afrom_cp(TALLOC_CTX *ctx, vp_map_t **out, CONF_PAIR *cp,
+int map_afrom_cp(TALLOC_CTX *ctx, map_t **out, CONF_PAIR *cp,
tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules)
{
- vp_map_t *map;
+ map_t *map;
char const *attr, *value, *marker_subject;
ssize_t slen;
fr_token_t type;
if (!cp) return -1;
- MEM(map = talloc_zero(ctx, vp_map_t));
+ MEM(map = talloc_zero(ctx, map_t));
map->op = cf_pair_operator(cp);
map->ci = cf_pair_to_item(cp);
* - 0 on success.
* - -1 on failure.
*/
-int map_afrom_cs(TALLOC_CTX *ctx, vp_map_t **out, CONF_SECTION *cs,
+int map_afrom_cs(TALLOC_CTX *ctx, map_t **out, CONF_SECTION *cs,
tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules,
map_validate_t validate, void *uctx,
unsigned int max)
CONF_PAIR *cp;
unsigned int total = 0;
- vp_map_t **tail, *map;
+ map_t **tail, *map;
TALLOC_CTX *parent;
tmpl_rules_t our_lhs_rules = *lhs_rules; /* Mutable copy of the destination */
}
-/** Convert strings to #vp_map_t
+/** Convert strings to #map_t
*
* Treatment of operands depends on quotation, barewords are treated
* as attribute references, double quoted values are treated as
* @param[in] rhs_quote type of quoting aounrd the RHS string.
* @param[in] rhs_rules rules that control parsing of the RHS string.
* @return
- * - #vp_map_t if successful.
+ * - #map_t if successful.
* - NULL on error.
*/
-int map_afrom_fields(TALLOC_CTX *ctx, vp_map_t **out,
+int map_afrom_fields(TALLOC_CTX *ctx, map_t **out,
char const *lhs, fr_token_t lhs_quote, tmpl_rules_t const *lhs_rules,
fr_token_t op,
char const *rhs, fr_token_t rhs_quote, tmpl_rules_t const *rhs_rules)
{
ssize_t slen;
- vp_map_t *map;
+ map_t *map;
- map = talloc_zero(ctx, vp_map_t);
+ map = talloc_zero(ctx, map_t);
slen = tmpl_afrom_substr(map, &map->lhs,
&FR_SBUFF_IN(lhs, strlen(lhs)),
lhs_quote,
* @param[in] steal_rhs_buffs Whether we attempt to save allocs by stealing the buffers
* from the rhs #fr_value_box_t.
* @return
- * - #vp_map_t if successful.
+ * - #map_t if successful.
* - NULL on error.
*/
-int map_afrom_value_box(TALLOC_CTX *ctx, vp_map_t **out,
+int map_afrom_value_box(TALLOC_CTX *ctx, map_t **out,
char const *lhs, fr_token_t lhs_quote, tmpl_rules_t const *lhs_rules,
fr_token_t op,
fr_value_box_t *rhs, bool steal_rhs_buffs)
{
ssize_t slen;
- vp_map_t *map;
+ map_t *map;
- map = talloc_zero(ctx, vp_map_t);
+ map = talloc_zero(ctx, map_t);
slen = tmpl_afrom_substr(map, &map->lhs,
&FR_SBUFF_IN(lhs, strlen(lhs)),
/** Convert a value pair string to valuepair map
*
* Takes a valuepair string with list and request qualifiers and converts it into a
- * #vp_map_t.
+ * #map_t.
*
* Attribute string is in the format (where @verbatim <qu> @endverbatim is a quotation char ['"]):
@verbatim
* - 0 on success.
* - < 0 on error.
*/
-int map_afrom_attr_str(TALLOC_CTX *ctx, vp_map_t **out, char const *vp_str,
+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)
{
char const *p = vp_str;
fr_token_t quote;
fr_pair_t_RAW raw;
- vp_map_t *map = NULL;
+ map_t *map = NULL;
quote = gettoken(&p, raw.l_opand, sizeof(raw.l_opand), false);
switch (quote) {
* - 0 on success.
* - -1 on failure.
*/
-int map_afrom_vp(TALLOC_CTX *ctx, vp_map_t **out, fr_pair_t *vp, tmpl_rules_t const *rules)
+int map_afrom_vp(TALLOC_CTX *ctx, map_t **out, fr_pair_t *vp, tmpl_rules_t const *rules)
{
char buffer[256];
- vp_map_t *map;
+ map_t *map;
map = map_alloc(ctx);
if (!map) {
return 0;
}
-static void map_sort_split(vp_map_t *source, vp_map_t **front, vp_map_t **back)
+static void map_sort_split(map_t *source, map_t **front, map_t **back)
{
- vp_map_t *fast;
- vp_map_t *slow;
+ map_t *fast;
+ map_t *slow;
/*
* Stopping condition - no more elements left to split
slow->next = NULL;
}
-static vp_map_t *map_sort_merge(vp_map_t *a, vp_map_t *b, fr_cmp_t cmp)
+static map_t *map_sort_merge(map_t *a, map_t *b, fr_cmp_t cmp)
{
- vp_map_t *result = NULL;
+ map_t *result = NULL;
if (!a) return b;
if (!b) return a;
return result;
}
-/** Sort a linked list of #vp_map_t using merge sort
+/** Sort a linked list of #map_t using merge sort
*
- * @param[in,out] maps List of #vp_map_t to sort.
+ * @param[in,out] maps List of #map_t to sort.
* @param[in] cmp to sort with
*/
-void map_sort(vp_map_t **maps, fr_cmp_t cmp)
+void map_sort(map_t **maps, fr_cmp_t cmp)
{
- vp_map_t *head = *maps;
- vp_map_t *a;
- vp_map_t *b;
+ map_t *head = *maps;
+ map_t *a;
+ map_t *b;
/*
* If there's 0-1 elements it must already be sorted.
* - 0 on success.
* - -1 on failure.
*/
-static int map_exec_to_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, vp_map_t const *map)
+static int map_exec_to_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, map_t const *map)
{
int result;
char *expanded = NULL;
* - 0 on success.
* - -1 on failure.
*/
-int map_to_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, vp_map_t const *map, UNUSED void *uctx)
+int map_to_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, map_t const *map, UNUSED void *uctx)
{
int rcode = 0;
fr_pair_t *vp = NULL, *found = NULL, *n;
} \
} while (0)
-/** Convert #vp_map_t to #fr_pair_t (s) and add them to a #request_t.
+/** Convert #map_t to #fr_pair_t (s) and add them to a #request_t.
*
- * Takes a single #vp_map_t, resolves request and list identifiers
+ * Takes a single #map_t, resolves request and list identifiers
* to pointers in the current request, then attempts to retrieve module
* specific value(s) using callback, and adds the resulting values to the
* correct request/list.
* - -2 in the source attribute wasn't valid.
* - 0 on success.
*/
-int map_to_request(request_t *request, vp_map_t const *map, radius_map_getvalue_t func, void *ctx)
+int map_to_request(request_t *request, map_t const *map, radius_map_getvalue_t func, void *ctx)
{
int rcode = 0;
int num;
bool found = false;
- vp_map_t exp_map;
+ map_t exp_map;
tmpl_t *exp_lhs;
request_ref_t request_ref;
pair_list_t list_ref;
* - The number of bytes written to the out buffer.
* - A number >= outlen if truncation has occurred.
*/
-ssize_t map_print(fr_sbuff_t *out, vp_map_t const *map)
+ssize_t map_print(fr_sbuff_t *out, map_t const *map)
{
fr_sbuff_t our_out = FR_SBUFF_NO_ADVANCE(out);
/*
* Debug print a map / VP
*/
-void map_debug_log(request_t *request, vp_map_t const *map, fr_pair_t const *vp)
+void map_debug_log(request_t *request, map_t const *map, fr_pair_t const *vp)
{
char *rhs = NULL, *value = NULL;
char buffer[256];
extern "C" {
#endif
-typedef struct vp_map_s vp_map_t;
+typedef struct vp_map_s map_t;
typedef struct vp_list_mod_s vp_list_mod_t;
#ifdef __cplusplus
CONF_ITEM *ci; //!< Config item that the map was created from. Mainly used for
//!< logging validation errors.
- vp_map_t *child; //!< a child map. If it exists, `rhs` MUST be NULL
- vp_map_t *next; //!< The next valuepair map.
+ map_t *child; //!< a child map. If it exists, `rhs` MUST be NULL
+ map_t *next; //!< The next valuepair map.
};
/** A list modification
*
*/
struct vp_list_mod_s {
- vp_map_t const *map; //!< Original map describing the change to be made.
+ map_t const *map; //!< Original map describing the change to be made.
- vp_map_t *mod; //!< New map containing the destination (LHS) and
+ map_t *mod; //!< New map containing the destination (LHS) and
///< values (RHS).
vp_list_mod_t *next;
};
} while (0)
#endif
-typedef int (*map_validate_t)(vp_map_t *map, void *ctx);
+typedef int (*map_validate_t)(map_t *map, void *ctx);
typedef int (*radius_map_getvalue_t)(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request,
- vp_map_t const *map, void *uctx);
+ map_t const *map, void *uctx);
-int map_afrom_cp(TALLOC_CTX *ctx, vp_map_t **out, CONF_PAIR *cp,
+int map_afrom_cp(TALLOC_CTX *ctx, map_t **out, CONF_PAIR *cp,
tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules);
-int map_afrom_cs(TALLOC_CTX *ctx, vp_map_t **out, CONF_SECTION *cs,
+int map_afrom_cs(TALLOC_CTX *ctx, map_t **out, CONF_SECTION *cs,
tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules,
map_validate_t validate, void *uctx, unsigned int max) CC_HINT(nonnull(2, 3));
-int map_afrom_fields(TALLOC_CTX *ctx, vp_map_t **out,
+int map_afrom_fields(TALLOC_CTX *ctx, map_t **out,
char const *lhs, fr_token_t lhs_type, tmpl_rules_t const *lhs_rules,
fr_token_t op,
char const *rhs, fr_token_t rhs_type, tmpl_rules_t const *rhs_rules);
-int map_afrom_value_box(TALLOC_CTX *ctx, vp_map_t **out,
+int map_afrom_value_box(TALLOC_CTX *ctx, map_t **out,
char const *lhs, fr_token_t lhs_type, tmpl_rules_t const *lhs_rules,
fr_token_t op,
fr_value_box_t *rhs, bool steal_rhs_buffs);
-int map_afrom_attr_str(TALLOC_CTX *ctx, vp_map_t **out, char const *raw,
+int map_afrom_attr_str(TALLOC_CTX *ctx, map_t **out, char const *raw,
tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules);
-int map_afrom_vp(TALLOC_CTX *ctx, vp_map_t **out, fr_pair_t *vp,
+int map_afrom_vp(TALLOC_CTX *ctx, map_t **out, fr_pair_t *vp,
tmpl_rules_t const *rules);
-void map_sort(vp_map_t **maps, fr_cmp_t cmp);
+void map_sort(map_t **maps, fr_cmp_t cmp);
int map_to_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request,
- vp_map_t const *map, void *uctx) CC_HINT(nonnull (2,3,4));
+ map_t const *map, void *uctx) CC_HINT(nonnull (2,3,4));
int map_list_mod_apply(request_t *request, vp_list_mod_t const *vlm);
int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out,
- request_t *request, vp_map_t const *map,
+ request_t *request, map_t const *map,
fr_value_box_t **lhs_result, fr_value_box_t **rhs_result);
-int map_to_request(request_t *request, vp_map_t const *map,
+int map_to_request(request_t *request, map_t const *map,
radius_map_getvalue_t func, void *ctx);
-ssize_t map_print(fr_sbuff_t *out, vp_map_t const *map);
+ssize_t map_print(fr_sbuff_t *out, map_t const *map);
-void map_debug_log(request_t *request, vp_map_t const *map,
+void map_debug_log(request_t *request, map_t const *map,
fr_pair_t const *vp) CC_HINT(nonnull(1, 2));
-bool map_cast_from_hex(vp_map_t *map, fr_token_t rhs_type, char const *rhs);
+bool map_cast_from_hex(map_t *map, fr_token_t rhs_type, char const *rhs);
#ifdef __cplusplus
}
#endif
return talloc_zero(ctx, vp_list_mod_t);
}
-static inline vp_map_t *map_alloc(TALLOC_CTX *ctx)
+static inline map_t *map_alloc(TALLOC_CTX *ctx)
{
- return talloc_zero(ctx, vp_map_t);
+ return talloc_zero(ctx, map_t);
}
/** Allocate a 'generic' #vp_list_mod_t
* - NULL on failure.
*/
static inline vp_list_mod_t *list_mod_generic_afrom_map(TALLOC_CTX *ctx,
- vp_map_t const *original, vp_map_t const *mutated)
+ map_t const *original, map_t const *mutated)
{
vp_list_mod_t *n;
* - NULL on failure.
*/
static inline vp_list_mod_t *list_mod_delete_afrom_map(TALLOC_CTX *ctx,
- vp_map_t const *original, vp_map_t const *mutated)
+ map_t const *original, map_t const *mutated)
{
vp_list_mod_t *n;
* - NULL on failure.
*/
static inline vp_list_mod_t *list_mod_empty_string_afrom_map(TALLOC_CTX *ctx,
- vp_map_t const *original, vp_map_t const *mutated)
+ map_t const *original, map_t const *mutated)
{
vp_list_mod_t *n;
fr_value_box_t empty_string = {
* - true if destination list is OK.
* - false if destination list is invalid.
*/
-static inline fr_pair_t **map_check_src_or_dst(request_t *request, vp_map_t const *map, tmpl_t const *src_dst)
+static inline fr_pair_t **map_check_src_or_dst(request_t *request, map_t const *map, tmpl_t const *src_dst)
{
request_t *context = request;
fr_pair_t **list;
* - -1 on failure.
*/
int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out,
- request_t *request, vp_map_t const *original,
+ request_t *request, map_t const *original,
fr_value_box_t **lhs_result, fr_value_box_t **rhs_result)
{
vp_list_mod_t *n = NULL;
- vp_map_t map_tmp;
- vp_map_t const *mutated = original;
+ map_t map_tmp;
+ map_t const *mutated = original;
fr_cursor_t values;
fr_value_box_t *head = NULL;
* Iterate over all attributes in that list
*/
do {
- vp_map_t *n_mod;
+ map_t *n_mod;
n_mod = map_alloc(n);
if (!n_mod) goto error;
(void)fr_cursor_init(&from, &vp_head);
while ((vp = fr_cursor_remove(&from))) {
- vp_map_t *mod;
+ map_t *mod;
tmpl_rules_t rules;
memset(&rules, 0, sizeof(rules));
*/
static fr_pair_t *map_list_mod_to_vps(TALLOC_CTX *ctx, vp_list_mod_t const *vlm)
{
- vp_map_t *mod;
+ map_t *mod;
fr_pair_t *head = NULL;
fr_cursor_t cursor;
* @param[in] vb The value in the ephemeral map.
*/
static inline void map_list_mod_debug(request_t *request,
- vp_map_t const *map, vp_map_t const *mod, fr_value_box_t const *vb)
+ map_t const *map, map_t const *mod, fr_value_box_t const *vb)
{
char *rhs = NULL;
char const *quote = "";
{
int rcode = 0;
- vp_map_t const *map = vlm->map, *mod;
+ map_t const *map = vlm->map, *mod;
fr_pair_t **vp_list, *found;
request_t *context;
TALLOC_CTX *parent;
* - NULL on error.
*/
map_proc_inst_t *map_proc_instantiate(TALLOC_CTX *ctx, map_proc_t const *proc,
- CONF_SECTION *cs, tmpl_t const *src, vp_map_t const *maps)
+ CONF_SECTION *cs, tmpl_t const *src, map_t const *maps)
{
map_proc_inst_t *inst;
* - #RLM_MODULE_FAIL - If an error occurred performing the mapping.
*/
typedef rlm_rcode_t (*map_proc_func_t)(void *mod_inst, void *proc_inst, request_t *request,
- fr_value_box_t **result, vp_map_t const *maps);
+ fr_value_box_t **result, map_t const *maps);
/** Allocate new instance data for a map processor
*
* - -1 on failure.
*/
typedef int (*map_proc_instantiate_t)(CONF_SECTION *cs, void *mod_inst, void *proc_inst,
- tmpl_t const *src, vp_map_t const *maps);
+ tmpl_t const *src, map_t const *maps);
map_proc_t *map_proc_find(char const *name);
map_proc_instantiate_t instantiate, size_t inst_size);
map_proc_inst_t *map_proc_instantiate(TALLOC_CTX *ctx, map_proc_t const *proc,
- CONF_SECTION *cs, tmpl_t const *src, vp_map_t const *maps);
+ CONF_SECTION *cs, tmpl_t const *src, map_t const *maps);
rlm_rcode_t map_proc(request_t *request, map_proc_inst_t const *inst, fr_value_box_t **src);
struct map_proc_inst {
map_proc_t const *proc; //!< Map processor.
tmpl_t const *src; //!< Evaluated to provide source value for map processor.
- vp_map_t const *maps; //!< Head of the map list.
+ map_t const *maps; //!< Head of the map list.
void *data; //!< Instance data created by #map_proc_instantiate
};
#endif
int module_sibling_section_find(CONF_SECTION **out, CONF_SECTION *module, char const *name);
-int unlang_fixup_update(vp_map_t *map, void *ctx);
+int unlang_fixup_update(map_t *map, void *ctx);
#ifdef __cplusplus
}
*
* Is used as both the RHS and LHS of a map (both update, and conditional types)
*
- * @section update_maps Use in update vp_map_t
+ * @section update_maps Use in update map_t
* When used on the LHS it describes an attribute to create and should be one of these types:
* - #TMPL_TYPE_ATTR
* - #TMPL_TYPE_LIST
* - #TMPL_TYPE_DATA
* - #TMPL_TYPE_XLAT (pre-parsed xlat)
*
- * @section conditional_maps Use in conditional vp_map_t
+ * @section conditional_maps Use in conditional map_t
* When used as part of a condition it may be any of the RHS side types, as well as:
* - #TMPL_TYPE_REGEX (pre-parsed regex)
*
- * @see vp_map_t
+ * @see map_t
*/
struct tmpl_s {
tmpl_type_t _CONST type; //!< What type of value tmpl refers to.
static bool pass2_fixup_map(fr_cond_t *c)
{
tmpl_t *vpt;
- vp_map_t *map;
+ map_t *map;
map = c->data.map; /* shorter */
}
}
-static bool pass2_fixup_update_map(vp_map_t *map, tmpl_rules_t const *rules, fr_dict_attr_t const *parent)
+static bool pass2_fixup_update_map(map_t *map, tmpl_rules_t const *rules, fr_dict_attr_t const *parent)
{
if (tmpl_is_xlat_unresolved(map->lhs)) {
fr_assert(tmpl_xlat(map->lhs) == NULL);
static bool pass2_fixup_update(unlang_group_t *g, tmpl_rules_t const *rules)
{
unlang_map_t *gext = unlang_group_to_map(g);
- vp_map_t *map;
+ map_t *map;
for (map = gext->map; map != NULL; map = map->next) {
if (!pass2_fixup_update_map(map, rules, NULL)) return false;
{
unlang_t *c;
unlang_group_t *g;
- vp_map_t *map;
+ map_t *map;
char buffer[1024];
for (c = instruction; c != NULL; c = c->next) {
* @param ctx data to pass to fixup function (currently unused).
* @return 0 if valid else -1.
*/
-static int unlang_fixup_map(vp_map_t *map, UNUSED void *ctx)
+static int unlang_fixup_map(map_t *map, UNUSED void *ctx)
{
CONF_PAIR *cp = cf_item_to_pair(map->ci);
* - 0 if valid.
* - -1 not valid.
*/
-int unlang_fixup_update(vp_map_t *map, UNUSED void *ctx)
+int unlang_fixup_update(map_t *map, UNUSED void *ctx)
{
CONF_PAIR *cp = cf_item_to_pair(map->ci);
* - 0 if valid.
* - -1 not valid.
*/
-static int unlang_fixup_filter(vp_map_t *map, UNUSED void *ctx)
+static int unlang_fixup_filter(map_t *map, UNUSED void *ctx)
{
CONF_PAIR *cp = cf_item_to_pair(map->ci);
ssize_t slen;
char const *tmpl_str;
- vp_map_t *head;
+ map_t *head;
tmpl_t *vpt = NULL;
map_proc_t *proc;
unlang_t *c;
char const *name2 = cf_section_name2(cs);
- vp_map_t *head;
+ map_t *head;
tmpl_rules_t parse_rules;
unlang_t *c;
char const *name2 = cf_section_name2(cs);
- vp_map_t *head;
+ map_t *head;
tmpl_rules_t parse_rules;
.len = sizeof(unlang_cond_t),
.type_name = "unlang_cond_t",
.pool_headers = 1 + 1 + (TMPL_POOL_DEF_HEADERS * 2),
- .pool_len = sizeof(fr_cond_t) + sizeof(vp_map_t) + (TMPL_POOL_DEF_LEN * 2)
+ .pool_len = sizeof(fr_cond_t) + sizeof(map_t) + (TMPL_POOL_DEF_LEN * 2)
};
return compile_if_subsection(parent, unlang_ctx, cs, &if_ext);
.len = sizeof(unlang_cond_t),
.type_name = "unlang_cond_t",
.pool_headers = 1 + 1 + (TMPL_POOL_DEF_HEADERS * 2),
- .pool_len = sizeof(fr_cond_t) + sizeof(vp_map_t) + (TMPL_POOL_DEF_LEN * 2)
+ .pool_len = sizeof(fr_cond_t) + sizeof(map_t) + (TMPL_POOL_DEF_LEN * 2)
};
return compile_if_subsection(parent, unlang_ctx, cs, &elsif_ext);
unlang_stack_t *stack = request->stack;
unlang_stack_frame_t *frame = &stack->frame[stack->depth];
unlang_frame_state_update_t *update_state = frame->state;
- vp_map_t *map;
+ map_t *map;
/*
* Iterate over the maps producing a set of modifications to apply.
* Initialise the frame state
*/
MEM(frame->state = update_state = talloc_zero_pooled_object(stack, unlang_frame_state_update_t,
- (sizeof(vp_map_t) +
+ (sizeof(map_t) +
(sizeof(tmpl_t) * 2) + 128),
g->num_children)); /* 128 is for string buffers */
typedef struct {
unlang_group_t group;
tmpl_t *vpt;
- vp_map_t *map; //!< Head of the map list
+ map_t *map; //!< Head of the map list
map_proc_inst_t *proc_inst;
} unlang_map_t;
unlang_switch_t *switch_gext;
fr_cond_t cond;
- vp_map_t map;
+ map_t map;
tmpl_t vpt;
switch_g = unlang_generic_to_group(instruction);
UNUSED void const *mod_inst, UNUSED void const *xlat_inst,
request_t *request, char const *fmt)
{
- vp_map_t *map = NULL;
+ map_t *map = NULL;
int ret;
tmpl_rules_t attr_rules = {
fr_log(log, L_DBG, file, line, "\t%pP", vp);
}
}
+
+
/*
* LDAP attribute to RADIUS map
*/
- vp_map_t *entry_map; //!< How to convert attributes in entries
+ map_t *entry_map; //!< How to convert attributes in entries
//!< to FreeRADIUS attributes.
/*
redisReply *reply = NULL;
int s_ret;
- vp_map_t *head = NULL, **last = &head;
+ map_t *head = NULL, **last = &head;
#ifdef HAVE_TALLOC_ZERO_POOLED_OBJECT
size_t pool_size = 0;
#endif
* We can get a pretty good idea of the required size of the pool
*/
for (i = 0; i < reply->elements; i += 3) {
- pool_size += sizeof(vp_map_t) + (sizeof(tmpl_t) * 2);
+ pool_size += sizeof(map_t) + (sizeof(tmpl_t) * 2);
if (reply->element[i]->type == REDIS_REPLY_STRING) pool_size += reply->element[i]->len + 1;
}
* Pull out the cache created date
*/
if (tmpl_da(head->lhs) == attr_cache_created) {
- vp_map_t *map;
+ map_t *map;
c->created = tmpl_value(head->rhs)->vb_date;
* Pull out the cache expires date
*/
if (tmpl_da(head->lhs) == attr_cache_expires) {
- vp_map_t *map;
+ map_t *map;
c->expires = tmpl_value(head->rhs)->vb_date;
rlm_cache_redis_t *driver = instance;
TALLOC_CTX *pool;
- vp_map_t *map;
+ map_t *map;
fr_redis_conn_t *conn;
fr_redis_cluster_state_t state;
int cnt;
tmpl_t expires_value;
- vp_map_t expires = {
+ map_t expires = {
.op = T_OP_SET,
.lhs = driver->expires_attr,
.rhs = &expires_value,
};
tmpl_t created_value;
- vp_map_t created = {
+ map_t created = {
.op = T_OP_SET,
.lhs = driver->created_attr,
.rhs = &created_value,
static rlm_rcode_t cache_merge(rlm_cache_t const *inst, request_t *request, rlm_cache_entry_t *c)
{
fr_pair_t *vp;
- vp_map_t *map;
+ map_t *map;
int merged = 0;
RDEBUG2("Merging cache entry into request");
static rlm_rcode_t cache_insert(rlm_cache_t const *inst, request_t *request, rlm_cache_handle_t **handle,
uint8_t const *key, size_t key_len, int ttl)
{
- vp_map_t const *map;
- vp_map_t **last, *c_map;
+ map_t const *map;
+ map_t **last, *c_map;
fr_pair_t *vp;
bool merge = false;
if (RDEBUG_ENABLED2) map_debug_log(request, map, vp);
REXDENT();
- MEM(c_map = talloc_zero(c, vp_map_t));
+ MEM(c_map = talloc_zero(c, map_t));
c_map->op = map->op;
/*
/** Verify that a map in the cache section makes sense
*
*/
-static int cache_verify(vp_map_t *map, void *ctx)
+static int cache_verify(map_t *map, void *ctx)
{
if (unlang_fixup_update(map, ctx) < 0) return -1;
ssize_t key_len;
tmpl_t *target = NULL;
- vp_map_t *map = NULL;
+ map_t *map = NULL;
key_len = tmpl_expand((char const **)&key, (char *)buffer, sizeof(buffer),
request, inst->config.key, NULL, NULL);
module_instance_t *driver_inst; //!< Driver's instance data.
rlm_cache_driver_t const *driver; //!< Driver's exported interface.
- vp_map_t *maps; //!< Attribute map applied to users.
+ map_t *maps; //!< Attribute map applied to users.
//!< and profiles.
CONF_SECTION *cs;
} rlm_cache_t;
fr_unix_time_t created; //!< When the entry was created.
fr_unix_time_t expires; //!< When the entry expires.
- vp_map_t *maps; //!< Head of the maps list.
+ map_t *maps; //!< Head of the maps list.
} rlm_cache_entry_t;
/** Allocate a new cache entry
{
TALLOC_CTX *value_pool = NULL;
char attr[256]; /* Attr name buffer */
- vp_map_t *map;
+ map_t *map;
char *to_store = NULL;
*/
int cache_deserialize(rlm_cache_entry_t *c, fr_dict_t const *dict, char *in, ssize_t inlen)
{
- vp_map_t **last = &c->maps;
+ map_t **last = &c->maps;
char *p, *q;
if (inlen < 0) inlen = strlen(in);
p = in;
while (((size_t)(p - in)) < (size_t)inlen) {
- vp_map_t *map = NULL;
+ map_t *map = NULL;
tmpl_rules_t parse_rules = {
.dict_def = dict,
.prefix = TMPL_ATTR_REF_PREFIX_NO
} client_get_vp_ctx_t;
static int _map_proc_client_get_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request,
- vp_map_t const *map, void *uctx)
+ map_t const *map, void *uctx)
{
client_get_vp_ctx_t *client = uctx;
fr_pair_t *head = NULL, *vp;
* - #RLM_MODULE_FAIL if an error occurred.
*/
static rlm_rcode_t map_proc_client(UNUSED void *mod_inst, UNUSED void *proc_inst, request_t *request,
- fr_value_box_t **client_override, vp_map_t const *maps)
+ fr_value_box_t **client_override, map_t const *maps)
{
rlm_rcode_t rcode = RLM_MODULE_OK;
- vp_map_t const *map;
+ map_t const *map;
RADCLIENT *client;
client_get_vp_ctx_t uctx;
*/
{
fr_value_box_t tmp = { .type = FR_TYPE_INVALID };
- vp_map_t *map;
+ map_t *map;
if (fr_json_object_to_value_box(ctx, &tmp, value_obj, da, true) < 0) {
bad_value:
{
TALLOC_CTX *pool = talloc_pool(request, 1024); /* We need to do lots of allocs */
fr_cursor_t maps, vlms;
- vp_map_t *map_head = NULL, *map;
+ map_t *map_head = NULL, *map;
vp_list_mod_t *vlm_head = NULL, *vlm;
fr_cursor_init(&maps, &map_head);
#include <freeradius-devel/server/map_proc.h>
static rlm_rcode_t mod_map_proc(void *mod_inst, UNUSED void *proc_inst, request_t *request,
- fr_value_box_t **key, vp_map_t const *maps);
+ fr_value_box_t **key, map_t const *maps);
/*
* Define a structure for our module configuration.
tmpl_t *key;
fr_type_t key_data_type;
- vp_map_t *map; //!< if there is an "update" section in the configuration.
+ map_t *map; //!< if there is an "update" section in the configuration.
} rlm_csv_t;
typedef struct rlm_csv_entry_s rlm_csv_entry_t;
/*
* Verify one map entry.
*/
-static int csv_map_verify(vp_map_t *map, void *instance)
+static int csv_map_verify(map_t *map, void *instance)
{
rlm_csv_t *inst = instance;
int offset;
* Verify the result of the map.
*/
static int csv_maps_verify(CONF_SECTION *cs, void *mod_inst, UNUSED void *proc_inst,
- tmpl_t const *src, vp_map_t const *maps)
+ tmpl_t const *src, map_t const *maps)
{
- vp_map_t const *map;
+ map_t const *map;
if (!src) {
cf_log_err(cs, "Missing key expansion");
for (map = maps;
map != NULL;
map = map->next) {
- vp_map_t *unconst_map;
+ map_t *unconst_map;
memcpy(&unconst_map, &map, sizeof(map));
/*
* Convert field X to a VP.
*/
-static int csv_map_getvalue(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, vp_map_t const *map, void *uctx)
+static int csv_map_getvalue(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, map_t const *map, void *uctx)
{
char const *str = uctx;
fr_pair_t *head = NULL, *vp;
* - #RLM_MODULE_FAIL if an error occurred.
*/
static rlm_rcode_t mod_map_apply(rlm_csv_t const *inst, request_t *request,
- fr_value_box_t const *key, vp_map_t const *maps)
+ fr_value_box_t const *key, map_t const *maps)
{
rlm_rcode_t rcode = RLM_MODULE_UPDATED;
rlm_csv_entry_t *e;
- vp_map_t const *map;
+ map_t const *map;
e = find_entry(inst, key);
if (!e) {
* - #RLM_MODULE_FAIL if an error occurred.
*/
static rlm_rcode_t mod_map_proc(void *mod_inst, UNUSED void *proc_inst, request_t *request,
- fr_value_box_t **key, vp_map_t const *maps)
+ fr_value_box_t **key, map_t const *maps)
{
rlm_csv_t *inst = talloc_get_type_abort(mod_inst, rlm_csv_t);
* - -1 on failure.
*/
static int mod_map_proc_instantiate(CONF_SECTION *cs, UNUSED void *mod_inst, void *proc_inst,
- tmpl_t const *src, vp_map_t const *maps)
+ tmpl_t const *src, map_t const *maps)
{
rlm_json_jpath_cache_t *cache_inst = proc_inst;
- vp_map_t const *map;
+ map_t const *map;
ssize_t slen;
rlm_json_jpath_cache_t *cache = cache_inst, **tail = &cache->next;
* - -1 on failure.
*/
static int _json_map_proc_get_value(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request,
- vp_map_t const *map, void *uctx)
+ map_t const *map, void *uctx)
{
fr_pair_t *vp;
fr_cursor_t cursor;
* - #RLM_MODULE_FAIL if a fault occurred.
*/
static rlm_rcode_t mod_map_proc(UNUSED void *mod_inst, void *proc_inst, request_t *request,
- fr_value_box_t **json, vp_map_t const *maps)
+ fr_value_box_t **json, map_t const *maps)
{
rlm_rcode_t rcode = RLM_MODULE_UPDATED;
struct json_tokener *tok;
rlm_json_jpath_cache_t *cache = proc_inst;
- vp_map_t const *map;
+ map_t const *map;
rlm_json_jpath_to_eval_t to_eval;
* Verify the result of the map.
*/
static int ldap_map_verify(CONF_SECTION *cs, UNUSED void *mod_inst, UNUSED void *proc_inst,
- tmpl_t const *src, UNUSED vp_map_t const *maps)
+ tmpl_t const *src, UNUSED map_t const *maps)
{
if (!src) {
cf_log_err(cs, "Missing LDAP URI");
* - #RLM_MODULE_FAIL if an error occurred.
*/
static rlm_rcode_t mod_map_proc(void *mod_inst, UNUSED void *proc_inst, request_t *request,
- fr_value_box_t **url, vp_map_t const *maps)
+ fr_value_box_t **url, map_t const *maps)
{
rlm_rcode_t rcode = RLM_MODULE_UPDATED;
rlm_ldap_t *inst = talloc_get_type_abort(mod_inst, rlm_ldap_t);
LDAPMessage *result = NULL;
LDAPMessage *entry = NULL;
- vp_map_t const *map;
+ map_t const *map;
char const *url_str;
fr_ldap_connection_t *conn;
/*
* RADIUS attribute to LDAP attribute maps
*/
- vp_map_t *user_map; //!< Attribute map applied to users and profiles.
+ map_t *user_map; //!< Attribute map applied to users and profiles.
/*
* Options
int rcode;
CONF_SECTION *cs;
char const *name2;
- vp_map_t *head = NULL;
+ map_t *head = NULL;
fr_assert(cf_item_is_section(ci));
uint32_t proxy_state; //!< Unique ID (mostly) of this module.
uint32_t *types; //!< array of allowed packet types
uint32_t status_check; //!< code of status-check type
- vp_map_t *status_check_map; //!< attributes for the status-server checks
+ map_t *status_check_map; //!< attributes for the status-server checks
uint32_t num_answers_to_alive; //!< How many status check responses we need to
///< mark the connection as alive.
udp_request_t *u;
request_t *request;
rlm_radius_udp_t const *inst = h->inst;
- vp_map_t *map;
+ map_t *map;
fr_assert(!h->status_u && !h->status_r && !h->status_request);
*/
if (reply->elements > 1) {
tmpl_t ip_rhs;
- vp_map_t ip_map = {
+ map_t ip_map = {
.lhs = inst->allocated_address_attr,
.op = T_OP_SET,
.rhs = &ip_rhs
case REDIS_REPLY_STRING:
{
tmpl_t range_rhs;
- vp_map_t range_map = {
+ map_t range_map = {
.lhs = inst->range_attr,
.op = T_OP_SET,
.rhs = &range_rhs
*/
if (inst->expiry_attr && (reply->elements > 3)) {
tmpl_t expiry_rhs;
- vp_map_t expiry_map = {
+ map_t expiry_map = {
.lhs = inst->expiry_attr,
.op = T_OP_SET,
.rhs = &expiry_rhs
ippool_rcode_t ret = IPPOOL_RCODE_SUCCESS;
tmpl_t range_rhs;
- vp_map_t range_map = { .lhs = inst->range_attr, .op = T_OP_SET, .rhs = &range_rhs };
+ map_t range_map = { .lhs = inst->range_attr, .op = T_OP_SET, .rhs = &range_rhs };
tmpl_init_shallow(&range_rhs, TMPL_TYPE_DATA, T_DOUBLE_QUOTED_STRING, "", 0);
*/
if (inst->expiry_attr) {
tmpl_t expiry_rhs;
- vp_map_t expiry_map = {
+ map_t expiry_map = {
.lhs = inst->expiry_attr,
.op = T_OP_SET,
.rhs = &expiry_rhs
.type = TMPL_TYPE_DATA,
.quote = T_BARE_WORD,
};
- vp_map_t ip_map = {
+ map_t ip_map = {
.lhs = inst->allocated_address_attr,
.op = T_OP_SET,
.rhs = &ip_rhs
fr_curl_tls_t tls; //!< Used for handled all tls specific curl components
char const *name; //!< Auth-Type value for this module instance.
fr_dict_enum_t *auth_type;
- vp_map_t *header_maps; //!< Attribute map used to process header elements
+ map_t *header_maps; //!< Attribute map used to process header elements
CONF_SECTION *cs;
bool set_date;
} rlm_smtp_t;
request_t *request = uctx->request;
fr_sbuff_t conf_buffer;
fr_sbuff_uctx_talloc_t conf_ctx;
- vp_map_t *conf_map;
+ map_t *conf_map;
char *expanded_rhs;
/** Verify that a map in the header section makes sense
*
*/
-static int smtp_verify(vp_map_t *map, void *ctx)
+static int smtp_verify(map_t *map, void *ctx)
{
if (unlang_fixup_update(map, ctx) < 0) return -1;
* - -1 on failure.
*/
static int _sql_map_proc_get_value(TALLOC_CTX *ctx, fr_pair_t **out,
- request_t *request, vp_map_t const *map, void *uctx)
+ request_t *request, map_t const *map, void *uctx)
{
fr_pair_t *vp;
char const *value = uctx;
* Verify the result of the map.
*/
static int sql_map_verify(CONF_SECTION *cs, UNUSED void *mod_inst, UNUSED void *proc_inst,
- tmpl_t const *src, UNUSED vp_map_t const *maps)
+ tmpl_t const *src, UNUSED map_t const *maps)
{
if (!src) {
cf_log_err(cs, "Missing SQL query");
* - #RLM_MODULE_FAIL if a fault occurred.
*/
static rlm_rcode_t mod_map_proc(void *mod_inst, UNUSED void *proc_inst, request_t *request,
- fr_value_box_t **query, vp_map_t const *maps)
+ fr_value_box_t **query, map_t const *maps)
{
rlm_sql_t *inst = talloc_get_type_abort(mod_inst, rlm_sql_t);
rlm_sql_handle_t *handle = NULL;
rlm_rcode_t rcode = RLM_MODULE_UPDATED;
sql_rcode_t ret;
- vp_map_t const *map;
+ map_t const *map;
rlm_sql_row_t row;