]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
use new dlist macros for fr_map_list_t
authorAlan T. DeKok <aland@freeradius.org>
Fri, 10 Dec 2021 16:51:53 +0000 (11:51 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 10 Dec 2021 17:00:53 +0000 (12:00 -0500)
16 files changed:
src/lib/ldap/map.c
src/lib/redis/redis.c
src/lib/server/map.c
src/lib/server/map.h
src/lib/server/map_async.c
src/lib/server/users_file.c
src/lib/unlang/compile.c
src/lib/unlang/edit.c
src/lib/unlang/map.c
src/lib/util/misc.c
src/modules/rlm_attr_filter/rlm_attr_filter.c
src/modules/rlm_cache/drivers/rlm_cache_redis/rlm_cache_redis.c
src/modules/rlm_client/rlm_client.c
src/modules/rlm_csv/rlm_csv.c
src/modules/rlm_files/rlm_files.c
src/modules/rlm_smtp/rlm_smtp.c

index 510a6527ca06b65e09a0265e4885984bc049e1a7..6d76651d04336614a599cbb8f97f97fd54bcb20e 100644 (file)
@@ -262,7 +262,7 @@ int fr_ldap_map_expand(fr_ldap_map_exp_t *expanded, request_t *request, fr_map_l
        char const      *attr;
        char            attr_buff[1024 + 1];    /* X.501 says we need to support at least 1024 chars for attr names */
 
-       while ((map = fr_dlist_next(maps, map))) {
+       while ((map = fr_map_list_next(maps, map))) {
                if (tmpl_expand(&attr, attr_buff, sizeof(attr_buff), request, map->rhs, NULL, NULL) < 0) {
                        REDEBUG("Expansion of LDAP attribute \"%s\" failed", map->rhs->name);
                        TALLOC_FREE(ctx);
@@ -314,7 +314,7 @@ int fr_ldap_map_do(request_t *request, LDAP *handle,
        fr_ldap_result_t        result;
        char const              *name;
 
-       while ((map = fr_dlist_next(expanded->maps, map))) {
+       while ((map = fr_map_list_next(expanded->maps, map))) {
                int ret;
 
                name = expanded->attrs[total++];
index 76881a8224396b29f3e22d15a3e8cb517e3d7d10..d883648fb5bfdb969b7b1473fd882179eecb8c50 100644 (file)
@@ -425,7 +425,7 @@ int fr_redis_reply_to_map(TALLOC_CTX *ctx, fr_map_list_t *out, request_t *reques
        }
        MAP_VERIFY(map);
 
-       fr_dlist_insert_tail(out, map);
+       fr_map_list_insert_tail(out, map);
 
        return 0;
 }
index 865b999460c08f7d7aa8b158e695e6cec1882a48..5867864994346d3e031b39263901275ad8486e42 100644 (file)
@@ -624,7 +624,7 @@ check_for_child:
         *      caller will have to check for this!
         */
        if (is_child && parent) {
-               fr_dlist_insert_tail(&parent->child, map);
+               fr_map_list_insert_tail(&parent->child, map);
        }
 
        if (parent_p) *parent_p = new_parent;
@@ -718,7 +718,7 @@ static int _map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, map_t *parent, CON
                         *      Free in reverse as successive entries have their
                         *      prececessors as talloc parent contexts
                         */
-                       fr_dlist_talloc_reverse_free(out);
+                       fr_map_list_talloc_reverse_free(out);
                        return -1;
                }
 
@@ -806,11 +806,11 @@ static int _map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, map_t *parent, CON
                         */
                        if (_map_afrom_cs(map, &child_list, map, cf_item_to_section(ci),
                                         &our_lhs_rules, rhs_rules, validate, uctx, max) < 0) {
-                               fr_dlist_talloc_free(&child_list);
+                               fr_map_list_talloc_free(&child_list);
                                talloc_free(map);
                                goto error;
                        }
-                       fr_dlist_move(&map->child, &child_list);
+                       fr_map_list_move(&map->child, &child_list);
 
                        our_lhs_rules.disallow_qualifiers = qualifiers;
                        MAP_VERIFY(map);
@@ -840,7 +840,7 @@ static int _map_afrom_cs(TALLOC_CTX *ctx, fr_map_list_t *out, map_t *parent, CON
 
        next:
                parent_ctx = map;
-               fr_dlist_insert_tail(out, map);
+               fr_map_list_insert_tail(out, map);
        }
 
        return 0;
@@ -998,17 +998,6 @@ int map_afrom_vp(TALLOC_CTX *ctx, map_t **out, fr_pair_t *vp, tmpl_rules_t const
        return 0;
 }
 
-/** Sort a doubly linked list of #map_t using merge sort
- *
- * @param[in,out] list of #map_t to sort.
- * @param[in] cmp to sort with
- */
-void map_sort(fr_map_list_t *list, fr_cmp_t cmp)
-{
-       fr_dlist_sort(list, cmp);
-
-}
-
 /** Process map which has exec as a src
  *
  * Evaluate maps which specify exec as a src. This may be used by various sorts of update sections, and so
@@ -1161,9 +1150,9 @@ int map_to_vp(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, map_t co
                MEM(n = fr_pair_afrom_da(ctx, tmpl_da(map->lhs)));
                n->op = map->op;
 
-               for (child = fr_dlist_next(&map->child, NULL);
+               for (child = fr_map_list_next(&map->child, NULL);
                     child != NULL;
-                    child = fr_dlist_next(&map->child, child)) {
+                    child = fr_map_list_next(&map->child, child)) {
                        fr_pair_list_t list;
 
                        /*
@@ -1958,7 +1947,7 @@ ssize_t map_print(fr_sbuff_t *out, map_t const *map)
         *      If there's no child and no RHS then the
         *      map was invalid.
         */
-       if (fr_dlist_empty(&map->child) && !fr_cond_assert(map->rhs != NULL)) {
+       if (fr_map_list_empty(&map->child) && !fr_cond_assert(map->rhs != NULL)) {
                fr_sbuff_terminate(out);
                return 0;
        }
index 66a42a7cf9019bd42ff1c56214e71626426360e4..0a2b70beb24bb0fcbc0e516df2288e69d2042078 100644 (file)
@@ -60,7 +60,9 @@ extern "C" {
  *
  * Specifically define a type for lists of map_t to aid type checking
  */
-typedef fr_dlist_head_t fr_map_list_t;
+typedef struct {
+       fr_dlist_head_t head;
+} fr_map_list_t;
 
 /** Value pair map
  *
@@ -88,6 +90,8 @@ struct vp_map_s {
        fr_dlist_t      entry;          //!< List entry.
 };
 
+FR_DLIST_NEW_TYPE(map_list, fr_map_list_t, head, map_t, entry)
+
 /** A list modification
  *
  */
@@ -135,8 +139,6 @@ ssize_t             map_afrom_substr(TALLOC_CTX *ctx, map_t **out, map_t **parent_p, fr_sbu
                                tmpl_rules_t const *lhs_rules, tmpl_rules_t const *rhs_rules,
                                fr_sbuff_parse_rules_t const *p_rules);
 
-void           map_sort(fr_map_list_t *list, fr_cmp_t cmp);
-
 int            map_to_vp(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request,
                          map_t const *map, void *uctx) CC_HINT(nonnull (2,3,4));
 
@@ -160,10 +162,6 @@ extern size_t map_assignment_op_table_len;
 extern fr_sbuff_parse_rules_t const map_parse_rules_bareword_quoted;
 extern fr_sbuff_parse_rules_t const *map_parse_rules_quoted[T_TOKEN_LAST];
 
-#define fr_map_list_init(_list) fr_dlist_talloc_init(_list, map_t, entry)
-#define fr_map_list_head(_list) ((map_t *)fr_dlist_head(_list))
-#define fr_map_list_tail(_list) ((map_t *)fr_dlist_tail(_list))
-
 #ifdef __cplusplus
 }
 #endif
index 4eed8a3c7f37747429fb83998dda3a1a408bcb1b..5b9f5320bb1daea8884108eb72bbdfde31e22a87 100644 (file)
@@ -92,7 +92,7 @@ static inline vp_list_mod_t *list_mod_generic_afrom_map(TALLOC_CTX *ctx,
                talloc_free(n);
                return NULL;
        }
-       fr_dlist_insert_tail(&n->mod, mod);
+       fr_map_list_insert_tail(&n->mod, mod);
 
        return n;
 }
@@ -134,7 +134,7 @@ static inline vp_list_mod_t *list_mod_delete_afrom_map(TALLOC_CTX *ctx,
                talloc_free(n);
                return NULL;
        }
-       fr_dlist_insert_tail(&n->mod, mod);
+       fr_map_list_insert_tail(&n->mod, mod);
 
        return n;
 }
@@ -194,7 +194,7 @@ static inline vp_list_mod_t *list_mod_empty_string_afrom_map(TALLOC_CTX *ctx,
                talloc_free(n);
                return NULL;
        }
-       fr_dlist_insert_tail(&n->mod, mod);
+       fr_map_list_insert_tail(&n->mod, mod);
 
        return n;
 }
@@ -361,7 +361,7 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out,
                mod->lhs = mutated->lhs;
                mod->op = mutated->op;
                mod->rhs = mutated->rhs;
-               fr_dlist_insert_tail(&n->mod, mod);
+               fr_map_list_insert_tail(&n->mod, mod);
                goto finish;
        }
 
@@ -432,7 +432,7 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out,
                         *      before this map is applied.
                         */
                        if (fr_value_box_copy(n_mod->rhs, tmpl_value(n_mod->rhs), &vp->data) < 0) goto error;
-                       fr_dlist_insert_tail(&n->mod, n_mod);
+                       fr_map_list_insert_tail(&n->mod, n_mod);
 
                        MAP_VERIFY(n_mod);
                } while ((vp = fr_pair_list_next(list, vp)));
@@ -455,7 +455,7 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out,
 
                fr_dcursor_init(&values, &head);
 
-               if (fr_value_box_from_str(fr_dlist_head(&n->mod),
+               if (fr_value_box_from_str(fr_map_list_head(&n->mod),
                                          tmpl_value(fr_map_list_head(&n->mod)->rhs), type,
                                          tmpl_da(mutated->lhs),
                                          mutated->rhs->name, mutated->rhs->len,
@@ -756,7 +756,7 @@ int map_to_list_mod(TALLOC_CTX *ctx, vp_list_mod_t **out,
                        }
 
                        mod->op = vp->op;
-                       fr_dlist_insert_tail(&n->mod, mod);
+                       fr_map_list_insert_tail(&n->mod, mod);
                }
 
        }
@@ -826,13 +826,13 @@ static void map_list_mod_to_vps(TALLOC_CTX *ctx, fr_pair_list_t *list, vp_list_m
 {
        map_t   *mod;
 
-       fr_assert(!fr_dlist_empty(&vlm->mod));
+       fr_assert(!fr_map_list_empty(&vlm->mod));
 
        /*
         *      Fast path...
         */
-       mod = fr_dlist_head(&vlm->mod);
-       if (vlm->mod.num_elements == 1) {
+       mod = fr_map_list_head(&vlm->mod);
+       if (fr_map_list_num_elements(&vlm->mod) == 1) {
                fr_pair_t *vp;
                vp = map_list_mod_to_vp(ctx, mod->lhs, tmpl_value(mod->rhs));
                fr_pair_append(list, vp);
@@ -844,7 +844,7 @@ static void map_list_mod_to_vps(TALLOC_CTX *ctx, fr_pair_list_t *list, vp_list_m
         */
        for (;
             mod;
-            mod = fr_dlist_next(&vlm->mod, mod)) {
+            mod = fr_map_list_next(&vlm->mod, mod)) {
                fr_pair_t       *vp;
 
                vp = map_list_mod_to_vp(ctx, mod->lhs, tmpl_value(mod->rhs));
@@ -956,12 +956,12 @@ int map_list_mod_apply(request_t *request, vp_list_mod_t const *vlm)
        memset(&cc, 0, sizeof(cc));
 
        MAP_VERIFY(map);
-       fr_assert(!fr_dlist_empty(&vlm->mod));
+       fr_assert(!fr_map_list_empty(&vlm->mod));
 
        /*
         *      Print debug information for the mods being applied
         */
-       while ((mod = fr_dlist_next(&vlm->mod, mod))) {
+       while ((mod = fr_map_list_next(&vlm->mod, mod))) {
                fr_value_box_t *vb;
 
                MAP_VERIFY(mod);
@@ -982,7 +982,7 @@ int map_list_mod_apply(request_t *request, vp_list_mod_t const *vlm)
                        map_list_mod_debug(request, map, mod, vb->type != FR_TYPE_NULL ? vb : NULL);
                }
        }
-       mod = fr_dlist_head(&vlm->mod); /* Reset */
+       mod = fr_map_list_head(&vlm->mod);      /* Reset */
 
        /*
         *      All this has been checked by #map_to_list_mod
@@ -1082,7 +1082,7 @@ int map_list_mod_apply(request_t *request, vp_list_mod_t const *vlm)
                }
        }
 
-       fr_assert(!fr_dlist_next(&vlm->mod, mod));
+       fr_assert(!fr_map_list_next(&vlm->mod, mod));
 
        /*
         *      Find the destination attribute.  We leave with either
index dd79a951db75d52dfb51404a80de2c511d6a6419..d2df206d9d0c9ce188b5174f6ae7c3f5fe05900a 100644 (file)
@@ -470,7 +470,7 @@ check_item:
 
        do_insert:
                fr_assert(!new_map->parent);
-               fr_dlist_insert_tail(&t->check, new_map);
+               fr_map_list_insert_tail(&t->check, new_map);
 
                /*
                 *      There can be spaces before any comma.
@@ -646,7 +646,7 @@ next_reply_item:
 
                fr_assert(tmpl_list(new_map->lhs) == PAIR_LIST_REPLY);
 
-               if (!new_map->parent) fr_dlist_insert_tail(&t->reply, new_map);
+               if (!new_map->parent) fr_map_list_insert_tail(&t->reply, new_map);
 
                (void) fr_sbuff_adv_past_blank(&sbuff, SIZE_MAX, NULL);
 
index 71f65dee6a892562d5e80d7ae1235d2b07828ae3..17741a119a609e4be52213254845ad5e869dcce6 100644 (file)
@@ -591,7 +591,7 @@ static bool pass2_fixup_map(map_t *map, tmpl_rules_t const *rules, fr_dict_attr_
        /*
         *      Sanity check sublists.
         */
-       if (!fr_dlist_empty(&map->child)) {
+       if (!fr_map_list_empty(&map->child)) {
                fr_dict_attr_t const *da;
 
                if (!tmpl_is_attr(map->lhs)) {
@@ -611,7 +611,7 @@ static bool pass2_fixup_map(map_t *map, tmpl_rules_t const *rules, fr_dict_attr_
                        return false;
                }
 
-               return pass2_fixup_map(fr_dlist_head(&map->child), rules, da);
+               return pass2_fixup_map(fr_map_list_head(&map->child), rules, da);
        }
 
        return true;
@@ -627,7 +627,7 @@ static bool pass2_fixup_update(unlang_group_t *g, tmpl_rules_t const *rules)
 
        RULES_VERIFY(rules);
 
-       while ((map = fr_dlist_next(&gext->map, map))) {
+       while ((map = fr_map_list_next(&gext->map, map))) {
                /*
                 *      Mostly fixup the map, but maybe leave the RHS
                 *      unresolved.
@@ -660,7 +660,7 @@ static bool pass2_fixup_map_rhs(unlang_group_t *g, tmpl_rules_t const *rules)
         *      the RHS as a reference to a json string, SQL column
         *      name, etc.
         */
-       while ((map = fr_dlist_next(&gext->map, map))) {
+       while ((map = fr_map_list_next(&gext->map, map))) {
                if (!pass2_fixup_map(map, rules, NULL)) return false;
        }
 
@@ -709,7 +709,7 @@ static void unlang_dump(unlang_t *instruction, int depth)
                        g = unlang_generic_to_group(c);
                        gext = unlang_group_to_map(g);
                        map = NULL;
-                       while ((map = fr_dlist_next(&gext->map, map))) {
+                       while ((map = fr_map_list_next(&gext->map, map))) {
                                map_print(&FR_SBUFF_OUT(buffer, sizeof(buffer)), map);
                                DEBUG("%.*s%s", depth + 1, unlang_spaces, buffer);
                        }
@@ -724,7 +724,7 @@ static void unlang_dump(unlang_t *instruction, int depth)
 
                        edit = unlang_generic_to_edit(c);
                        map = NULL;
-                       while ((map = fr_dlist_next(&edit->maps, map))) {
+                       while ((map = fr_map_list_next(&edit->maps, map))) {
                                map_print(&FR_SBUFF_OUT(buffer, sizeof(buffer)), map);
                                DEBUG("%.*s%s", depth + 1, unlang_spaces, buffer);
                        }
@@ -1369,7 +1369,7 @@ static unlang_t *compile_map(unlang_t *parent, unlang_compile_t *unlang_ctx, CON
        fr_map_list_init(&gext->map);
        rcode = map_afrom_cs(gext, &gext->map, cs, &t_rules, &t_rules, unlang_fixup_map, NULL, 256);
        if (rcode < 0) return NULL; /* message already printed */
-       if (fr_dlist_empty(&gext->map)) {
+       if (fr_map_list_empty(&gext->map)) {
                cf_log_err(cs, "'map' sections cannot be empty");
                goto error;
        }
@@ -1441,7 +1441,7 @@ static unlang_t *compile_update(unlang_t *parent, unlang_compile_t *unlang_ctx,
        fr_map_list_init(&gext->map);
        rcode = map_afrom_cs(gext, &gext->map, cs, &t_rules, &t_rules, unlang_fixup_update, NULL, 128);
        if (rcode < 0) return NULL; /* message already printed */
-       if (fr_dlist_empty(&gext->map)) {
+       if (fr_map_list_empty(&gext->map)) {
                cf_log_err(cs, "'update' sections cannot be empty");
        error:
                talloc_free(g);
@@ -1500,7 +1500,7 @@ static unlang_t *compile_filter(unlang_t *parent, unlang_compile_t *unlang_ctx,
        fr_map_list_init(&gext->map);
        rcode = map_afrom_cs(gext, &gext->map, cs, &t_rules, &t_rules, unlang_fixup_filter, NULL, 128);
        if (rcode < 0) return NULL; /* message already printed */
-       if (fr_dlist_empty(&gext->map)) {
+       if (fr_map_list_empty(&gext->map)) {
                cf_log_err(cs, "'filter' sections cannot be empty");
                return NULL;
        }
@@ -1714,7 +1714,7 @@ static unlang_t *compile_edit_section(unlang_t *parent, unlang_compile_t *unlang
         */
 //     if (unlang_fixup_update(map, NULL) < 0) goto fail;
 
-       fr_dlist_insert_tail(&edit->maps, map);
+       fr_map_list_insert_tail(&edit->maps, map);
 
        *prev = c;
        return out;
@@ -1784,7 +1784,7 @@ static unlang_t *compile_edit_pair(unlang_t *parent, unlang_compile_t *unlang_ct
         */
        if (unlang_fixup_update(map, NULL) < 0) goto fail;
 
-       fr_dlist_insert_tail(&edit->maps, map);
+       fr_map_list_insert_tail(&edit->maps, map);
 
        *prev = c;
        return out;
index b12aea09e3cb90a742e9a134828a8dd04ac30615..3ae27bd08bba5dc1b5c60d33c59a698d1359eb14 100644 (file)
@@ -377,7 +377,7 @@ static unlang_action_t process_edit(rlm_rcode_t *p_result, request_t *request, u
         */
        for (map = state->map;
             map != NULL;
-            map = state->map = fr_dlist_next(state->map_head, map)) {
+            map = state->map = fr_map_list_next(state->map_head, map)) {
                repeatable_set(frame);  /* Call us again when done */
 
                switch (state->state) {
@@ -499,10 +499,10 @@ static unlang_action_t unlang_edit_state_init(rlm_rcode_t *p_result, request_t *
         *      The edit list creates a local pool which should
         *      generally be large enough for most edits.
         */
-       MEM(state->el = fr_edit_list_alloc(state, fr_dlist_num_elements(&edit->maps)));
+       MEM(state->el = fr_edit_list_alloc(state, fr_map_list_num_elements(&edit->maps)));
 
        state->map_head = &edit->maps;
-       state->map = fr_dlist_head(state->map_head);
+       state->map = fr_map_list_head(state->map_head);
 
        /*
         *      Call process_edit to do all of the work.
index 538cbe5fc7ad9d9f31998ce35cac0cd4e4b168ac..851e1ea426711b353918562e1ad7ba32ed0d403c 100644 (file)
@@ -271,7 +271,7 @@ static unlang_action_t unlang_update_state_init(rlm_rcode_t *p_result, request_t
                                                                    (sizeof(tmpl_t) * 2) + 128),
                                                                    g->num_children));  /* 128 is for string buffers */
 
-       fr_dcursor_init(&update_state->maps, &gext->map);
+       fr_dcursor_init(&update_state->maps, fr_map_list_dlist_head(&gext->map));
        fr_value_box_list_init(&update_state->lhs_result);
        fr_value_box_list_init(&update_state->rhs_result);
        fr_dlist_init(&update_state->vlm_head, vp_list_mod_t, entry);
index 5d6821ecfcaa9a1e79b5921ce8bd346ed38cc4e9..3047358b8860780fa5c28392e9da9d3e752e6490 100644 (file)
@@ -653,4 +653,3 @@ int fr_digest_cmp(uint8_t const *a, uint8_t const *b, size_t length)
 
        return result;          /* 0 is OK, !0 is !OK, just like memcmp */
 }
-
index df5727e1f7381946370ec5509bd47ab1dbc1340e..559610ca4e29153671fd850b38ddeb3ae0945b1a 100644 (file)
@@ -118,13 +118,13 @@ static int attr_filter_getfile(TALLOC_CTX *ctx, module_inst_ctx_t const *mctx, c
                /*
                 *      We apply the rules in the reply items.
                 */
-               if (!fr_dlist_empty(&entry->check)) {
+               if (!fr_map_list_empty(&entry->check)) {
                        WARN("%s[%d] Check list is not empty for entry \"%s\".\n",
                             filename, entry->lineno, entry->name);
                }
 
                map = NULL;
-               while ((map = fr_dlist_next(&entry->reply, map))) {
+               while ((map = fr_map_list_next(&entry->reply, map))) {
                        fr_dict_attr_t const *da;
 
                        if (!tmpl_is_attr(map->lhs)) {
@@ -240,7 +240,7 @@ static unlang_action_t CC_HINT(nonnull(1,2)) attr_filter_common(rlm_rcode_t *p_r
 
                fr_pair_list_init(&check_list);
 
-               while ((map = fr_dlist_next(&pl->reply, map))) {
+               while ((map = fr_map_list_next(&pl->reply, map))) {
                        if (map_to_vp(packet, &tmp_list, request, map, NULL) < 0) {
                                RPWARN("Failed parsing map %s for check item, skipping it", map->lhs->name);
                                continue;
index 7acbc979f21ac60f7a6530ba9f9c699773f4e3d0..30f87be8e2d2bbbdecb0ed0619cafa56777f656a 100644 (file)
@@ -220,7 +220,7 @@ static cache_status_t cache_entry_find(rlm_cache_entry_t **out,
 
                c->created = tmpl_value(fr_map_list_head(&head)->rhs)->vb_date;
 
-               map = fr_dlist_pop_head(&head);
+               map = fr_map_list_pop_head(&head);
                talloc_free(map);
        }
 
@@ -232,13 +232,13 @@ static cache_status_t cache_entry_find(rlm_cache_entry_t **out,
 
                c->expires = tmpl_value(fr_map_list_head(&head)->rhs)->vb_date;
 
-               map = fr_dlist_pop_head(&head);
+               map = fr_map_list_pop_head(&head);
                talloc_free(map);
        }
 
        c->key = talloc_memdup(c, key, key_len);
        c->key_len = key_len;
-       fr_dlist_move(&c->maps, &head);
+       fr_map_list_move(&c->maps, &head);
        *out = c;
 
        return CACHE_OK;
@@ -306,7 +306,7 @@ static cache_status_t cache_entry_insert(UNUSED rlm_cache_config_t const *config
        fr_value_box_init(&expires_value.data.literal, FR_TYPE_DATE, NULL, true);
        tmpl_value(&expires_value)->vb_date = c->expires;
 
-       cnt = c->maps.num_elements + 2;
+       cnt = fr_map_list_num_elements(&c->maps) + 2;
 
        /*
         *      The majority of serialized entries should be under 1k.
@@ -342,7 +342,7 @@ static cache_status_t cache_entry_insert(UNUSED rlm_cache_config_t const *config
        }
        argv_p += 3;
        argv_len_p += 3;
-       while ((map = fr_dlist_next(&c->maps, map))) {
+       while ((map = fr_map_list_next(&c->maps, map))) {
                if (fr_redis_tuple_from_map(pool, argv_p, argv_len_p, map) < 0) {
                        REDEBUG("Failed encoding map as Redis K/V pair");
                        talloc_free(pool);
index 67c610b8dcc796f298451e77ec3d576f45cfea87..d295369535d2f02da04f008402dc49699b84e424 100644 (file)
@@ -177,7 +177,7 @@ static rlm_rcode_t map_proc_client(UNUSED void *mod_inst, UNUSED void *proc_inst
        uctx.cs = client->cs;
 
        RINDENT();
-       while ((map = fr_dlist_next(maps, map))) {
+       while ((map = fr_map_list_next(maps, map))) {
                char    *field = NULL;
 
                if (tmpl_aexpand(request, &field, request, map->rhs, NULL, NULL) < 0) {
index 7bb55e1c900878935e80006d0de361a1a65540f7..75385b8d9975067b7f289377a24d91f5357f88ff 100644 (file)
@@ -490,7 +490,7 @@ static int csv_maps_verify(CONF_SECTION *cs, void *mod_inst, UNUSED void *proc_i
                return -1;
        }
 
-       while ((map = fr_dlist_next(maps, map))) {
+       while ((map = fr_map_list_next(maps, map))) {
                /*
                 *      This function doesn't change the map, so it's OK.
                 */
@@ -907,7 +907,7 @@ static rlm_rcode_t mod_map_apply(rlm_csv_t const *inst, request_t *request,
 
 redo:
        RINDENT();
-       while ((map = fr_dlist_next(maps, map))) {
+       while ((map = fr_map_list_next(maps, map))) {
                int field;
                char *field_name;
 
@@ -1003,7 +1003,7 @@ static unlang_action_t CC_HINT(nonnull) mod_process(rlm_rcode_t *p_result, modul
        ssize_t slen;
        fr_value_box_t *key;
 
-       if (fr_dlist_empty(&inst->map) || !inst->key) RETURN_MODULE_NOOP;
+       if (fr_map_list_empty(&inst->map) || !inst->key) RETURN_MODULE_NOOP;
 
        /*
         *      Expand the key to whatever it is.  For attributes,
index 71e8f79ea2516f464872f1b3cb9914c5e08d0141..0ec935b84b9cff28711d501430d1a34b040cb720 100644 (file)
@@ -152,7 +152,7 @@ static int getusersfile(TALLOC_CTX *ctx, char const *filename, fr_htrie_t **ptre
                 *      and probably ':=' for server
                 *      configuration items.
                 */
-               while ((map = fr_dlist_next(&entry->check, map))) {
+               while ((map = fr_map_list_next(&entry->check, map))) {
                        if (!tmpl_is_attr(map->lhs)) {
                                ERROR("%s[%d] Left side of check item %s is not an attribute",
                                      entry->filename, entry->lineno, map->lhs->name);
@@ -193,7 +193,7 @@ static int getusersfile(TALLOC_CTX *ctx, char const *filename, fr_htrie_t **ptre
                 *      worth doing.
                 */
                map = NULL;
-               while ((map = fr_dlist_next(&entry->reply, map))) {
+               while ((map = fr_map_list_next(&entry->reply, map))) {
                        if (!tmpl_is_attr(map->lhs)) {
                                ERROR("%s[%d] Left side of reply item %s is not an attribute",
                                      entry->filename, entry->lineno, map->lhs->name);
@@ -477,7 +477,7 @@ redo:
                /*
                 *      Realize the map to a list of VPs
                 */
-               while ((map = fr_dlist_next(&pl->check, map))) {
+               while ((map = fr_map_list_next(&pl->check, map))) {
                        fr_pair_list_t tmp_list;
 
                        /*
@@ -529,9 +529,9 @@ redo:
                fr_pair_list_free(&list);
 
                /* ctx may be reply */
-               if (!fr_dlist_empty(&pl->reply)) {
+               if (!fr_map_list_empty(&pl->reply)) {
                        map = NULL;
-                       while ((map = fr_dlist_next(&pl->reply, map))) {
+                       while ((map = fr_map_list_next(&pl->reply, map))) {
                                fr_pair_list_t tmp_list;
                                fr_pair_list_init(&tmp_list);
                                if (map->op == T_OP_CMP_FALSE) continue;
index b31900132f97a2e287a725d74439256a8f374311..9c186a90aa9b946db3d9712a663265d70d9fc875 100644 (file)
@@ -514,7 +514,7 @@ static int header_source(rlm_smtp_thread_t *t, fr_mail_ctx_t *uctx, rlm_smtp_t c
 
        /* Initialize the sbuff for writing the config elements as header attributes */
        fr_sbuff_init_talloc(uctx, &conf_buffer, &conf_ctx, 256, SIZE_MAX);
-       conf_map = fr_dlist_head(&inst->header_maps);
+       conf_map = fr_map_list_head(&inst->header_maps);
        /* Load in all of the header elements supplies in the config */
        while (conf_map->rhs && conf_map->lhs) {
                /* Do any string expansion required in the rhs */
@@ -531,10 +531,10 @@ static int header_source(rlm_smtp_thread_t *t, fr_mail_ctx_t *uctx, rlm_smtp_t c
                talloc_free(conf_buffer.buff);
                /* Check if there are more values to parse */
        next:
-               if (!fr_dlist_next(&inst->header_maps, conf_map)) break;
+               if (!fr_map_list_next(&inst->header_maps, conf_map)) break;
                /* reinitialize the buffer and move to the next value */
                fr_sbuff_init_talloc(uctx, &conf_buffer, &conf_ctx, 256, SIZE_MAX);
-               conf_map = fr_dlist_next(&inst->header_maps, conf_map);
+               conf_map = fr_map_list_next(&inst->header_maps, conf_map);
        }
        /* Add the FROM: line */
        generate_from_header(t, uctx, &uctx->header, inst);