From: Alan T. DeKok Date: Tue, 5 Jun 2018 16:55:22 +0000 (-0400) Subject: append all VPs, not just the first one. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aca79ea01ab9e0b287107b820bc8cbb6dc9782f4;p=thirdparty%2Ffreeradius-server.git append all VPs, not just the first one. it's rather surprising to see fr_cursor_append() set vp->next=NULL which causes all kinds of issues with callers expecting something else. --- diff --git a/src/lib/util/pair.c b/src/lib/util/pair.c index 51a28a335c4..c39a5584428 100644 --- a/src/lib/util/pair.c +++ b/src/lib/util/pair.c @@ -1652,7 +1652,7 @@ int fr_pair_list_afrom_file(TALLOC_CTX *ctx, VALUE_PAIR **out, FILE *fp, bool *p char buf[8192]; FR_TOKEN last_token = T_EOL; - fr_cursor_t cursor; + fr_cursor_t cursor, to_append; VALUE_PAIR *vp = NULL; fr_cursor_init(&cursor, out); @@ -1685,9 +1685,8 @@ int fr_pair_list_afrom_file(TALLOC_CTX *ctx, VALUE_PAIR **out, FILE *fp, bool *p break; } - do { - fr_cursor_append(&cursor, vp); - } while (vp->next && (vp = vp->next)); + fr_cursor_init(&to_append, &vp); + fr_cursor_merge(&cursor, &to_append); buf[0] = '\0'; }