]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
vp has to be left pointing to the head of the list returned by fr_pair_list_afrom_str...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 31 May 2018 17:09:45 +0000 (23:09 +0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 31 May 2018 17:10:46 +0000 (23:10 +0600)
src/lib/util/pair.c

index ad1db140ec32289d9ec1349dc3d7d8360825a3aa..457e76e25cabc6ad3c8fd55aec1f39cd7ded31a6 100644 (file)
@@ -1649,7 +1649,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, to_append;
+       fr_cursor_t cursor;
 
        VALUE_PAIR *vp = NULL;
        fr_cursor_init(&cursor, out);
@@ -1657,7 +1657,7 @@ int fr_pair_list_afrom_file(TALLOC_CTX *ctx, VALUE_PAIR **out, FILE *fp, bool *p
        while (fgets(buf, sizeof(buf), fp) != NULL) {
                /*
                 *      If we get a '\n' by itself, we assume that's
-                *      the end of that VP
+                *      the end of that VP list.
                 */
                if (buf[0] == '\n') {
                        if (vp) {
@@ -1682,8 +1682,10 @@ int fr_pair_list_afrom_file(TALLOC_CTX *ctx, VALUE_PAIR **out, FILE *fp, bool *p
                        break;
                }
 
-               fr_cursor_init(&to_append, &vp);
-               fr_cursor_merge(&cursor, &to_append);
+               do {
+                       fr_cursor_append(&cursor, vp);
+               } while (vp->next && (vp = vp->next));
+
                buf[0] = '\0';
        }
        *pfiledone = true;