From: Nick Porter Date: Fri, 25 Sep 2020 10:44:19 +0000 (+0100) Subject: Allow parsing of prepend operator ^= in config and correct comment X-Git-Tag: release_3_0_22~370 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bdfd68f1d168c9820d7c1c1dc2ccfa4f23d30bdd;p=thirdparty%2Ffreeradius-server.git Allow parsing of prepend operator ^= in config and correct comment --- diff --git a/src/main/conffile.c b/src/main/conffile.c index a8c667bfb5d..453fc8939b2 100644 --- a/src/main/conffile.c +++ b/src/main/conffile.c @@ -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++; /* diff --git a/src/main/evaluate.c b/src/main/evaluate.c index e9b4630608b..363e3c4c502 100644 --- a/src/main/evaluate.c +++ b/src/main/evaluate.c @@ -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 diff --git a/src/main/modcall.c b/src/main/modcall.c index 789bd667b08..839f5b09e73 100644 --- a/src/main/modcall.c +++ b/src/main/modcall.c @@ -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, ""));