]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Allow parsing of prepend operator ^= in config and correct comment
authorNick Porter <nick@portercomputing.co.uk>
Fri, 25 Sep 2020 10:44:19 +0000 (11:44 +0100)
committerAlan DeKok <aland@freeradius.org>
Wed, 14 Oct 2020 14:53:37 +0000 (10:53 -0400)
src/main/conffile.c
src/main/evaluate.c
src/main/modcall.c

index a8c667bfb5df142f6bfde864339510f2ef3920e4..453fc8939b226ee49b11c4bd0fb8f163f7ae3893 100644 (file)
@@ -2794,6 +2794,7 @@ static int cf_section_read(char const *filename, int *lineno, FILE *fp,
 
                case T_OP_EQ:
                case T_OP_SET:
+               case T_OP_PREPEND:
                        while (isspace((int) *ptr)) ptr++;
 
                        /*
index e9b4630608b622f3fc328381a7795d8729513c8c..363e3c4c502cce38a35fdc4278f0e063e793eb7f 100644 (file)
@@ -790,7 +790,7 @@ int radius_evaluate_cond(REQUEST *request, int modreturn, int depth, fr_cond_t c
 
 
 /*
- *     The fr_pair_list_move() function in src/lib/valuepair.c does all sorts of
+ *     The fr_pair_list_move() function in src/lib/pair.c does all sorts of
  *     extra magic that we don't want here.
  *
  *     FIXME: integrate this with the code calling it, so that we
index 789bd667b08f610d0e330143c43dcf5df934224b..839f5b09e73e2ab37cd60fb6bb4a1c2f6e8fe60a 100644 (file)
@@ -1516,7 +1516,6 @@ static const int authtype_actions[GROUPTYPE_COUNT][RLM_MODULE_NUMCODES] =
 int modcall_fixup_update(vp_map_t *map, UNUSED void *ctx)
 {
        CONF_PAIR *cp = cf_item_to_pair(map->ci);
-
        /*
         *      Anal-retentive checks.
         */
@@ -1593,7 +1592,7 @@ int modcall_fixup_update(vp_map_t *map, UNUSED void *ctx)
                }
 
                /*
-                *      Only += and :=, and !* operators are supported
+                *      Only += and :=, and !*, and ^= operators are supported
                 *      for lists.
                 */
                switch (map->op) {
@@ -1627,6 +1626,14 @@ int modcall_fixup_update(vp_map_t *map, UNUSED void *ctx)
                        }
                        break;
 
+               case T_OP_PREPEND:
+                       if ((map->rhs->type != TMPL_TYPE_LIST) &&
+                           (map->rhs->type != TMPL_TYPE_EXEC)) {
+                               cf_log_err(map->ci, "Invalid source for list assignment '%s ^= ...'", map->lhs->name);
+                               return -1;
+                       }
+                       break;
+
                default:
                        cf_log_err(map->ci, "Operator \"%s\" not allowed for list assignment",
                                   fr_int2str(fr_tokens, map->op, "<INVALID>"));