Skip to content

Commit

Permalink
Allow expansions while we're processing the list.
Browse files Browse the repository at this point in the history
By the horrible hack of making a copy of the input list.
The issue is that the expansions need access to the input list,
but we also need to re-write the input list in radius_pairmove()

So until we have a better fix, we'll just do this hack
  • Loading branch information
alandekok committed Jun 29, 2015
1 parent 3d3a6ce commit c16d4fa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/evaluate.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,8 +777,10 @@ void radius_pairmove(REQUEST *request, VALUE_PAIR **to, VALUE_PAIR *from, bool d
vp_cursor_t cursor;
VALUE_PAIR *vp, *next, **last;
VALUE_PAIR **from_list, **to_list;
VALUE_PAIR *to_copy;
bool *edited = NULL;
REQUEST *fixup = NULL;
TALLOC_CTX *ctx;

if (!request) return;

Expand Down Expand Up @@ -822,7 +824,9 @@ void radius_pairmove(REQUEST *request, VALUE_PAIR **to, VALUE_PAIR *from, bool d
}

to_count = 0;
for (vp = *to; vp != NULL; vp = next) {
ctx = talloc_parent(*to);
to_copy = paircopy(ctx, *to);
for (vp = to_copy; vp != NULL; vp = next) {
next = vp->next;
to_list[to_count++] = vp;
vp->next = NULL;
Expand Down Expand Up @@ -1014,7 +1018,7 @@ void radius_pairmove(REQUEST *request, VALUE_PAIR **to, VALUE_PAIR *from, bool d
/*
* Re-chain the "to" list.
*/
*to = NULL;
pairfree(to);
last = to;

if (to == &request->packet->vps) {
Expand Down

0 comments on commit c16d4fa

Please sign in to comment.