}
break;
- case VPT_TYPE_LITERAL:
- /*
- * If LHS is an attribute, and RHS is a literal, we can
- * check that the format is correct.
- */
- if (map->dst->type == VPT_TYPE_ATTR) {
- VALUE_PAIR *vp;
- bool ret;
-
- MEM(vp = pairalloc(NULL, map->dst->da));
- vp->op = map->op;
-
- ret = pairparsevalue(vp, map->src->name);
- talloc_free(vp);
- if (!ret) {
- cf_log_err(ci, "%s", fr_strerror());
- return NULL;
- }
- }
-
default:
break;
}
int rcode;
modgroup *g;
modcallable *csingle;
- value_pair_map_t *map;
+ value_pair_map_t *map, *head = NULL;
/*
* This looks at cs->name2 to determine which list to update
*/
- rcode = radius_attrmap(cs, &map, PAIR_LIST_REQUEST, PAIR_LIST_REQUEST, 128);
+ rcode = radius_attrmap(cs, &head, PAIR_LIST_REQUEST, PAIR_LIST_REQUEST, 128);
if (rcode < 0) return NULL; /* message already printed */
- if (!map) {
+ if (!head) {
cf_log_err_cs(cs, "'update' sections cannot be empty");
return NULL;
}
+ for (map = head; map != NULL; map = map->next) {
+ if ((map->dst->type == VPT_TYPE_ATTR) && (map->src->type == VPT_TYPE_LITERAL)) {
+ /*
+ * If LHS is an attribute, and RHS is a literal, we can
+ * check that the format is correct.
+ */
+ VALUE_PAIR *vp;
+ bool ret;
+
+ MEM(vp = pairalloc(cs, map->dst->da));
+ vp->op = map->op;
+
+ ret = pairparsevalue(vp, map->src->name);
+ talloc_free(vp);
+ if (!ret) {
+ talloc_free(head);
+ cf_log_err(map->ci, "%s", fr_strerror());
+ return NULL;
+ }
+ }
+ }
+
g = rad_malloc(sizeof(*g)); /* never fails */
memset(g, 0, sizeof(*g));
+
csingle = mod_grouptocallable(g);
csingle->parent = parent;
g->grouptype = GROUPTYPE_SIMPLE;
g->children = NULL;
g->cs = cs;
- g->map = map;
+ g->map = head;
return csingle;
}
* cache entries.
*/
case VPT_TYPE_LITERAL:
+ /*
+ * @fixme: This should be moved into a common function
+ * with the check in do_compile_modupdate.
+ */
+ if (map->dst->type == VPT_TYPE_ATTR) {
+ VALUE_PAIR *vp;
+ bool ret;
+
+ MEM(vp = pairalloc(NULL, map->dst->da));
+ vp->op = map->op;
+
+ ret = pairparsevalue(vp, map->src->name);
+ talloc_free(vp);
+ if (!ret) {
+ cf_log_err(map->ci, "%s", fr_strerror());
+ return -1;
+ }
+ }
+
case VPT_TYPE_XLAT:
case VPT_TYPE_ATTR:
switch (map->op) {