]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Replace cursor functions with pair_list functions in radclient.c
authorNick Porter <nick@portercomputing.co.uk>
Tue, 5 Jan 2021 17:52:30 +0000 (17:52 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 21 Jan 2021 23:05:49 +0000 (23:05 +0000)
src/bin/radclient.c

index ef0a2fb64e13c471e9d9dc563a9038f874b7a856..9573296a6289b1796e90448652034d2db75b3e14 100644 (file)
@@ -326,7 +326,6 @@ static int radclient_init(TALLOC_CTX *ctx, rc_file_pair_t *files)
 {
        FILE            *packets, *filters = NULL;
 
-       fr_cursor_t     cursor;
        fr_pair_t       *vp;
        rc_request_t    *request;
        bool            packets_done = false;
@@ -445,9 +444,9 @@ static int radclient_init(TALLOC_CTX *ctx, rc_file_pair_t *files)
                        /*
                         *      xlat expansions aren't supported here
                         */
-                       for (vp = fr_cursor_init(&cursor, &request->filter);
+                       for (vp = fr_pair_list_head(&request->filter);
                             vp;
-                            vp = fr_cursor_next(&cursor)) {
+                            vp = fr_pair_list_next(&request->filter, vp)) {
                             again:
                                /*
                                 *      Xlat expansions are not supported. Convert xlat to value box (if possible).
@@ -462,10 +461,11 @@ static int radclient_init(TALLOC_CTX *ctx, rc_file_pair_t *files)
                                }
 
                                if (vp->da == attr_packet_type) {
-                                       vp = fr_cursor_remove(&cursor); /* so we don't break the filter */
+                                       fr_pair_t *next;
+                                       next = fr_pair_list_next(&request->filter, vp); /* so we don't break the filter */
                                        request->filter_code = vp->vp_uint32;
-                                       talloc_free(vp);
-                                       vp = fr_cursor_current(&cursor);
+                                       fr_pair_delete(&request->filter, vp);
+                                       vp = next;
                                        if (!vp) break;
                                        goto again;
                                }
@@ -480,9 +480,9 @@ static int radclient_init(TALLOC_CTX *ctx, rc_file_pair_t *files)
                /*
                 *      Process special attributes
                 */
-               for (vp = fr_cursor_init(&cursor, &request->request_pairs);
+               for (vp = fr_pair_list_head(&request->request_pairs);
                     vp;
-                    vp = fr_cursor_next(&cursor)) {
+                    vp = fr_pair_list_next(&request->request_pairs, vp)) {
                        /*
                         *      Xlat expansions are not supported. Convert xlat to value box (if possible).
                         */