"Vic Abell" <[EMAIL PROTECTED]> wrote:
> When processing a $INCLUDE directive, the following code in
> pairlist_read() of main/files.c may cause any accumulated
> pair information to be lost when the recursion of the function
> returns a NULL to its PAIR_LIST **list argument.  This can
> happen, for example, when the users file has a $INCLUDE that
> names an empty file and other pairs or $INCLUDE directives
> follow.

  OK.

>       last = t;
>       while (last && last->next)
>               last = last->next;
> 
> If t == NULL, then last will become NULL.  If any pairs or any
> $INCLUDE follow the $INCLUDE that caused pairlist_read() to set
> t == NULL, all pairs recorded prior to the $INCLUDE of the empty
> file will be lost.

  You're right.

> A fix that appears to work that has been tested under 0.8.1 is:

  The solution is simpler.  Make 'last' a pointer to a pointer,
instead of a pointer.  That gets rid of lots of "if" statements, and
we can do:

  PAIR_LIST *pl = NULL;
  PAIR_LIST **last = &pl;

  ...

  *last = t;
  last = &t->next

  ...

  I've commited a fix, thanks.

  Alan DeKok.

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to