The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
Loading...
Searching...
No Matches
pairmove.c
Go to the documentation of this file.
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
15 */
16
17/**
18 * $Id: 921803ecfbfef7cba54f858f825571066c77c1c2 $
19 *
20 * @file src/lib/server/pairmove.c
21 * @brief Old style mapping code
22 *
23 * @copyright 2007 The FreeRADIUS server project
24 * @copyright 2007 Alan DeKok (aland@deployingradius.com)
25 */
26RCSID("$Id: 921803ecfbfef7cba54f858f825571066c77c1c2 $")
27
28#include <freeradius-devel/server/pairmove.h>
29#include <freeradius-devel/server/tmpl_dcursor.h>
30
31#include <freeradius-devel/util/debug.h>
32#include <freeradius-devel/util/calc.h>
33#include <freeradius-devel/util/pair_legacy.h>
34
36{
38 fr_dict_attr_t const *da;
39 fr_value_box_t *box, *to_free = NULL;
40
41 RDEBUG(" %s %s %s", map->lhs->name, fr_tokens[map->op], map->rhs->name);
42
43 da = tmpl_attr_tail_da(map->lhs);
44 fr_assert(fr_type_is_leaf(da->type));
45
46 if (tmpl_is_data(map->rhs)) {
47 box = tmpl_value(map->rhs);
48
49 } else if (tmpl_is_attr(map->rhs)) {
50 fr_pair_t *rhs;
51
52 if (tmpl_find_vp(&rhs, request, map->rhs) < 0) return -1;
53
54 if (rhs->vp_type != da->type) {
55 fr_strerror_const("Incompatible data types");
56 return -1;
57 }
58
59 box = &rhs->data;
60
61 } else if (tmpl_is_xlat(map->rhs)) {
62 if (tmpl_aexpand(parent, &to_free, request, map->rhs, NULL, NULL) < 0) return -1;
63
64 box = to_free;
65
66 } else {
67 fr_strerror_const("Unknown RHS");
68 return -1;
69 }
70
71 if (fr_pair_append_by_da(parent, &vp, &parent->vp_group, da) < 0) return -1;
72
73 if (fr_value_box_cast(vp, &vp->data, vp->vp_type, vp->da, box) < 0) {
74 TALLOC_FREE(to_free);
75 return -1;
76 }
77
78 TALLOC_FREE(to_free);
79 return 0;
80}
81
82
84{
85 fr_value_box_t *box, *to_free = NULL;
86
87 /*
88 * No RHS map, but we have children. Create them, and add them to the list.
89 */
90 if (!map->rhs) {
91 map_t *child;
92
93 /*
94 * Convert the child maps to VPs. We know that
95 * we just created the pair, so there's no reason
96 * to apply operators to the children.
97 */
98 for (child = map_list_next(&map->child, NULL);
99 child != NULL;
100 child = map_list_next(&map->child, child)) {
101 fr_assert(child->op == T_OP_EQ);
102 if (radius_legacy_map_to_vp(request, vp, child) < 0) return -1;
103 }
104
105 return 0;
106 }
107
108 /*
109 * Copy an existing attribute.
110 */
111 if (tmpl_is_attr(map->rhs)) {
112 fr_pair_t *rhs;
113
114 if (tmpl_find_vp(&rhs, request, map->rhs) < 0) return -1;
115
116 if (rhs->vp_type != vp->vp_type) {
117 fr_strerror_const("Incompatible data types");
118 return -1;
119 }
120
121 if (rhs == vp) {
122 fr_strerror_const("Invalid self-reference");
123 return -1;
124 }
125
126 return fr_pair_list_copy(vp, &vp->vp_group, &rhs->vp_group);
127 }
128
129 /*
130 * RHS is a string or an xlat expansion.
131 */
132 if (tmpl_is_data(map->rhs)) {
133 box = tmpl_value(map->rhs);
134
135 } else if (tmpl_is_xlat(map->rhs)) {
136 if (tmpl_aexpand(request, &to_free, request, map->rhs, NULL, NULL) < 0) return -1;
137
138 box = to_free;
139
140 } else {
141 fr_strerror_const("Unknown RHS");
142 return -1;
143 }
144
145 if (box->type != FR_TYPE_STRING) {
146 fr_strerror_const("Cannot parse child list");
147 TALLOC_FREE(to_free);
148 return -1;
149 }
150
151 /*
152 * If there's no value, just leave the list alone.
153 *
154 * Otherwise parse the children in the context of the parent.
155 */
156 if (box->vb_strvalue[0]) {
157 fr_pair_parse_t root, relative;
158
159 /*
160 * Parse the string as a list of pairs.
161 */
162 root = (fr_pair_parse_t) {
163 .ctx = vp,
164 .da = vp->da,
165 .list = &vp->vp_group,
166 .dict = vp->da->dict,
167 .internal = fr_dict_internal(),
168 .allow_compare = false,
169 .tainted = box->tainted,
170 };
171 relative = (fr_pair_parse_t) { };
172
173 if (fr_pair_list_afrom_substr(&root, &relative, &FR_SBUFF_IN(box->vb_strvalue, box->vb_length)) < 0) {
174 RPEDEBUG("Failed parsing string '%pV' as attribute list", box);
175 TALLOC_FREE(to_free);
176 return -1;
177 }
178 }
179
180 TALLOC_FREE(to_free);
181 return 0;
182}
183
184typedef struct {
186 fr_pair_t *vp; /* the one we created */
188
189/** Build the relevant pairs at each level.
190 *
191 * See edit_list_pair_build() for similar code.
192 */
194{
195 fr_pair_t *vp;
196 legacy_pair_build_t *lp = uctx;
197
199 if (!vp) return NULL;
200
201 if (fr_edit_list_insert_pair_tail(lp->el, &parent->vp_group, vp) < 0) {
203 return NULL;
204 }
205
206 /*
207 * Tell the cursor that we appended a pair. This
208 * function only gets called when we've ran off of the
209 * end of the list, and can't find the thing we're
210 * looking for. So it's safe at set the current one
211 * here.
212 *
213 * @todo - mainly only because we don't allow creating
214 * foo[4] when there's <3 matching entries. i.e. the
215 * "arrays" here are really lists, so we can't create
216 * "holes" in the list.
217 */
218 fr_dcursor_set_current(cursor, vp);
219
220 lp->vp = vp;
221
222 return vp;
223}
224
225
226/** Move a map using the operators from the old pairmove functionality.
227 *
228 */
230{
231 int16_t num;
232 int err, rcode;
233 bool added = false;
234 fr_pair_t *vp = NULL, *next, *parent;
235 fr_dict_attr_t const *da;
236 fr_pair_list_t *list;
237 TALLOC_CTX *ctx;
238 fr_value_box_t *to_free = NULL;
239 fr_value_box_t const *box;
241 fr_dcursor_t cursor;
242
243 /*
244 * Find out where this attribute exists, or should exist.
245 */
246 tmpl_pair_list_and_ctx(ctx, list, request, tmpl_request(map->lhs), tmpl_list(map->lhs));
247 if (!ctx) return -1; /* no request or list head exists */
248
249 da = tmpl_attr_tail_da(map->lhs);
250
251 /*
252 * These operations are the same for both leaf and structural types.
253 */
254 switch (map->op) {
255 case T_OP_EQ:
256 if (tmpl_find_vp(&vp, request, map->lhs) < -1) return -1;
257 if (vp) return 0;
258 goto add;
259
260 case T_OP_SET:
261 /*
262 * Set a value. Note that we might do
263 *
264 * &foo[1] := 1
265 *
266 * In which case we don't want to delete the attribute, we just want to replace its
267 * value.
268 *
269 * @todo - we can't do &foo[*].bar[*].baz = 1, as that's an implicit cursor, and we don't
270 * do that.
271 */
272 num = tmpl_attr_tail_num(map->lhs);
273 if (num == NUM_COUNT) {
274 fr_strerror_const("Invalid count in attribute reference");
275 return -1;
276 }
277
278 vp = tmpl_dcursor_init(&err, ctx, &cc, &cursor, request, map->lhs);
279
280 /*
281 * We're editing a specific number. It must exist, otherwise the edit does nothing.
282 */
283 if ((num >= 0) || (num == NUM_LAST)) {
284 if (!vp) return 0;
285
286 if (fr_type_is_leaf(vp->vp_type)) {
287 if (fr_edit_list_save_pair_value(el, vp) < 0) return -1;
288 } else {
290
291 if (fr_edit_list_free_pair_children(el, vp) < 0) return -1;
292 }
293 break;
294 }
295
296 /*
297 * We don't delete the main lists, we just modify their contents.
298 */
299 if (request_attr_is_list(da)) {
300 fr_assert(vp != NULL);
301
302 if (fr_edit_list_free_pair_children(el, vp) < 0) return -1;
303 break;
304 }
305
306 if (!vp) goto add;
307
308 /*
309 * Delete the first attribute we found.
310 */
312 fr_assert(parent != NULL);
313
314 if (fr_edit_list_pair_delete(el, &parent->vp_group, vp) < 0) return -1;
316
317 /*
318 * Delete all existing attributes. Note that we re-initialize the cursor every time,
319 * because creating "foo := baz" means deleting ALL existing "foo". But we can't use
320 * the tmpl as a cursor, because the tmpl containst NUM_UNSPEC, and the cursor needs
321 * NUM_ALL. So we have to delete all existing attributes, and then add a new one.
322 */
323 while (true) {
324 vp = tmpl_dcursor_init(&err, ctx, &cc, &cursor, request, map->lhs);
325 if (!vp) break;
326
328 fr_assert(parent != NULL);
329
330 if (fr_edit_list_pair_delete(el, &parent->vp_group, vp) < 0) return -1;
332 }
334
335 case T_OP_ADD_EQ:
336 add:
337 {
339 .el = el,
340 .vp = NULL,
341 };
342
344 vp = tmpl_dcursor_build_init(&err, ctx, &cc, &cursor, request, map->lhs, legacy_pair_build, &lp);
346 if (!vp) {
347 RWDEBUG("Failed creating attribute %s", map->lhs->name);
348 return -1;
349 }
350
351 /*
352 * If we're adding and one already exists, create a new one in the same context.
353 */
354 if ((map->op == T_OP_ADD_EQ) && !lp.vp) {
356 fr_assert(parent != NULL);
357
359 if (fr_edit_list_insert_pair_tail(el, &parent->vp_group, vp) < 0) return -1;
360 }
361
362 added = true;
363 }
364 break;
365
366 case T_OP_LE: /* replace if not <= */
367 case T_OP_GE: /* replace if not >= */
368 if (fr_type_is_structural(da->type)) goto invalid_operator;
369
370 if (tmpl_find_vp(&vp, request, map->lhs) < -1) return -1;
371 if (!vp) goto add;
372 break;
373
374 case T_OP_SUB_EQ: /* delete if match, otherwise ignore */
375 if (fr_type_is_structural(da->type)) {
376 invalid_operator:
377 fr_strerror_printf("Invalid operator '%s' for structural type", fr_type_to_str(da->type));
378 return -1;
379 }
380
381 if (tmpl_find_vp(&vp, request, map->lhs) < -1) return -1;
382 if (!vp) return 0;
383 break;
384
385 default:
386 fr_strerror_printf("Invalid operator '%s'", fr_tokens[map->op]);
387 return -1;
388 }
389
390 fr_assert(vp);
391
392 /*
393 * We don't support operations on structural types. Just creation, and assign values.
394 *
395 * The code above has ensured that the structural type has been either saved or cleared via the
396 * edit list, so the next function doesn't need to do that.
397 */
399 fr_assert(added);
401 }
402
403 /*
404 * We have now found the RHS. Expand it.
405 *
406 * Note that
407 *
408 * &foo := %tolower(&foo)
409 *
410 * works, as we save the value above in the T_OP_SET handler. So we don't delete it.
411 */
412 if (tmpl_is_data(map->rhs)) {
413 box = tmpl_value(map->rhs);
414
415 } else if (tmpl_is_attr(map->rhs)) {
416 fr_pair_t *rhs;
417
418 if (tmpl_find_vp(&rhs, request, map->rhs) < 0) return -1;
419
420 if (rhs->vp_type != da->type) {
421 fr_strerror_const("Incompatible data types");
422 return -1;
423 }
424
425 if (rhs == vp) {
426 fr_strerror_const("Invalid self-reference");
427 return -1;
428 }
429
430 box = &rhs->data;
431
432 } else if (tmpl_is_xlat(map->rhs)) {
433 if (tmpl_aexpand(ctx, &to_free, request, map->rhs, NULL, NULL) < 0) return -1;
434
435 box = to_free;
436
437 } else {
438 fr_strerror_const("Unknown RHS");
439 return -1;
440 }
441
442 /*
443 * We added a VP which hadn't previously existed. Therefore just set the value and return.
444 */
445 if (added) {
446 if (fr_value_box_cast(vp, &vp->data, vp->vp_type, vp->da, box) < 0) {
447 fail:
448 TALLOC_FREE(to_free);
449 return -1;
450 }
451
452 if (vp->da->flags.unsafe) fr_value_box_mark_unsafe(&vp->data);
453 TALLOC_FREE(to_free);
454 return 0;
455 }
456
457 while (vp) {
458 /*
459 * The tmpl calls above use map->lhs to get to both the
460 * correct list, and da. So from now on, we don't need
461 * to do any more nested finds.
462 */
463 fr_assert(vp->da == da);
464 next = fr_pair_find_by_da(list, vp, da); /* could be deleted in the loop*/
465
466 switch (map->op) {
467 case T_OP_LE: /* replace if not <= */
468 case T_OP_GE: /* replace if not >= */
469 rcode = fr_value_box_cmp_op(map->op, &vp->data, box);
470 if (rcode < 0) goto fail;
471
472 if (rcode != 0) break;
473
474 if (fr_value_box_cast(vp, &vp->data, vp->vp_type, vp->da, box) < 0) goto fail;
475 break;
476
477 case T_OP_SUB_EQ: /* delete if match */
478 rcode = fr_value_box_cmp_op(T_OP_CMP_EQ, &vp->data, box);
479 if (rcode < 0) goto fail;
480
481 if (rcode == 1) {
482 fr_pair_list_t *parent_list = fr_pair_parent_list(vp);
483
484 if (fr_edit_list_pair_delete(el, parent_list, vp) < 0) goto fail;
485 }
486 break;
487
488 default:
489 fr_assert(0); /* should have been caught above */
490 return -1;
491 }
492
493 vp = next;
494 }
495
496 TALLOC_FREE(to_free);
497 return 0;
498}
499
501{
502 map_t const *map;
503
504 for (map = map_list_head(list);
505 map != NULL;
506 map = map_list_next(list, map)) {
507 RDEBUG2("%s %s %s", map->lhs->name, fr_tokens[map->op],
508 map->rhs ? map->rhs->name : "{ ... }");
509
510 if (radius_legacy_map_apply(request, map, el) < 0) {
511 RPEDEBUG("Failed applying result");
512 return -1;
513 }
514 }
515
516 return 0;
517}
518
520{
521 int rcode;
522 fr_pair_t *vp;
523 fr_value_box_t const *box;
524 fr_value_box_t *to_free = NULL;
525 fr_value_box_t dst, str;
526 fr_dcursor_t cursor;
528
531
532 vp = tmpl_dcursor_init(NULL, request, &cc, &cursor, request, map->lhs);
533
534 if (!vp) {
536 if (map->op == T_OP_CMP_FALSE) return true;
537 return 0;
538 }
539
540 if (map->op == T_OP_CMP_TRUE){
542 return false;
543 }
544
545 if (fr_type_is_structural(vp->vp_type)) {
546 fr_strerror_const("Invalid comparison for structural type");
547 error:
549 return -1;
550 }
551
552 if (tmpl_is_data(map->rhs)) {
553 box = tmpl_value(map->rhs);
554
555 } else if (tmpl_is_attr(map->rhs)) {
556 fr_pair_t *rhs;
557
558 if (tmpl_find_vp(&rhs, request, map->rhs) < 0) goto error;
559
560 box = &rhs->data;
561
562 } else if (tmpl_contains_xlat(map->rhs)) {
563 if (tmpl_aexpand(request, &to_free, request, map->rhs, NULL, NULL) < 0) goto error;
564
565 box = to_free;
566
567 } else if (tmpl_is_regex(map->rhs)) {
568 /*
569 * @todo - why box it and parse it again, when we can just run the regex?
570 */
571 fr_value_box_strdup_shallow(&str, NULL, map->rhs->name, false);
572 box = &str;
573
574 } else {
575 fr_strerror_const("Unknown RHS");
576 goto error;
577 }
578
579 /*
580 * Check all possible vps matching the lhs
581 * Allows for comparisons such as &foo[*] == "bar" - i.e. true if any instance of &foo has the value "bar"
582 */
583 rcode = 0;
584 while (vp) {
585 /*
586 * Let the calculation code do upcasting as necessary.
587 */
588 rcode = fr_value_calc_binary_op(request, &dst, FR_TYPE_BOOL, &vp->data, map->op, box);
589 if ((rcode >= 0) && dst.vb_bool) break; // Found a "true" result, no need to check any further
590 vp = fr_dcursor_next(&cursor);
591 }
592 TALLOC_FREE(to_free);
594
595 if (rcode < 0) return rcode;
596
597 return dst.vb_bool;
598}
static uint8_t request[4]
#define RCSID(id)
Definition build.h:603
#define FALL_THROUGH
clang 10 doesn't recognised the FALL-THROUGH comment anymore
Definition build.h:422
int fr_value_calc_binary_op(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_type_t hint, fr_value_box_t const *a, fr_token_t op, fr_value_box_t const *b)
Calculate DST = A OP B.
Definition calc.c:2013
static void * fr_dcursor_next(fr_dcursor_t *cursor)
Advanced the cursor to the next item.
Definition dcursor.h:288
static void * fr_dcursor_set_current(fr_dcursor_t *cursor, void *item)
Set the cursor to a specified item.
Definition dcursor.h:353
#define MEM(x)
Definition debug.h:38
fr_dict_t const * fr_dict_internal(void)
Definition dict_util.c:5080
talloc_free(hp)
#define RWDEBUG(fmt,...)
Definition log.h:378
#define RPEDEBUG(fmt,...)
Definition log.h:393
@ FR_TYPE_STRING
String of printable characters.
@ FR_TYPE_BOOL
A truth value.
int fr_pair_append_by_da(TALLOC_CTX *ctx, fr_pair_t **out, fr_pair_list_t *list, fr_dict_attr_t const *da)
Alloc a new fr_pair_t (and append)
Definition pair.c:1425
int fr_pair_list_copy(TALLOC_CTX *ctx, fr_pair_list_t *to, fr_pair_list_t const *from)
Duplicate a list of pairs.
Definition pair.c:2312
fr_pair_list_t * fr_pair_parent_list(fr_pair_t const *vp)
Return a pointer to the parent pair list.
Definition pair.c:915
fr_pair_t * fr_pair_find_by_da(fr_pair_list_t const *list, fr_pair_t const *prev, fr_dict_attr_t const *da)
Find the first pair with a matching da.
Definition pair.c:716
fr_pair_t * fr_pair_parent(fr_pair_t const *vp)
Return a pointer to the parent pair.
Definition pair.c:923
fr_pair_t * fr_pair_afrom_da(TALLOC_CTX *ctx, fr_dict_attr_t const *da)
Dynamically allocate a new attribute and assign a fr_dict_attr_t.
Definition pair.c:284
fr_slen_t fr_pair_list_afrom_substr(fr_pair_parse_t const *root, fr_pair_parse_t *relative, fr_sbuff_t *in)
Parse a fr_pair_list_t from a substring.
TALLOC_CTX * ctx
Definition pair_legacy.h:43
static int radius_legacy_map_to_vp(request_t *request, fr_pair_t *parent, map_t const *map)
Definition pairmove.c:35
int radius_legacy_map_cmp(request_t *request, map_t const *map)
Definition pairmove.c:519
static fr_pair_t * legacy_pair_build(fr_pair_t *parent, fr_dcursor_t *cursor, fr_dict_attr_t const *da, void *uctx)
Build the relevant pairs at each level.
Definition pairmove.c:193
fr_pair_t * vp
Definition pairmove.c:186
int radius_legacy_map_apply(request_t *request, map_t const *map, fr_edit_list_t *el)
Move a map using the operators from the old pairmove functionality.
Definition pairmove.c:229
static int radius_legacy_map_apply_structural(request_t *request, map_t const *map, fr_pair_t *vp)
Definition pairmove.c:83
int radius_legacy_map_list_apply(request_t *request, map_list_t const *list, fr_edit_list_t *el)
Definition pairmove.c:500
fr_edit_list_t * el
Definition pairmove.c:185
#define fr_assert(_expr)
Definition rad_assert.h:37
#define RDEBUG2(fmt,...)
#define RDEBUG(fmt,...)
static bool request_attr_is_list(fr_dict_attr_t const *da)
Definition request.h:363
#define FR_SBUFF_IN(_start, _len_or_end)
int tmpl_find_vp(fr_pair_t **out, request_t *request, tmpl_t const *vpt))
Returns the first VP matching a tmpl_t.
Definition tmpl_eval.c:777
static int16_t tmpl_attr_tail_num(tmpl_t const *vpt)
Return the last attribute reference's attribute number.
Definition tmpl.h:910
#define tmpl_contains_xlat(vpt)
Definition tmpl.h:234
#define tmpl_is_xlat(vpt)
Definition tmpl.h:217
#define NUM_LAST
Definition tmpl.h:420
#define tmpl_value(_tmpl)
Definition tmpl.h:962
#define tmpl_is_attr(vpt)
Definition tmpl.h:215
static fr_dict_attr_t const * tmpl_list(tmpl_t const *vpt)
Definition tmpl.h:929
#define NUM_COUNT
Definition tmpl.h:419
#define tmpl_pair_list_and_ctx(_ctx, _head, _request, _ref, _list)
Determine the correct context and list head.
Definition tmpl.h:1018
#define tmpl_is_data(vpt)
Definition tmpl.h:213
static fr_dict_attr_t const * tmpl_attr_tail_da(tmpl_t const *vpt)
Return the last attribute reference da.
Definition tmpl.h:826
#define tmpl_is_regex(vpt)
Definition tmpl.h:220
#define tmpl_aexpand(_ctx, _out, _request, _vpt, _escape, _escape_ctx)
Expand a tmpl to a C type, allocing a new buffer to hold the string.
Definition tmpl.h:1089
fr_pair_t * vp
Value pair map.
Definition map.h:77
fr_token_t op
The operator that controls insertion of the dst attribute.
Definition map.h:82
tmpl_t * lhs
Typically describes the attribute to add, modify or compare.
Definition map.h:78
map_list_t child
parent map, for nested ones
Definition map.h:89
tmpl_t * rhs
Typically describes a literal value or a src attribute to copy or compare.
Definition map.h:79
Stores an attribute, a value and various bits of other data.
Definition pair.h:68
fr_dict_attr_t const *_CONST da
Dictionary attribute defines the attribute number, vendor and type of the pair.
Definition pair.h:69
void tmpl_dcursor_clear(tmpl_dcursor_ctx_t *cc)
Clear any temporary state allocations.
#define tmpl_dcursor_build_init(_err, _ctx, _cc, _cursor, _request, _vpt, _build, _uctx)
#define tmpl_dcursor_init(_err, _ctx, _cc, _cursor, _request, _vpt)
Maintains state between cursor calls.
char const * fr_tokens[T_TOKEN_LAST]
Definition token.c:146
const bool fr_comparison_op[T_TOKEN_LAST]
Definition token.c:264
@ T_OP_SUB_EQ
Definition token.h:68
@ T_OP_CMP_TRUE
Definition token.h:102
@ T_OP_EQ
Definition token.h:81
@ T_OP_SET
Definition token.h:82
@ T_OP_ADD_EQ
Definition token.h:67
@ T_OP_CMP_FALSE
Definition token.h:103
@ T_OP_CMP_EQ
Definition token.h:104
@ T_OP_LE
Definition token.h:98
@ T_OP_GE
Definition token.h:96
static fr_event_list_t * el
int fr_edit_list_pair_delete(fr_edit_list_t *el, fr_pair_list_t *list, fr_pair_t *vp)
Delete a VP.
Definition edit.c:608
int fr_edit_list_save_pair_value(fr_edit_list_t *el, fr_pair_t *vp)
Record the value of a leaf fr_value_box_t.
Definition edit.c:646
int fr_edit_list_free_pair_children(fr_edit_list_t *el, fr_pair_t *vp)
Free children of a structural pair.
Definition edit.c:723
Track a series of edits.
Definition edit.c:101
#define fr_edit_list_insert_pair_tail(_el, _list, _vp)
Definition edit.h:51
static fr_slen_t parent
Definition pair.h:864
#define add(_type, _out, _in)
Definition stats.c:187
void fr_strerror_clear(void)
Clears all pending messages from the talloc pools.
Definition strerror.c:581
#define fr_strerror_printf(_fmt,...)
Log to thread local error buffer.
Definition strerror.h:64
#define fr_strerror_const(_msg)
Definition strerror.h:223
#define fr_type_is_structural(_x)
Definition types.h:392
#define fr_type_is_leaf(_x)
Definition types.h:393
static char const * fr_type_to_str(fr_type_t type)
Return a static string containing the type name.
Definition types.h:454
void fr_value_box_mark_unsafe(fr_value_box_t *vb)
Mark a value-box as "unsafe".
Definition value.c:7528
int fr_value_box_cast(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_type_t dst_type, fr_dict_attr_t const *dst_enumv, fr_value_box_t const *src)
Convert one type of fr_value_box_t to another.
Definition value.c:4071
int fr_value_box_cmp_op(fr_token_t op, fr_value_box_t const *a, fr_value_box_t const *b)
Compare two attributes using an operator.
Definition value.c:1017
void fr_value_box_strdup_shallow(fr_value_box_t *dst, fr_dict_attr_t const *enumv, char const *src, bool tainted)
Assign a buffer containing a nul terminated string to a box, but don't copy it.
Definition value.c:4873
int nonnull(2, 5))