]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Amend function calls that use fr_pair_t ** and fr_pair_t * for lists to use fr_pair_l...
authorNick Porter <nick@portercomputing.co.uk>
Thu, 10 Dec 2020 04:31:21 +0000 (04:31 +0000)
committerGitHub <noreply@github.com>
Thu, 10 Dec 2020 04:31:21 +0000 (21:31 -0700)
* s/fr_pair_t **/fr_pair_list_t */ in radclient.c function calls

* s/fr_pair_t **/fr_pair_list_t */ in radsniff.c function calls

* s/fr_pair_t **/fr_pair_list_t */ in state_machine.c function calls

* s/fr_pair_t **/fr_pair_list_t */ in map.c function calls

* s/fr_pair_t **/fr_pair_list_t */ in exec.c function calls

* s/fr_pair_t **/fr_pair_list_t */ in map.c function calls

* s/fr_pair_t **/fr_pair_list_t */ in pairmove.c function calls

* s/fr_pair_t **/fr_pair_list_t */ in rlm_client.c function calls

* s/fr_pair_t **/fr_pair_list_t */ in rlm_csv.c function calls

* s/fr_pair_t **/fr_pair_list_t */ in rlm_json.c function calls

* s/fr_pair_t **/fr_pair_list_t */ in rlm_mruby.c function calls

* s/fr_pair_t **/fr_pair_list_t */ in rlm_passwd.c function calls

* s/fr_pair_t **/fr_pair_list_t */ in rlm_perl.c function calls

* s/fr_pair_t **/fr_pair_list_t */ in rlm_python.c function calls

* s/fr_pair_t **/fr_pair_list_t */ in rlm_radisu_udp.c function calls

* s/fr_pair_t **/fr_pair_list_t */ in rlm_sql.c function calls

* s/fr_pair_t **/fr_pair_list_t */ in tmpl_eval.c function calls

* Amend rs_get_pairs() to take fr_pair_list_t *

* Amend radsmnp_get_response() to take fr_pair_list_t *

* Amend radsnmp_set_response() to take fr_pair_list_t *

* Amend eap_packet_from_vp() to take fr_pair_list_t *

* Amend eap_chbind_vp2packet() to take fr_pair_list_t *

* Amend fr_aka_sim_encode() to take fr_pair_list_t *

* Amend client_error_debug() to take fr_pair_list_t *

* Amend sim_start_selected_version_check() to take fr_pair_list_t *

* Amend sim_start_nonce_mt_check() to take fr_pair_list_t *

* Amend vector_opc_from_op() to take fr_pair_list_t *

* Alter vector_gsm_from_ki() to take fr_pair_list_t *

* Alter vector_gsm_from_triplets() to take fr_pair_list_t *

* Alter vector_gsm_from_quintuplets to take fr_pair_list_t *

* Alter fr_aka_sim_vector_gsm_from_attrs() to take fr_pair_list_t *

* Alter vector_umts_from_ki() to take fr_pair_list_t *

* Alter vector_umts_from_quintuplets() to take fr_pair_list_t *

* Alter fr_aka_sim_vector_umts_from_attrs() to take fr_pair_list_t *

* Alter fr_aka_sim_vector_gsm_umts_kdf_0_reauth_from_attrs

to take fr_pair_list_t *

* Alter fr_aka_sim_vector_umts_kdf_1_reauth_from_attrs()

to take fr_pair_list_t *

* Alter fr_json_afrom_pair_list to take fr_pair_list_t *

* Alter fr_redis_cluster_alloc() to take fr_pair_list_t *

* Alter fr_exec_pair_to_env() to take fr_pair_list_t *

* Alter radius_start_program to take fr_pair_list_t *

* Alter radius_exec_program() to take fr_pair_list_t *

* Alter fr_exec_nowait() to take fr_pair_list_t *

* Alter fr_exec_wait_start() to take fr_pair_list_t *

* Alter exfile_enable_triggers() to take fr_pair_list_t *

* Alter log_request_pair_list() to take fr_pair_list_t *

* Alter log_request_proto_pair_list() to take fr_pair_list_t *

* Alter module_exfile_init() to take fr_pair_list_t *

* Alter fr_pool_enable_triggers() to take fr_pair_list_t *

* Alter radius_pairmove() to take fr_pair_list_t *

* Alter trigger_exec() to take fr_pair_list_t *

* Alter unlang_module_yeild_to_tmpl() to take fr_pair_list_t *

* Alter mod_ensure_start_timestamp() to take fr_pair_list_t *

* Alter eap_fast_processs_tlvs() to take fr_pair_list_t *

* Alter eap_peap_inner_from_pairs() to take fr_pair_list_t *

* Alter fall_through() to take fr_pair_list_t *

* Alter sql_fall_through() to take fr_pair_list_t *

* Alter fr_arp_encode() to take fr_pair_list_t *

* Alter fr_dhcpv4_encode() and fr_dhcpv4_encode_dbuff() to take fr_pair_list_t *

* Alter fr_dhcpv6_encode() to take fr_pair_list_t *

* Alter fr_raidus_encode() and fr_raidus_encode_dbuff() to take fr_pair_list_t *

* Alter encode_tags() to take fr_pair_list_t *

* Alter fr_tacacs_encode() to take fr_pair_list_t *

* Alter protocol encode test functions to take fr_pair_list_t *

* Alter RAD_COMPARE_FUNC() to take fr_pair_list_t * for lists

Plus make parameter names more consistent.

* Alter paircmp() to take fr_pair_list_t *

Also, amend call to paircmp_func() to be consistent in use of lists vs
individual VPs.

* Make parameter names more consistent and improve comments in paircmp.c

* Amend unlang_tmpl_push() to take fr_pair_list_t *

* Missing pair list initialisation calls

* Duplicate args list in exfile_trigger_exec()

111 files changed:
src/bin/radclient.c
src/bin/radsniff.c
src/bin/radsnmp.c
src/bin/unit_test_attribute.c
src/lib/curl/base.c
src/lib/eap/base.c
src/lib/eap/base.h
src/lib/eap/chbind.c
src/lib/eap/chbind.h
src/lib/eap_aka_sim/base.h
src/lib/eap_aka_sim/encode.c
src/lib/eap_aka_sim/state_machine.c
src/lib/eap_aka_sim/vector.c
src/lib/io/test_point.h
src/lib/json/base.h
src/lib/json/json.c
src/lib/ldap/base.h
src/lib/ldap/map.c
src/lib/redis/cluster.c
src/lib/redis/cluster.h
src/lib/server/auth.c
src/lib/server/cond_eval.c
src/lib/server/exec.c
src/lib/server/exec.h
src/lib/server/exfile.c
src/lib/server/exfile.h
src/lib/server/log.c
src/lib/server/log.h
src/lib/server/map.c
src/lib/server/map.h
src/lib/server/module.c
src/lib/server/module.h
src/lib/server/paircmp.c
src/lib/server/paircmp.h
src/lib/server/pairmove.c
src/lib/server/pairmove.h
src/lib/server/pool.c
src/lib/server/pool.h
src/lib/server/state.c
src/lib/server/tmpl_eval.c
src/lib/server/trigger.c
src/lib/server/trigger.h
src/lib/tls/validate.c
src/lib/unlang/module.c
src/lib/unlang/module.h
src/lib/unlang/subrequest.c
src/lib/unlang/tmpl.c
src/lib/unlang/tmpl.h
src/lib/unlang/tmpl_priv.h
src/lib/util/cursor.h
src/lib/util/pair.c
src/lib/util/pair.h
src/modules/proto_arp/proto_arp.c
src/modules/proto_arp/proto_arp_process.c
src/modules/proto_detail/proto_detail_process.c
src/modules/proto_dhcpv4/proto_dhcpv4.c
src/modules/proto_dhcpv4/proto_dhcpv4_process.c
src/modules/proto_dhcpv6/proto_dhcpv6.c
src/modules/proto_dhcpv6/proto_dhcpv6_process.c
src/modules/proto_radius/proto_radius.c
src/modules/proto_radius/proto_radius_acct.c
src/modules/proto_radius/proto_radius_auth.c
src/modules/proto_radius/proto_radius_coa.c
src/modules/proto_radius/proto_radius_load.c
src/modules/proto_radius/proto_radius_status.c
src/modules/proto_tacacs/proto_tacacs.c
src/modules/proto_vmps/proto_vmps_dynamic_client.c
src/modules/proto_vmps/proto_vmps_process.c
src/modules/rlm_client/rlm_client.c
src/modules/rlm_couchbase/mod.c
src/modules/rlm_couchbase/mod.h
src/modules/rlm_couchbase/rlm_couchbase.c
src/modules/rlm_csv/rlm_csv.c
src/modules/rlm_eap/rlm_eap.c
src/modules/rlm_eap/types/rlm_eap_fast/eap_fast.c
src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c
src/modules/rlm_eap/types/rlm_eap_peap/peap.c
src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c
src/modules/rlm_exec/rlm_exec.c
src/modules/rlm_expiration/rlm_expiration.c
src/modules/rlm_files/rlm_files.c
src/modules/rlm_json/rlm_json.c
src/modules/rlm_ldap/rlm_ldap.c
src/modules/rlm_logintime/rlm_logintime.c
src/modules/rlm_mruby/rlm_mruby.c
src/modules/rlm_passwd/rlm_passwd.c
src/modules/rlm_perl/rlm_perl.c
src/modules/rlm_python/rlm_python.c
src/modules/rlm_radius/rlm_radius_udp.c
src/modules/rlm_rest/rest.c
src/modules/rlm_sql/rlm_sql.c
src/modules/rlm_sqlcounter/rlm_sqlcounter.c
src/modules/rlm_test/rlm_test.c
src/modules/rlm_unix/rlm_unix.c
src/modules/rlm_winbind/rlm_winbind.c
src/protocols/arp/arp.h
src/protocols/arp/base.c
src/protocols/dhcpv4/base.c
src/protocols/dhcpv4/dhcpv4.h
src/protocols/dhcpv4/encode.c
src/protocols/dhcpv4/packet.c
src/protocols/dhcpv6/base.c
src/protocols/dhcpv6/dhcpv6.h
src/protocols/dhcpv6/encode.c
src/protocols/radius/base.c
src/protocols/radius/encode.c
src/protocols/radius/packet.c
src/protocols/radius/radius.h
src/protocols/tacacs/encode.c
src/protocols/tacacs/tacacs.h
src/protocols/vmps/vmps.c

index 87f980c49adcf601a1bcfbdf8e8aa0878ce7b7bb..38ea6c7a2fd03346c627951a90db970f80c5240b 100644 (file)
@@ -192,7 +192,7 @@ static int _rc_request_free(rc_request_t *request)
        return 0;
 }
 
-static int mschapv1_encode(fr_radius_packet_t *packet, fr_pair_t **request,
+static int mschapv1_encode(fr_radius_packet_t *packet, fr_pair_list_t *request,
                           char const *password)
 {
        unsigned int            i;
index f78e7e78b97478fa0a42bac73b3d3c33f43c8d23..846f3a6cd78b2a9426ad6a5710efef0cdbae7c71 100644 (file)
@@ -936,7 +936,7 @@ static int rs_install_stats_processor(rs_stats_t *stats, fr_event_list_t *el,
  *
  * Should be O(n) if all the attributes exist.  List must be pre-sorted.
  */
-static int rs_get_pairs(TALLOC_CTX *ctx, fr_pair_t **out, fr_pair_t *vps, fr_dict_attr_t const *da[], int num)
+static int rs_get_pairs(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_pair_list_t *vps, fr_dict_attr_t const *da[], int num)
 {
        fr_cursor_t list_cursor, out_cursor;
        fr_pair_t *match, *copy;
@@ -944,7 +944,7 @@ static int rs_get_pairs(TALLOC_CTX *ctx, fr_pair_t **out, fr_pair_t *vps, fr_dic
        uint64_t count = 0;
        int i;
 
-       last_match = vps;
+       last_match = *vps;
 
        fr_cursor_init(&list_cursor, &last_match);
        fr_cursor_init(&out_cursor, out);
@@ -962,7 +962,7 @@ static int rs_get_pairs(TALLOC_CTX *ctx, fr_pair_t **out, fr_pair_t *vps, fr_dic
                                return -1;
                        }
                        fr_cursor_append(&out_cursor, copy);
-                       last_match = match;
+                       fr_pair_list_set_head(last_match, *match);
 
                        count++;
                } while ((match = fr_cursor_filter_next(&list_cursor, fr_pair_matches_da, da[i])));
@@ -1568,7 +1568,7 @@ static void rs_packet_process(uint64_t count, rs_event_t *event, struct pcap_pkt
 
                if ((conf->link_da_num > 0) && packet->vps) {
                        int ret;
-                       ret = rs_get_pairs(packet, &search.link_vps, packet->vps, conf->link_da,
+                       ret = rs_get_pairs(packet, &search.link_vps, &packet->vps, conf->link_da,
                                           conf->link_da_num);
                        if (ret < 0) {
                                ERROR("Failed extracting RTX linking pairs from request");
@@ -1978,7 +1978,7 @@ static int rs_build_dict_list(fr_dict_attr_t const **out, size_t len, char *list
        return i;
 }
 
-static int rs_build_filter(fr_pair_t **out, char const *filter)
+static int rs_build_filter(fr_pair_list_t *out, char const *filter)
 {
        fr_cursor_t cursor;
        fr_pair_t *vp;
index 2ba965ebfc04d290ec34c41be270fc5792cb1ea8..a99738ed03445c1ef044f04f42dc8f7e37affe47 100644 (file)
@@ -386,7 +386,7 @@ static ssize_t radsnmp_pair_from_oid(TALLOC_CTX *ctx, radsnmp_conf_t *conf, fr_c
  */
 static int radsnmp_get_response(int fd,
                                fr_dict_attr_t const *root, fr_dict_attr_t const *type,
-                               fr_pair_t *head)
+                               fr_pair_list_t *head)
 {
        fr_cursor_t             cursor;
        fr_pair_t               *vp, *type_vp;
@@ -426,7 +426,7 @@ static int radsnmp_get_response(int fd,
         *      attribute grouping to coalesce all related index
         *      attributes under a single request OID.
         */
-        for (vp = fr_cursor_init(&cursor, &head);
+        for (vp = fr_cursor_init(&cursor, head);
              vp;
              vp = fr_cursor_next(&cursor)) {
                fr_dict_attr_t const *common;
@@ -582,7 +582,7 @@ static int radsnmp_get_response(int fd,
  *     - 0 on success.
  *     - -1 on failure.
  */
-static int radsnmp_set_response(int fd, fr_dict_attr_t const *error, fr_pair_t *head)
+static int radsnmp_set_response(int fd, fr_dict_attr_t const *error, fr_pair_list_t *head)
 {
        fr_pair_t       *vp;
        char            buffer[64];
@@ -590,7 +590,7 @@ static int radsnmp_set_response(int fd, fr_dict_attr_t const *error, fr_pair_t *
        struct iovec    io_vector[2];
        char            newline[] = "\n";
 
-       vp = fr_pair_find_by_da(&head, error);
+       vp = fr_pair_find_by_da(head, error);
        if (!vp) {
                if (write(fd, "DONE\n", 5) < 0) {
                        fr_strerror_printf("Failed writing set response: %s", fr_syserror(errno));
@@ -850,7 +850,7 @@ static int radsnmp_send_recv(radsnmp_conf_t *conf, int fd)
                        case RADSNMP_GET:
                        case RADSNMP_GETNEXT:
                                ret = radsnmp_get_response(STDOUT_FILENO, conf->snmp_oid_root,
-                                                          attr_freeradius_snmp_type, reply->vps);
+                                                          attr_freeradius_snmp_type, &reply->vps);
                                switch (ret) {
                                case -1:
                                        fr_perror("Failed converting pairs to varbind response");
@@ -867,7 +867,7 @@ static int radsnmp_send_recv(radsnmp_conf_t *conf, int fd)
                                break;
 
                        case RADSNMP_SET:
-                               if (radsnmp_set_response(STDOUT_FILENO, attr_freeradius_snmp_failure, reply->vps) < 0) {
+                               if (radsnmp_set_response(STDOUT_FILENO, attr_freeradius_snmp_failure, &reply->vps) < 0) {
                                        fr_perror("Failed writing SET response");
                                        return EXIT_FAILURE;
                                }
index ec60a695d35a5dfa83d5b89f0a5a7a3918e6b83d..64a5857129bc89333a02433260a241e008142346 100644 (file)
@@ -1796,7 +1796,7 @@ static size_t command_encode_proto(command_result_t *result, command_file_ctx_t
                RETURN_OK_WITH_ERROR();
        }
 
-       slen = tp->func(cc->tmp_ctx, head, cc->buffer_start, cc->buffer_end - cc->buffer_start, encoder_ctx);
+       slen = tp->func(cc->tmp_ctx, &head, cc->buffer_start, cc->buffer_end - cc->buffer_start, encoder_ctx);
        fr_pair_list_free(&head);
        cc->last_ret = slen;
        if (slen < 0) {
index f1bbd5257e8af70497486ba5ad6abe7403d9656e..f0487947e7998453944a029113ff78ebae0b78dc 100644 (file)
@@ -228,7 +228,7 @@ int fr_curl_response_certinfo(request_t *request, fr_curl_io_request_t *randle)
                        /*
                         *      Print out all the pairs we have so far
                         */
-                       log_request_pair_list(L_DBG_LVL_2, request, NULL, cert_vps, NULL);
+                       log_request_pair_list(L_DBG_LVL_2, request, NULL, &cert_vps, NULL);
                        fr_cursor_merge(&list, &cursor);
                        fr_pair_list_init(&cert_vps);
                }
index 39c2b53e4dd68e0bb4d2d999b898ec57ad4ea084..c611e729a5ef00821ff3600f461e025d6c889d31 100644 (file)
@@ -279,7 +279,7 @@ static bool eap_is_valid(eap_packet_raw_t **eap_packet_p)
  * NOTE: Sometimes Framed-MTU might contain the length of EAP-Message,
  *      refer fragmentation in rfc2869.
  */
-eap_packet_raw_t *eap_packet_from_vp(TALLOC_CTX *ctx, fr_pair_t *vps)
+eap_packet_raw_t *eap_packet_from_vp(TALLOC_CTX *ctx, fr_pair_list_t *vps)
 {
        fr_pair_t               *vp;
        eap_packet_raw_t        *eap_packet;
@@ -291,7 +291,7 @@ eap_packet_raw_t *eap_packet_from_vp(TALLOC_CTX *ctx, fr_pair_t *vps)
        /*
         *      Get only EAP-Message attribute list
         */
-       vp = fr_cursor_iter_by_da_init(&cursor, &vps, attr_eap_message);
+       vp = fr_cursor_iter_by_da_init(&cursor, vps, attr_eap_message);
        if (!vp) {
                fr_strerror_printf("EAP-Message not found");
                return NULL;
index fd6744f60276a350ed32d54c034f3e9aad5790d4..a21bf14eed6b2e87dcac3291383c5c37c7d22b62 100644 (file)
@@ -69,7 +69,7 @@ typedef struct {
  *     interfaces in eapcommon.c
  */
 fr_pair_t              *eap_packet_to_vp(fr_radius_packet_t *packet, eap_packet_raw_t const *reply);
-eap_packet_raw_t       *eap_packet_from_vp(TALLOC_CTX *ctx, fr_pair_t *vps);
+eap_packet_raw_t       *eap_packet_from_vp(TALLOC_CTX *ctx, fr_pair_list_t *vps);
 void                   eap_add_reply(request_t *request, fr_dict_attr_t const *da, uint8_t const *value, int len);
 
 rlm_rcode_t            eap_virtual_server(request_t *request, eap_session_t *eap_session, char const *virtual_server);
index bf9354ed059a55077dc7a642a1f45a144b005598..8e3084eafcd4f037d38fab667314ea0a15f7c6b1 100644 (file)
@@ -83,7 +83,7 @@ static bool chbind_build_response(request_t *request, CHBIND_REQ *chbind)
        ptr[3] = CHBIND_NSID_RADIUS;
 
        RDEBUG2("Sending chbind response: code %i", (int )(ptr[0]));
-       log_request_pair_list(L_DBG_LVL_1, request, NULL, request->reply_pairs, NULL);
+       log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->reply_pairs, NULL);
 
        /* Encode the chbind attributes into the response */
        ptr += 4;
@@ -258,7 +258,7 @@ FR_CODE chbind_process(request_t *request, CHBIND_REQ *chbind)
  *     Handles multiple EAP-channel-binding Message attrs
  *     ie concatenates all to get the complete EAP-channel-binding packet.
  */
-chbind_packet_t *eap_chbind_vp2packet(TALLOC_CTX *ctx, fr_pair_t *vps)
+chbind_packet_t *eap_chbind_vp2packet(TALLOC_CTX *ctx, fr_pair_list_t *vps)
 {
        size_t                  length;
        uint8_t                 *ptr;
@@ -266,7 +266,7 @@ chbind_packet_t *eap_chbind_vp2packet(TALLOC_CTX *ctx, fr_pair_t *vps)
        chbind_packet_t         *packet;
        fr_cursor_t             cursor;
 
-       if (!fr_cursor_iter_by_da_init(&cursor, &vps, attr_eap_channel_binding_message)) return NULL;
+       if (!fr_cursor_iter_by_da_init(&cursor, vps, attr_eap_channel_binding_message)) return NULL;
 
        /*
         *      Compute the total length of the channel binding data.
index 0c5c997eca45bfd32706d66c726895d25d03b186..b95782ffe2a8aee9ec99e4480f56cd9d64f87334 100644 (file)
@@ -60,4 +60,4 @@ typedef struct {
 FR_CODE chbind_process(request_t *request, CHBIND_REQ *chbind_req);
 
 fr_pair_t *eap_chbind_packet2vp(fr_radius_packet_t *packet, chbind_packet_t *chbind);
-chbind_packet_t *eap_chbind_vp2packet(TALLOC_CTX *ctx, fr_pair_t *vps);
+chbind_packet_t *eap_chbind_vp2packet(TALLOC_CTX *ctx, fr_pair_list_t *vps);
index 6b04050a7354a14c76f734f5bfa3d0dad193f443..18f85822dd09b6668a950b2b65660940ad05e8c0 100644 (file)
@@ -256,7 +256,7 @@ int         fr_aka_sim_decode(request_t *request, fr_cursor_t *decoded, fr_dict_t const
  */
 ssize_t                fr_aka_sim_encode_pair(fr_dbuff_t *dbuff, fr_cursor_t *cursor, void *encoder_ctx);
 
-ssize_t                fr_aka_sim_encode(request_t *request, fr_pair_t *to_encode, void *encode_ctx);
+ssize_t                fr_aka_sim_encode(request_t *request, fr_pair_list_t *to_encode, void *encode_ctx);
 
 /*
  *     base.c
@@ -307,19 +307,19 @@ void              fr_aka_sim_crypto_keys_log(request_t *request, fr_aka_sim_keys_t *keys);
 /*
  *     vector.c
  */
-int            fr_aka_sim_vector_gsm_from_attrs(request_t *request, fr_pair_t *vps,
+int            fr_aka_sim_vector_gsm_from_attrs(request_t *request, fr_pair_list_t *vps,
                                                 int idx,
                                                 fr_aka_sim_keys_t *keys,
                                                 fr_aka_sim_vector_src_t *src);
 
-int            fr_aka_sim_vector_umts_from_attrs(request_t *request, fr_pair_t *vps,
+int            fr_aka_sim_vector_umts_from_attrs(request_t *request, fr_pair_list_t *vps,
                                                  fr_aka_sim_keys_t *keys,
                                                  fr_aka_sim_vector_src_t *src);
 
-int            fr_aka_sim_vector_gsm_umts_kdf_0_reauth_from_attrs(request_t *request, fr_pair_t *vps,
+int            fr_aka_sim_vector_gsm_umts_kdf_0_reauth_from_attrs(request_t *request, fr_pair_list_t *vps,
                                                                   fr_aka_sim_keys_t *keys);
 
-int            fr_aka_sim_vector_umts_kdf_1_reauth_from_attrs(request_t *request, fr_pair_t *vps,
+int            fr_aka_sim_vector_umts_kdf_1_reauth_from_attrs(request_t *request, fr_pair_list_t *vps,
                                                               fr_aka_sim_keys_t *keys);
 
 void           fr_aka_sim_vector_umts_reauth_clear(fr_aka_sim_keys_t *keys);
index bf2e95ab21dfe5fdef0a36d65a2607ecfb426847..1a2dbe72820e14b80b4da9007691861123b2c6f3 100644 (file)
@@ -854,7 +854,7 @@ ssize_t fr_aka_sim_encode_pair(fr_dbuff_t *dbuff, fr_cursor_t *cursor, void *enc
        return fr_dbuff_set(dbuff, &work_dbuff);
 }
 
-ssize_t fr_aka_sim_encode(request_t *request, fr_pair_t *to_encode, void *encode_ctx)
+ssize_t fr_aka_sim_encode(request_t *request, fr_pair_list_t *to_encode, void *encode_ctx)
 {
        fr_pair_t               *vp;
 
@@ -876,7 +876,7 @@ ssize_t fr_aka_sim_encode(request_t *request, fr_pair_t *to_encode, void *encode
         *      It might be too big for putting into an
         *      EAP packet.
         */
-       vp = fr_pair_find_by_child_num(&to_encode, packet_ctx->root, FR_SUBTYPE);
+       vp = fr_pair_find_by_child_num(to_encode, packet_ctx->root, FR_SUBTYPE);
        if (!vp) {
                REDEBUG("Missing subtype attribute");
                return PAIR_ENCODE_FATAL_ERROR;
@@ -886,13 +886,13 @@ ssize_t fr_aka_sim_encode(request_t *request, fr_pair_t *to_encode, void *encode
        /*
         *      Group attributes with similar lineages together
         */
-       fr_pair_list_sort(&to_encode, fr_pair_cmp_by_parent_num);
-       if (fr_cursor_init(&cursor, &to_encode) == vp) fr_cursor_next(&cursor); /* Skip subtype if it came out first */
+       fr_pair_list_sort(to_encode, fr_pair_cmp_by_parent_num);
+       if (fr_cursor_init(&cursor, to_encode) == vp) fr_cursor_next(&cursor);  /* Skip subtype if it came out first */
 
        /*
         *      Will we need to generate a HMAC?
         */
-       if (fr_pair_find_by_child_num(&to_encode, packet_ctx->root, FR_MAC)) do_hmac = true;
+       if (fr_pair_find_by_child_num(to_encode, packet_ctx->root, FR_MAC)) do_hmac = true;
 
        /*
         *      Fast path, we just need to encode a subtype
index 8121444713d8cbfcd89c9d4b002e067b1eaa2c65..406a50e2d0148695da8c01895eeadcac0d08efaa 100644 (file)
@@ -270,11 +270,11 @@ static void identity_hint_pairs_add(fr_aka_sim_id_type_t *type_p, fr_aka_sim_met
 /** Print out the error the client returned
  *
  */
-static inline void client_error_debug(request_t *request, fr_pair_t *from_peer)
+static inline void client_error_debug(request_t *request, fr_pair_list_t *from_peer)
 {
        fr_pair_t *vp;
 
-       vp = fr_pair_find_by_da(&from_peer, attr_eap_aka_sim_client_error_code);
+       vp = fr_pair_find_by_da(from_peer, attr_eap_aka_sim_client_error_code);
        if (!vp) {
                REDEBUG("Peer has not supplied a AT_ERROR_CODE");
        } else {
@@ -880,13 +880,13 @@ static int common_encode(request_t *request, eap_session_t *eap_session, uint16_
 
 
        RDEBUG2("Encoding attributes");
-       log_request_pair_list(L_DBG_LVL_2, request, NULL, head, NULL);
+       log_request_pair_list(L_DBG_LVL_2, request, NULL, &head, NULL);
 
        eap_session->this_round->request->type.num = eap_aka_sim_session->type;
        eap_session->this_round->request->id = eap_aka_sim_session->id++ & 0xff;
        eap_session->this_round->set_request_id = true;
 
-       ret = fr_aka_sim_encode(request, head, &encoder_ctx);
+       ret = fr_aka_sim_encode(request, &head, &encoder_ctx);
        fr_cursor_head(&to_encode);
        fr_cursor_free_list(&to_encode);
 
@@ -1160,7 +1160,7 @@ static unlang_action_t common_reauthentication_request_compose(rlm_rcode_t *p_re
         */
        case FR_EAP_METHOD_SIM:
        case FR_EAP_METHOD_AKA:
-               if (fr_aka_sim_vector_gsm_umts_kdf_0_reauth_from_attrs(request, request->state,
+               if (fr_aka_sim_vector_gsm_umts_kdf_0_reauth_from_attrs(request, &request->state,
                                                                       &eap_aka_sim_session->keys) != 0) {
                request_new_id:
                        switch (eap_aka_sim_session->last_id_req) {
@@ -1192,7 +1192,7 @@ static unlang_action_t common_reauthentication_request_compose(rlm_rcode_t *p_re
        case FR_EAP_METHOD_AKA_PRIME:
                switch (eap_aka_sim_session->kdf) {
                case FR_KDF_VALUE_PRIME_WITH_CK_PRIME_IK_PRIME:
-                       if (fr_aka_sim_vector_umts_kdf_1_reauth_from_attrs(request, request->state,
+                       if (fr_aka_sim_vector_umts_kdf_1_reauth_from_attrs(request, &request->state,
                                                                           &eap_aka_sim_session->keys) != 0) {
                                goto request_new_id;
                        }
@@ -1371,7 +1371,7 @@ static unlang_action_t aka_challenge_request_compose(rlm_rcode_t *p_result, modu
         *      Get vectors from attribute or generate
         *      them using COMP128-* or Milenage.
         */
-       if (fr_aka_sim_vector_umts_from_attrs(request, request->control_pairs, &eap_aka_sim_session->keys, &src) != 0) {
+       if (fr_aka_sim_vector_umts_from_attrs(request, &request->control_pairs, &eap_aka_sim_session->keys, &src) != 0) {
                REDEBUG("Failed retrieving UMTS vectors");
                goto failure;
        }
@@ -1544,11 +1544,11 @@ static unlang_action_t sim_challenge_request_compose(rlm_rcode_t *p_result, modu
        }
 
        RDEBUG2("Acquiring GSM vector(s)");
-       if ((fr_aka_sim_vector_gsm_from_attrs(request, request->control_pairs, 0,
+       if ((fr_aka_sim_vector_gsm_from_attrs(request, &request->control_pairs, 0,
                                              &eap_aka_sim_session->keys, &src) != 0) ||
-           (fr_aka_sim_vector_gsm_from_attrs(request, request->control_pairs, 1,
+           (fr_aka_sim_vector_gsm_from_attrs(request, &request->control_pairs, 1,
                                              &eap_aka_sim_session->keys, &src) != 0) ||
-           (fr_aka_sim_vector_gsm_from_attrs(request, request->control_pairs, 2,
+           (fr_aka_sim_vector_gsm_from_attrs(request, &request->control_pairs, 2,
                                              &eap_aka_sim_session->keys, &src) != 0)) {
                REDEBUG("Failed retrieving SIM vectors");
                RETURN_MODULE_FAIL;
@@ -2927,7 +2927,7 @@ static unlang_action_t aka_identity_response_process(rlm_rcode_t *p_result, modu
  * Also checks the version matches one of the ones we advertised in our version list,
  * which is a bit redundant seeing as there's only one version of EAP-SIM.
  */
-static int sim_start_selected_version_check(request_t *request, fr_pair_t *from_peer,
+static int sim_start_selected_version_check(request_t *request, fr_pair_list_t *from_peer,
                                            eap_aka_sim_session_t *eap_aka_sim_session)
 {
        fr_pair_t               *selected_version_vp;
@@ -2935,7 +2935,7 @@ static int sim_start_selected_version_check(request_t *request, fr_pair_t *from_
        /*
         *      Check that we got an AT_SELECTED_VERSION
         */
-       selected_version_vp = fr_pair_find_by_da(&from_peer, attr_eap_aka_sim_selected_version);
+       selected_version_vp = fr_pair_find_by_da(from_peer, attr_eap_aka_sim_selected_version);
        if (!selected_version_vp) {
                REDEBUG("EAP-Response/SIM/Start does not contain AT_SELECTED_VERSION");
                return -1;
@@ -2981,7 +2981,7 @@ static int sim_start_selected_version_check(request_t *request, fr_pair_t *from_
  *
  * Does not actually perform cryptographic validation of AT_NONCE_MT, this is done later.
  */
-static int sim_start_nonce_mt_check(request_t *request, fr_pair_t *from_peer,
+static int sim_start_nonce_mt_check(request_t *request, fr_pair_list_t *from_peer,
                                    eap_aka_sim_session_t *eap_aka_sim_session)
 {
        fr_pair_t       *nonce_mt_vp;
@@ -2989,7 +2989,7 @@ static int sim_start_nonce_mt_check(request_t *request, fr_pair_t *from_peer,
        /*
         *      Copy nonce_mt to the keying material
         */
-       nonce_mt_vp = fr_pair_find_by_da(&from_peer, attr_eap_aka_sim_nonce_mt);
+       nonce_mt_vp = fr_pair_find_by_da(from_peer, attr_eap_aka_sim_nonce_mt);
        if (!nonce_mt_vp) {
                REDEBUG("EAP-Response/SIM/Start does not contain AT_NONCE_MT");
                return -1;
@@ -3103,8 +3103,8 @@ static unlang_action_t sim_start_response_process(rlm_rcode_t *p_result, module_
         *      if pseudonym resolution went ok.
         */
        case FR_IDENTITY_TYPE_VALUE_PSEUDONYM:
-               if (sim_start_selected_version_check(request, *from_peer, eap_aka_sim_session) < 0) goto failure;
-               if (sim_start_nonce_mt_check(request, *from_peer, eap_aka_sim_session) < 0) goto failure;
+               if (sim_start_selected_version_check(request, from_peer, eap_aka_sim_session) < 0) goto failure;
+               if (sim_start_nonce_mt_check(request, from_peer, eap_aka_sim_session) < 0) goto failure;
 
                return unlang_module_yield_to_section(p_result,
                                                      request,
@@ -3121,8 +3121,8 @@ static unlang_action_t sim_start_response_process(rlm_rcode_t *p_result, module_
         *      later.
         */
        case FR_IDENTITY_TYPE_VALUE_PERMANENT:
-               if (sim_start_selected_version_check(request, *from_peer, eap_aka_sim_session) < 0) goto failure;
-               if (sim_start_nonce_mt_check(request, *from_peer, eap_aka_sim_session) < 0) goto failure;
+               if (sim_start_selected_version_check(request, from_peer, eap_aka_sim_session) < 0) goto failure;
+               if (sim_start_nonce_mt_check(request, from_peer, eap_aka_sim_session) < 0) goto failure;
 
                FALL_THROUGH;
        default:
@@ -3344,7 +3344,7 @@ static unlang_action_t common_reauthentication_response_recv_resume(rlm_rcode_t
  *
  * This is called by the state_* functions to decode the peer's response.
  */
-static unlang_action_t common_decode(fr_pair_t **subtype_vp, fr_pair_t **vps,
+static unlang_action_t common_decode(fr_pair_t **subtype_vp, fr_pair_list_t *vps,
                                     rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
 {
        eap_session_t           *eap_session = eap_session_get(request->parent);
@@ -3383,7 +3383,7 @@ static unlang_action_t common_decode(fr_pair_t **subtype_vp, fr_pair_t **vps,
        aka_vps = fr_cursor_next(&cursor);
        if (aka_vps && RDEBUG_ENABLED2) {
                RDEBUG2("Decoded attributes");
-               log_request_pair_list(L_DBG_LVL_2, request, NULL, aka_vps, NULL);
+               log_request_pair_list(L_DBG_LVL_2, request, NULL, &aka_vps, NULL);
        }
 
        *subtype_vp = fr_pair_find_by_da(&aka_vps, attr_eap_aka_sim_subtype);
@@ -3532,7 +3532,7 @@ static unlang_action_t common_reauthentication(rlm_rcode_t *p_result, module_ctx
         *      Case 1 where we're allowed to send an EAP-Failure
         */
        case FR_SUBTYPE_VALUE_AKA_SIM_CLIENT_ERROR:
-               client_error_debug(request, from_peer);
+               client_error_debug(request, &from_peer);
 
                eap_aka_sim_session->allow_encrypted = false;
 
@@ -3663,7 +3663,7 @@ static unlang_action_t aka_challenge(rlm_rcode_t *p_result, module_ctx_t const *
         *      Case 1 where we're allowed to send an EAP-Failure
         */
        case FR_SUBTYPE_VALUE_AKA_SIM_CLIENT_ERROR:
-               client_error_debug(request, from_peer);
+               client_error_debug(request, &from_peer);
 
                eap_aka_sim_session->allow_encrypted = false;
 
@@ -3728,7 +3728,7 @@ static unlang_action_t sim_challenge(rlm_rcode_t *p_result, module_ctx_t const *
         *      Case 1 where we're allowed to send an EAP-Failure
         */
        case FR_SUBTYPE_VALUE_AKA_SIM_CLIENT_ERROR:
-               client_error_debug(request, from_peer);
+               client_error_debug(request, &from_peer);
 
                eap_aka_sim_session->allow_encrypted = false;
 
@@ -3844,7 +3844,7 @@ static unlang_action_t aka_identity(rlm_rcode_t *p_result, module_ctx_t const *m
         *      identity.
         */
        case FR_SUBTYPE_VALUE_AKA_SIM_CLIENT_ERROR:
-               client_error_debug(request, from_peer);
+               client_error_debug(request, &from_peer);
 
                return unlang_module_yield_to_section(p_result,
                                                      request,
@@ -3953,7 +3953,7 @@ static unlang_action_t sim_start(rlm_rcode_t *p_result, module_ctx_t const *mctx
         *      identity.
         */
        case FR_SUBTYPE_VALUE_AKA_SIM_CLIENT_ERROR:
-               client_error_debug(request, from_peer);
+               client_error_debug(request, &from_peer);
 
                return unlang_module_yield_to_section(p_result,
                                                      request,
index ceb4a9356100ab9fb71aa79300217c0d1ed72ca8..1bb664a2022d8171a53f01a4128dfe83ad4e3fdd 100644 (file)
@@ -40,12 +40,12 @@ RCSID("$Id$")
 #include <freeradius-devel/util/debug.h>
 
 static int vector_opc_from_op(request_t *request, uint8_t const **out, uint8_t opc_buff[MILENAGE_OPC_SIZE],
-                             fr_pair_t *list, uint8_t const ki[MILENAGE_KI_SIZE])
+                             fr_pair_list_t *list, uint8_t const ki[MILENAGE_KI_SIZE])
 {
        fr_pair_t       *opc_vp;
        fr_pair_t       *op_vp;
 
-       opc_vp = fr_pair_find_by_da(&list, attr_sim_opc);
+       opc_vp = fr_pair_find_by_da(list, attr_sim_opc);
        if (opc_vp) {
                if (opc_vp->vp_length != MILENAGE_OPC_SIZE) {
                        REDEBUG("&control.%s has incorrect length, expected %u bytes got %zu bytes",
@@ -56,7 +56,7 @@ static int vector_opc_from_op(request_t *request, uint8_t const **out, uint8_t o
                return 0;
        }
 
-       op_vp = fr_pair_find_by_da(&list, attr_sim_op);
+       op_vp = fr_pair_find_by_da(list, attr_sim_op);
        if (op_vp) {
                if (op_vp->vp_length != MILENAGE_OP_SIZE) {
                        REDEBUG("&control.%s has incorrect length, expected %u bytes got %zu bytes",
@@ -75,7 +75,7 @@ static int vector_opc_from_op(request_t *request, uint8_t const **out, uint8_t o
        return 1;
 }
 
-static int vector_gsm_from_ki(request_t *request, fr_pair_t *vps, int idx, fr_aka_sim_keys_t *keys)
+static int vector_gsm_from_ki(request_t *request, fr_pair_list_t *vps, int idx, fr_aka_sim_keys_t *keys)
 {
        fr_pair_t       *ki_vp, *version_vp;
        uint8_t         opc_buff[MILENAGE_OPC_SIZE];
@@ -86,7 +86,7 @@ static int vector_gsm_from_ki(request_t *request, fr_pair_t *vps, int idx, fr_ak
        /*
         *      Generate a new RAND value, and derive Kc and SRES from Ki
         */
-       ki_vp = fr_pair_find_by_da(&vps, attr_sim_ki);
+       ki_vp = fr_pair_find_by_da(vps, attr_sim_ki);
        if (!ki_vp) {
                RDEBUG3("No &control.%sfound, not generating triplets locally", attr_sim_ki->name);
                return 1;
@@ -100,7 +100,7 @@ static int vector_gsm_from_ki(request_t *request, fr_pair_t *vps, int idx, fr_ak
         *      Check to see if we have a Ki for the IMSI, this allows us to generate the rest
         *      of the triplets.
         */
-       version_vp = fr_pair_find_by_da(&vps, attr_sim_algo_version);
+       version_vp = fr_pair_find_by_da(vps, attr_sim_algo_version);
        if (!version_vp) {
                if (vector_opc_from_op(request, &opc_p, opc_buff, vps, ki_vp->vp_octets) < 0) return -1;
                version = opc_p ? FR_SIM_ALGO_VERSION_VALUE_COMP128_4 : FR_SIM_ALGO_VERSION_VALUE_COMP128_3;
@@ -173,14 +173,14 @@ static int vector_gsm_from_ki(request_t *request, fr_pair_t *vps, int idx, fr_ak
        return 0;
 }
 
-static int vector_gsm_from_triplets(request_t *request, fr_pair_t *vps,
+static int vector_gsm_from_triplets(request_t *request, fr_pair_list_t *vps,
                                    int idx, fr_aka_sim_keys_t *keys)
 {
        fr_pair_t       *rand = NULL, *sres = NULL, *kc = NULL;
        fr_cursor_t     cursor;
        int             i;
 
-       for (i = 0, (kc = fr_cursor_iter_by_da_init(&cursor, &vps, attr_eap_aka_sim_kc));
+       for (i = 0, (kc = fr_cursor_iter_by_da_init(&cursor, vps, attr_eap_aka_sim_kc));
             (i < idx) && (kc = fr_cursor_next(&cursor));
             i++);
        if (!kc) {
@@ -194,7 +194,7 @@ static int vector_gsm_from_triplets(request_t *request, fr_pair_t *vps,
                return -1;
        }
 
-       for (i = 0, (rand = fr_cursor_iter_by_da_init(&cursor, &vps, attr_eap_aka_sim_rand));
+       for (i = 0, (rand = fr_cursor_iter_by_da_init(&cursor, vps, attr_eap_aka_sim_rand));
             (i < idx) && (rand = fr_cursor_next(&cursor));
             i++);
        if (!rand) {
@@ -208,7 +208,7 @@ static int vector_gsm_from_triplets(request_t *request, fr_pair_t *vps,
                return -1;
        }
 
-       for (i = 0, (sres = fr_cursor_iter_by_da_init(&cursor, &vps, attr_eap_aka_sim_sres));
+       for (i = 0, (sres = fr_cursor_iter_by_da_init(&cursor, vps, attr_eap_aka_sim_sres));
             (i < idx) && (sres = fr_cursor_next(&cursor));
             i++);
        if (!sres) {
@@ -233,7 +233,7 @@ static int vector_gsm_from_triplets(request_t *request, fr_pair_t *vps,
 /** Derive triplets from quintuplets
  *
  */
-static int vector_gsm_from_quintuplets(request_t *request, fr_pair_t *vps,
+static int vector_gsm_from_quintuplets(request_t *request, fr_pair_list_t *vps,
                                       int idx, fr_aka_sim_keys_t *keys)
 {
        fr_cursor_t     cursor;
@@ -245,7 +245,7 @@ static int vector_gsm_from_quintuplets(request_t *request, fr_pair_t *vps,
        /*
         *      Fetch CK
         */
-       for (i = 0, (ck = fr_cursor_iter_by_da_init(&cursor, &vps, attr_eap_aka_sim_ck));
+       for (i = 0, (ck = fr_cursor_iter_by_da_init(&cursor, vps, attr_eap_aka_sim_ck));
             (i < idx) && (ck = fr_cursor_next(&cursor));
             i++);
        if (!ck) {
@@ -257,7 +257,7 @@ static int vector_gsm_from_quintuplets(request_t *request, fr_pair_t *vps,
        /*
         *      Fetch IK
         */
-       for (i = 0, (ik = fr_cursor_iter_by_da_init(&cursor, &vps, attr_eap_aka_sim_ik));
+       for (i = 0, (ik = fr_cursor_iter_by_da_init(&cursor, vps, attr_eap_aka_sim_ik));
             (i < idx) && (ik = fr_cursor_next(&cursor));
             i++);
        if (!ik) {
@@ -269,7 +269,7 @@ static int vector_gsm_from_quintuplets(request_t *request, fr_pair_t *vps,
        /*
         *      Fetch RAND
         */
-       for (i = 0, (rand = fr_cursor_iter_by_da_init(&cursor, &vps, attr_eap_aka_sim_rand));
+       for (i = 0, (rand = fr_cursor_iter_by_da_init(&cursor, vps, attr_eap_aka_sim_rand));
             (i < idx) && (rand = fr_cursor_next(&cursor));
             i++);
        if (!rand) {
@@ -288,7 +288,7 @@ static int vector_gsm_from_quintuplets(request_t *request, fr_pair_t *vps,
        /*
         *      Fetch XRES
         */
-       for (i = 0, (xres = fr_cursor_iter_by_da_init(&cursor, &vps, attr_eap_aka_sim_xres));
+       for (i = 0, (xres = fr_cursor_iter_by_da_init(&cursor, vps, attr_eap_aka_sim_xres));
             (i < idx) && (xres = fr_cursor_next(&cursor));
             i++);
        if (!xres) {
@@ -326,7 +326,7 @@ static int vector_gsm_from_quintuplets(request_t *request, fr_pair_t *vps,
  *     - 0     Vector was retrieved OK and written to the specified index.
  *     - -1    Error retrieving vector from the specified src.
  */
-int fr_aka_sim_vector_gsm_from_attrs(request_t *request, fr_pair_t *vps,
+int fr_aka_sim_vector_gsm_from_attrs(request_t *request, fr_pair_list_t *vps,
                                     int idx, fr_aka_sim_keys_t *keys, fr_aka_sim_vector_src_t *src)
 {
        int             ret;
@@ -392,7 +392,7 @@ int fr_aka_sim_vector_gsm_from_attrs(request_t *request, fr_pair_t *vps,
        return 0;
 }
 
-static int vector_umts_from_ki(request_t *request, fr_pair_t *vps, fr_aka_sim_keys_t *keys)
+static int vector_umts_from_ki(request_t *request, fr_pair_list_t *vps, fr_aka_sim_keys_t *keys)
 {
        fr_pair_t       *ki_vp, *amf_vp, *sqn_vp, *version_vp;
 
@@ -403,7 +403,7 @@ static int vector_umts_from_ki(request_t *request, fr_pair_t *vps, fr_aka_sim_ke
        /*
         *      Select the algorithm (default to Milenage)
         */
-       version_vp = fr_pair_find_by_da(&vps, attr_sim_algo_version);
+       version_vp = fr_pair_find_by_da(vps, attr_sim_algo_version);
        if (version_vp) version = version_vp->vp_uint32;
 
        /*
@@ -438,7 +438,7 @@ static int vector_umts_from_ki(request_t *request, fr_pair_t *vps, fr_aka_sim_ke
        /*
         *      Find the Ki VP and check its length
         */
-       ki_vp = fr_pair_find_by_da(&vps, attr_sim_ki);
+       ki_vp = fr_pair_find_by_da(vps, attr_sim_ki);
        if (!ki_vp) {
                RDEBUG3("No &control.%s found, not generating quintuplets locally", attr_sim_ki->name);
                return 1;
@@ -451,13 +451,13 @@ static int vector_umts_from_ki(request_t *request, fr_pair_t *vps, fr_aka_sim_ke
        /*
         *      Find the Sequence Number VP or default to SQN = 2
         */
-       sqn_vp = fr_pair_find_by_da(&vps, attr_sim_sqn);
+       sqn_vp = fr_pair_find_by_da(vps, attr_sim_sqn);
        keys->sqn = sqn_vp ? sqn_vp->vp_uint64 : 2;     /* 2 is the lowest valid SQN on our side */
 
        /*
         *      Check if we have an AMF value
         */
-       amf_vp = fr_pair_find_by_da(&vps, attr_sim_amf);
+       amf_vp = fr_pair_find_by_da(vps, attr_sim_amf);
        if (amf_vp) {
                if (amf_vp->vp_length != amf_size) {
                        REDEBUG("&control.%s has incorrect length, expected %zu bytes got %zu bytes",
@@ -589,7 +589,7 @@ static int vector_umts_from_ki(request_t *request, fr_pair_t *vps, fr_aka_sim_ke
 /** Get one set of quintuplets from the request
  *
  */
-static int vector_umts_from_quintuplets(request_t *request, fr_pair_t *vps, fr_aka_sim_keys_t *keys)
+static int vector_umts_from_quintuplets(request_t *request, fr_pair_list_t *vps, fr_aka_sim_keys_t *keys)
 {
        fr_pair_t       *rand_vp = NULL, *xres_vp = NULL, *ck_vp = NULL, *ik_vp = NULL;
        fr_pair_t       *autn_vp = NULL, *sqn_vp = NULL, *ak_vp = NULL;
@@ -597,7 +597,7 @@ static int vector_umts_from_quintuplets(request_t *request, fr_pair_t *vps, fr_a
        /*
         *      Fetch AUTN
         */
-       autn_vp = fr_pair_find_by_da(&vps, attr_eap_aka_sim_autn);
+       autn_vp = fr_pair_find_by_da(vps, attr_eap_aka_sim_autn);
        if (!autn_vp) {
                RDEBUG3("No &control.%s attribute found, not using UMTS quintuplets", attr_eap_aka_sim_autn->name);
                return 1;
@@ -613,7 +613,7 @@ static int vector_umts_from_quintuplets(request_t *request, fr_pair_t *vps, fr_a
        /*
         *      Fetch CK
         */
-       ck_vp = fr_pair_find_by_da(&vps, attr_eap_aka_sim_ck);
+       ck_vp = fr_pair_find_by_da(vps, attr_eap_aka_sim_ck);
        if (!ck_vp) {
                RDEBUG3("No &control.%s attribute found, not using UMTS quintuplets", attr_eap_aka_sim_ck->name);
                return 1;
@@ -629,7 +629,7 @@ static int vector_umts_from_quintuplets(request_t *request, fr_pair_t *vps, fr_a
        /*
         *      Fetch IK
         */
-       ik_vp = fr_pair_find_by_da(&vps, attr_eap_aka_sim_ik);
+       ik_vp = fr_pair_find_by_da(vps, attr_eap_aka_sim_ik);
        if (!ik_vp) {
                RDEBUG3("No &control.%s attribute found, not using UMTS quintuplets", attr_eap_aka_sim_ik->name);
                return 1;
@@ -645,7 +645,7 @@ static int vector_umts_from_quintuplets(request_t *request, fr_pair_t *vps, fr_a
        /*
         *      Fetch RAND
         */
-       rand_vp = fr_pair_find_by_da(&vps, attr_eap_aka_sim_rand);
+       rand_vp = fr_pair_find_by_da(vps, attr_eap_aka_sim_rand);
        if (!rand_vp) {
                RDEBUG3("No &control.%s attribute found, not using quintuplet derivation", attr_eap_aka_sim_rand->name);
                return 1;
@@ -660,7 +660,7 @@ static int vector_umts_from_quintuplets(request_t *request, fr_pair_t *vps, fr_a
        /*
         *      Fetch XRES
         */
-       xres_vp = fr_pair_find_by_da(&vps, attr_eap_aka_sim_xres);
+       xres_vp = fr_pair_find_by_da(vps, attr_eap_aka_sim_xres);
        if (!xres_vp) {
                RDEBUG3("No &control.%s attribute found, not using UMTS quintuplets", attr_eap_aka_sim_xres->name);
                return 1;
@@ -676,7 +676,7 @@ static int vector_umts_from_quintuplets(request_t *request, fr_pair_t *vps, fr_a
        /*
         *      Fetch (optional) AK
         */
-       ak_vp = fr_pair_find_by_da(&vps, attr_eap_aka_sim_ak);
+       ak_vp = fr_pair_find_by_da(vps, attr_eap_aka_sim_ak);
        if (ak_vp && (ak_vp->vp_length != MILENAGE_AK_SIZE)) {
                REDEBUG("&control.%s incorrect length.  Expected "
                        STRINGIFY(MILENAGE_AK_SIZE) " bytes, got %zu bytes",
@@ -687,7 +687,7 @@ static int vector_umts_from_quintuplets(request_t *request, fr_pair_t *vps, fr_a
        /*
         *      Fetch (optional) SQN
         */
-       sqn_vp = fr_pair_find_by_da(&vps, attr_sim_sqn);
+       sqn_vp = fr_pair_find_by_da(vps, attr_sim_sqn);
        if (sqn_vp && (sqn_vp->vp_length != MILENAGE_SQN_SIZE)) {
                REDEBUG("&control.%s incorrect length.  Expected "
                        STRINGIFY(MILENAGE_AK_SIZE) " bytes, got %zu bytes",
@@ -751,7 +751,7 @@ static int vector_umts_from_quintuplets(request_t *request, fr_pair_t *vps, fr_a
  *     - 0     Vector was retrieved OK and written to the specified index.
  *     - -1    Error retrieving vector from the specified src.
  */
-int fr_aka_sim_vector_umts_from_attrs(request_t *request, fr_pair_t *vps,
+int fr_aka_sim_vector_umts_from_attrs(request_t *request, fr_pair_list_t *vps,
                                      fr_aka_sim_keys_t *keys, fr_aka_sim_vector_src_t *src)
 {
        int             ret;
@@ -820,7 +820,7 @@ int fr_aka_sim_vector_umts_from_attrs(request_t *request, fr_pair_t *vps,
  *     - 0 on success.
  *     - -1 on validation failure.
  */
-int fr_aka_sim_vector_gsm_umts_kdf_0_reauth_from_attrs(request_t *request, fr_pair_t *vps, fr_aka_sim_keys_t *keys)
+int fr_aka_sim_vector_gsm_umts_kdf_0_reauth_from_attrs(request_t *request, fr_pair_list_t *vps, fr_aka_sim_keys_t *keys)
 {
        fr_pair_t *counter_vp;
        fr_pair_t *mk_vp;
@@ -829,7 +829,7 @@ int fr_aka_sim_vector_gsm_umts_kdf_0_reauth_from_attrs(request_t *request, fr_pa
         *      This is the *old* counter value increment
         *      by 1 to get the *new* counter value
         */
-       counter_vp = fr_pair_find_by_da(&vps, attr_eap_aka_sim_counter);
+       counter_vp = fr_pair_find_by_da(vps, attr_eap_aka_sim_counter);
        if (!counter_vp) {
                RDEBUG2("No &session-state.%s attribute found, can't calculate re-auth keys",
                        attr_eap_aka_sim_counter->name);
@@ -837,8 +837,8 @@ int fr_aka_sim_vector_gsm_umts_kdf_0_reauth_from_attrs(request_t *request, fr_pa
        }
        counter_vp->vp_uint16++;
 
-       mk_vp = fr_pair_find_by_da(&vps, attr_session_data);
-       if (!mk_vp) mk_vp = fr_pair_find_by_da(&vps, attr_eap_aka_sim_mk);
+       mk_vp = fr_pair_find_by_da(vps, attr_session_data);
+       if (!mk_vp) mk_vp = fr_pair_find_by_da(vps, attr_eap_aka_sim_mk);
        if (!mk_vp) {
                RDEBUG2("Neither &session-state.%s or &session-state.%s attributes found, "
                        "can't calculate re-auth keys", attr_session_data->name, attr_eap_aka_sim_mk->name);
@@ -870,7 +870,7 @@ int fr_aka_sim_vector_gsm_umts_kdf_0_reauth_from_attrs(request_t *request, fr_pa
  *     - 0 on success.
  *     - -1 on validation failure.
  */
-int fr_aka_sim_vector_umts_kdf_1_reauth_from_attrs(request_t *request, fr_pair_t *vps, fr_aka_sim_keys_t *keys)
+int fr_aka_sim_vector_umts_kdf_1_reauth_from_attrs(request_t *request, fr_pair_list_t *vps, fr_aka_sim_keys_t *keys)
 {
        fr_pair_t *counter_vp;
        fr_pair_t *k_re_vp;
@@ -879,7 +879,7 @@ int fr_aka_sim_vector_umts_kdf_1_reauth_from_attrs(request_t *request, fr_pair_t
         *      This is the *old* counter value increment
         *      by 1 to get the *new* counter value
         */
-       counter_vp = fr_pair_find_by_da(&vps, attr_eap_aka_sim_counter);
+       counter_vp = fr_pair_find_by_da(vps, attr_eap_aka_sim_counter);
        if (!counter_vp) {
                RDEBUG2("No &session-state.%s attribute found, can't calculate re-auth keys",
                        attr_eap_aka_sim_counter->name);
@@ -887,8 +887,8 @@ int fr_aka_sim_vector_umts_kdf_1_reauth_from_attrs(request_t *request, fr_pair_t
        }
        counter_vp->vp_uint16++;
 
-       k_re_vp = fr_pair_find_by_da(&vps, attr_session_data);
-       if (!k_re_vp) k_re_vp = fr_pair_find_by_da(&vps, attr_eap_aka_sim_k_re);
+       k_re_vp = fr_pair_find_by_da(vps, attr_session_data);
+       if (!k_re_vp) k_re_vp = fr_pair_find_by_da(vps, attr_eap_aka_sim_k_re);
        if (!k_re_vp) {
                RDEBUG2("Neither &session-state.%s or &session-sate:%s attributes found, "
                        "can't calculate re-auth keys", attr_session_data->name, attr_eap_aka_sim_k_re->name);
index 8edbd8278c9dd8bd7496870a77119431d8a46d9b..bc7959615f79fe802fa0bb9fff34a585779f4a02 100644 (file)
@@ -56,7 +56,7 @@ typedef ssize_t (*fr_tp_proto_decode_t)(TALLOC_CTX *ctx, fr_pair_list_t *list,
  *     - <= 0 on error.  May be the offset (as a negative value) where the error occurred.
  *     - > 0 on success.  How many bytes were encoded
  */
-typedef ssize_t (*fr_tp_proto_encode_t)(TALLOC_CTX *ctx, fr_pair_t *vps,
+typedef ssize_t (*fr_tp_proto_encode_t)(TALLOC_CTX *ctx, fr_pair_list_t *vps,
                                        uint8_t *data, size_t data_len, void *encoder_ctx);
 
 /** Entry point for protocol decoders
index a01f595f0ba759cb51bc12d70e2de7cb7b00638e..f2af3e1135ea7684af2afe53cba8d3eb23816bb9 100644 (file)
@@ -255,7 +255,7 @@ size_t      fr_json_from_pair(char *out, size_t outlen, fr_pair_t const *vp);
 
 void           fr_json_version_print(void);
 
-char           *fr_json_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_t *vps,
+char           *fr_json_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_list_t *vps,
                                         fr_json_format_t const *format);
 
 bool           fr_json_format_verify(fr_json_format_t const *format, bool verbose);
index 71d6d17d1cb79625cfc7845b54d4a806cfd2d147..f83ce5b239775eae98a78c81aa92088e7f8e1554 100644 (file)
@@ -511,7 +511,7 @@ bool fr_json_format_verify(fr_json_format_t const *format, bool verbose)
  * @param[in] format   Formatting control, must be set.
  * @return JSON object with the generated representation.
  */
-static json_object *json_object_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_t *vps,
+static json_object *json_object_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_list_t *vps,
                                                fr_json_format_t const *format)
 {
        fr_cursor_t             cursor;
@@ -525,7 +525,7 @@ static json_object *json_object_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_t *vps,
 
        MEM(obj = json_object_new_object());
 
-       for (vp = fr_cursor_init(&cursor, &vps);
+       for (vp = fr_cursor_init(&cursor, vps);
             vp;
             vp = fr_cursor_next(&cursor)) {
                char const              *attr_name;
@@ -630,7 +630,7 @@ static json_object *json_object_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_t *vps,
  * @param[in] format   Formatting control, must be set.
  * @return JSON object with the generated representation.
  */
-static json_object *json_smplobj_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_t *vps,
+static json_object *json_smplobj_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_list_t *vps,
                                                 fr_json_format_t const *format)
 {
        fr_cursor_t             cursor;
@@ -645,7 +645,7 @@ static json_object *json_smplobj_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_t *vps
 
        MEM(obj = json_object_new_object());
 
-       for (vp = fr_cursor_init(&cursor, &vps);
+       for (vp = fr_cursor_init(&cursor, vps);
             vp;
             vp = fr_cursor_next(&cursor)) {
                char const              *attr_name;
@@ -734,7 +734,7 @@ static json_object *json_smplobj_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_t *vps
  * @param[in] format   Formatting control, must be set.
  * @return JSON object with the generated representation.
  */
-static struct json_object *json_array_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_t *vps,
+static struct json_object *json_array_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_list_t *vps,
                                                      fr_json_format_t const *format)
 {
        fr_cursor_t             cursor;
@@ -757,7 +757,7 @@ static struct json_object *json_array_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_t
                seen_attributes = json_object_new_object();
        }
 
-       for (vp = fr_cursor_init(&cursor, &vps);
+       for (vp = fr_cursor_init(&cursor, vps);
             vp;
             vp = fr_cursor_next(&cursor)) {
                char const              *attr_name;
@@ -865,7 +865,7 @@ static struct json_object *json_array_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_t
  * @param[in] format   Formatting control, must be set.
  * @return JSON object with the generated representation.
  */
-static struct json_object *json_value_array_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_t *vps,
+static struct json_object *json_value_array_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_list_t *vps,
                                                            fr_json_format_t const *format)
 {
        fr_cursor_t             cursor;
@@ -882,7 +882,7 @@ static struct json_object *json_value_array_afrom_pair_list(TALLOC_CTX *ctx, fr_
         *      This array format is very simple - just add all the
         *      attribute values to the array in order.
         */
-       for (vp = fr_cursor_init(&cursor, &vps);
+       for (vp = fr_cursor_init(&cursor, vps);
             vp;
             vp = fr_cursor_next(&cursor)) {
                struct json_object      *value;
@@ -915,7 +915,7 @@ static struct json_object *json_value_array_afrom_pair_list(TALLOC_CTX *ctx, fr_
  * @param[in] format   Formatting control, must be set.
  * @return JSON object with the generated representation.
  */
-static struct json_object *json_attr_array_afrom_pair_list(UNUSED TALLOC_CTX *ctx, fr_pair_t *vps,
+static struct json_object *json_attr_array_afrom_pair_list(UNUSED TALLOC_CTX *ctx, fr_pair_list_t *vps,
                                                           fr_json_format_t const *format)
 {
        fr_cursor_t             cursor;
@@ -932,7 +932,7 @@ static struct json_object *json_attr_array_afrom_pair_list(UNUSED TALLOC_CTX *ct
        /*
         *      Add all the attribute names to the array in order.
         */
-       for (vp = fr_cursor_init(&cursor, &vps);
+       for (vp = fr_cursor_init(&cursor, vps);
             vp;
             vp = fr_cursor_next(&cursor)) {
                char const              *attr_name;
@@ -980,7 +980,7 @@ static struct json_object *json_attr_array_afrom_pair_list(UNUSED TALLOC_CTX *ct
  * @param[in] format   Formatting control, can be NULL to use default format.
  * @return JSON string representation of the value pairs
  */
-char *fr_json_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_t *vps,
+char *fr_json_afrom_pair_list(TALLOC_CTX *ctx, fr_pair_list_t *vps,
                              fr_json_format_t const *format)
 {
        struct json_object      *obj = NULL;
index d5a2ebe4f5e3aeb7880e20635107ae09c53041ac..b3c6c3e741f5333ef3da965575e34696f14bf279 100644 (file)
@@ -470,7 +470,7 @@ char const  *fr_ldap_edir_errstr(int code);
 /*
  *     map.c - Attribute mapping code.
  */
-int            fr_ldap_map_getvalue(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request,
+int            fr_ldap_map_getvalue(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request,
                                     map_t const *map, void *uctx);
 
 int            fr_ldap_map_verify(map_t *map, void *instance);
index bde075414f8ab1123dd974d44e95723d982b4c08..edce97d261154bad81a8fa05bd09a27b3a2e1596 100644 (file)
@@ -36,7 +36,7 @@ USES_APPLE_DEPRECATED_API
  *
  * @see map_to_vp
  */
-int fr_ldap_map_getvalue(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, map_t const *map, void *uctx)
+int fr_ldap_map_getvalue(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, map_t const *map, void *uctx)
 {
        fr_ldap_result_t        *self = uctx;
        fr_pair_list_t          head;
index 4da64bb091fbccf5ac4d21f4977c4a1c7e8f4aef..1d81e587065edea74ea2bc720c43db61a2d7f204 100644 (file)
@@ -328,6 +328,7 @@ static void _cluster_node_conf_apply(fr_pool_t *pool, void *opaque)
        fr_pair_list_t  args;
        fr_redis_cluster_node_t *node = opaque;
 
+       fr_pair_list_init(&args);
        node->addr = node->pending_addr;
 
        if (node->cluster->triggers_enabled) {
@@ -337,7 +338,7 @@ static void _cluster_node_conf_apply(fr_pool_t *pool, void *opaque)
                if (node->cluster->trigger_args) MEM(fr_pair_list_copy(node->cluster, &args,
                                                                      &node->cluster->trigger_args) >= 0);
 
-               fr_pool_enable_triggers(pool, node->cluster->trigger_prefix, args);
+               fr_pool_enable_triggers(pool, node->cluster->trigger_prefix, &args);
 
                fr_pair_list_free(&args);
        }
@@ -375,6 +376,7 @@ static fr_redis_cluster_rcode_t cluster_node_connect(fr_redis_cluster_t *cluster
                fr_pair_list_t  args;
                CONF_SECTION    *pool;
 
+               fr_pair_list_init(&args);
                snprintf(buffer, sizeof(buffer), "%s [%i]", cluster->log_prefix, node->id);
 
                pool = cf_section_find(cluster->module, "pool", NULL);
@@ -399,7 +401,7 @@ static fr_redis_cluster_rcode_t cluster_node_connect(fr_redis_cluster_t *cluster
 
                        if (cluster->trigger_args) MEM(fr_pair_list_copy(cluster, &args, &cluster->trigger_args) >= 0);
 
-                       fr_pool_enable_triggers(node->pool, node->cluster->trigger_prefix, args);
+                       fr_pool_enable_triggers(node->pool, node->cluster->trigger_prefix, &args);
 
                        fr_pair_list_free(&args);
                }
@@ -2252,7 +2254,7 @@ fr_redis_cluster_t *fr_redis_cluster_alloc(TALLOC_CTX *ctx,
                                           bool triggers_enabled,
                                           char const *log_prefix,
                                           char const *trigger_prefix,
-                                          fr_pair_t *trigger_args)
+                                          fr_pair_list_t *trigger_args)
 {
        uint8_t                 i;
        uint16_t                s;
@@ -2266,7 +2268,7 @@ fr_redis_cluster_t *fr_redis_cluster_alloc(TALLOC_CTX *ctx,
        fr_redis_cluster_t      *cluster;
 
        fr_assert(triggers_enabled || !trigger_prefix);
-       fr_assert(triggers_enabled || !trigger_args);
+       fr_assert(triggers_enabled || !*trigger_args);
 
        cluster = talloc_zero(NULL, fr_redis_cluster_t);
        if (!cluster) {
@@ -2292,7 +2294,7 @@ fr_redis_cluster_t *fr_redis_cluster_alloc(TALLOC_CTX *ctx,
                /*
                 *      Duplicate the trigger arguments.
                 */
-                if (trigger_args) MEM(fr_pair_list_copy(cluster, &cluster->trigger_args, &trigger_args) >= 0);
+                if (trigger_args) MEM(fr_pair_list_copy(cluster, &cluster->trigger_args, trigger_args) >= 0);
        }
 
        /*
index b30bcbcd4408e00189be2ea36cb734ae93926c78..f12bfb6237bdf9c97052c39cce9a31d962de3701 100644 (file)
@@ -134,7 +134,7 @@ fr_redis_cluster_t *fr_redis_cluster_alloc(TALLOC_CTX *ctx,
                                           bool enable_triggers,
                                           char const *log_prefix,
                                           char const *trigger_prefix,
-                                          fr_pair_t *trigger_args);
+                                          fr_pair_list_t *trigger_args);
 
 #ifdef __cplusplus
 }
index d50e90d27cfd97c2e1ba48697353c39245ecaf13..37a48580acacd42e106bb9ca6f83e64d1b21e743 100644 (file)
@@ -51,7 +51,7 @@ unlang_action_t rad_virtual_server(rlm_rcode_t *p_result, request_t *request)
        rlm_rcode_t final;
 
        RDEBUG("Virtual server %s received request", cf_section_name2(request->server_cs));
-       log_request_pair_list(L_DBG_LVL_1, request, NULL, request->request_pairs, NULL);
+       log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->request_pairs, NULL);
 
        username = fr_pair_find_by_num(&request->request_pairs, 0, FR_STRIPPED_USER_NAME);
        if (!username) username = fr_pair_find_by_num(&request->request_pairs, 0, FR_USER_NAME);
@@ -217,8 +217,8 @@ void common_packet_debug(request_t *request, fr_radius_packet_t *packet, bool re
                       packet->data_len);
 
        if (received) {
-               log_request_pair_list(L_DBG_LVL_1, request, NULL, request->request_pairs, NULL);
+               log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->request_pairs, NULL);
        } else {
-               log_request_proto_pair_list(L_DBG_LVL_1, request, NULL, request->request_pairs, NULL);
+               log_request_proto_pair_list(L_DBG_LVL_1, request, NULL, &request->request_pairs, NULL);
        }
 }
index 9f2a0c8fbcf1b3aeeabc597b7f984c1b8b28e18c..ae271ac6c6af43e2720abdb0287494921503e3d7 100644 (file)
@@ -333,7 +333,9 @@ static int cond_cmp_values(request_t *request, fr_cond_t const *c, fr_value_box_
         */
        if (c->pass2_fixup == PASS2_PAIRCOMPARE) {
                fr_pair_t *vp;
+               fr_pair_list_t vps;
 
+               fr_pair_list_init(&vps);
                EVAL_DEBUG("CMP WITH PAIRCOMPARE");
                fr_assert(tmpl_is_attr(map->lhs));
 
@@ -342,7 +344,8 @@ static int cond_cmp_values(request_t *request, fr_cond_t const *c, fr_value_box_
 
                fr_value_box_copy(vp, &vp->data, rhs);
 
-               rcode = paircmp(request, request->request_pairs, vp);
+               fr_pair_list_single_value(vps,*vp);
+               rcode = paircmp(request, &request->request_pairs, &vps);
                rcode = (rcode == 0) ? 1 : 0;
                talloc_free(vp);
                goto finish;
index a57971e93b5f239a473499b1a0682f0893691332..cb6bceaba189801f33168576fad58847c817a75d 100644 (file)
@@ -54,7 +54,7 @@ RCSID("$Id$")
 
 #define MAX_ARGV (256)
 
-static void fr_exec_pair_to_env(request_t *request, fr_pair_t *input_pairs, char **envp, size_t envlen, bool shell_escape)
+static void fr_exec_pair_to_env(request_t *request, fr_pair_list_t *input_pairs, char **envp, size_t envlen, bool shell_escape)
 {
        char                    *p;
        size_t                  i;
@@ -69,7 +69,7 @@ static void fr_exec_pair_to_env(request_t *request, fr_pair_t *input_pairs, char
         *      hold mutexes.  They might be locked when we fork,
         *      and will remain locked in the child.
         */
-       for (vp = fr_cursor_init(&cursor, &input_pairs), i = 0;
+       for (vp = fr_cursor_init(&cursor, input_pairs), i = 0;
             vp && (i < envlen - 1);
             vp = fr_cursor_next(&cursor)) {
                size_t n;
@@ -225,7 +225,7 @@ static NEVER_RETURNS void fr_exec_child(request_t *request, char **argv, char **
  */
 pid_t radius_start_program(char const *cmd, request_t *request, bool exec_wait,
                           int *input_fd, int *output_fd,
-                          fr_pair_t *input_pairs, bool shell_escape)
+                          fr_pair_list_t *input_pairs, bool shell_escape)
 {
        int             to_child[2] = {-1, -1};
        int             from_child[2] = {-1, -1};
@@ -463,8 +463,8 @@ int radius_readfrom_program(int fd, pid_t pid, fr_time_delta_t timeout,
  *     - exit code if exec_wait!=0.
  *     - -1 on failure.
  */
-int radius_exec_program(TALLOC_CTX *ctx, char *out, size_t outlen, fr_pair_t **output_pairs,
-                       request_t *request, char const *cmd, fr_pair_t *input_pairs,
+int radius_exec_program(TALLOC_CTX *ctx, char *out, size_t outlen, fr_pair_list_t *output_pairs,
+                       request_t *request, char const *cmd, fr_pair_list_t *input_pairs,
                        bool exec_wait, bool shell_escape, fr_time_delta_t timeout)
 
 {
@@ -607,7 +607,7 @@ wait:
  *  would allow finer-grained control over the attributes to put into
  *  the environment.
  */
-int fr_exec_nowait(request_t *request, fr_value_box_t *vb, fr_pair_t *env_pairs)
+int fr_exec_nowait(request_t *request, fr_value_box_t *vb, fr_pair_list_t *env_pairs)
 {
        int             argc;
        char            **envp;
@@ -628,7 +628,7 @@ int fr_exec_nowait(request_t *request, fr_value_box_t *vb, fr_pair_t *env_pairs)
        /*
         *      Get the environment variables.
         */
-       if (env_pairs) {
+       if (*env_pairs) {
                MEM(envp = talloc_zero_array(request, char *, MAX_ENVP));
                fr_exec_pair_to_env(request, env_pairs, envp, MAX_ENVP, true);
        } else {
@@ -700,7 +700,7 @@ int fr_exec_nowait(request_t *request, fr_value_box_t *vb, fr_pair_t *env_pairs)
  *  would allow finer-grained control over the attributes to put into
  *  the environment.
  */
-int fr_exec_wait_start(request_t *request, fr_value_box_t *vb, fr_pair_t *env_pairs, pid_t *pid_p, int *input_fd, int *output_fd)
+int fr_exec_wait_start(request_t *request, fr_value_box_t *vb, fr_pair_list_t *env_pairs, pid_t *pid_p, int *input_fd, int *output_fd)
 {
        int             argc;
        char            **envp;
index 987fc3103449ae2f1d35d41919e201a48f125ea1..331332cb713d9d3799e0d22bcf92b12811b1dc70 100644 (file)
@@ -48,18 +48,18 @@ extern "C" {
 #endif
 pid_t  radius_start_program(char const *cmd, request_t *request, bool exec_wait,
                             int *input_fd, int *output_fd,
-                            fr_pair_t *input_pairs, bool shell_escape);
+                            fr_pair_list_t *input_pairs, bool shell_escape);
 
 int    radius_readfrom_program(int fd, pid_t pid, fr_time_delta_t timeout,
                                char *answer, int left);
 
-int    radius_exec_program(TALLOC_CTX *ctx, char *out, size_t outlen, fr_pair_t **output_pairs,
-                           request_t *request, char const *cmd, fr_pair_t *input_pairs,
+int    radius_exec_program(TALLOC_CTX *ctx, char *out, size_t outlen, fr_pair_list_t *output_pairs,
+                           request_t *request, char const *cmd, fr_pair_list_t *input_pairs,
                            bool exec_wait, bool shell_escape, fr_time_delta_t timeout) CC_HINT(nonnull (5, 6));
 
-int    fr_exec_nowait(request_t *request, fr_value_box_t *vb, fr_pair_t *env_pairs);
+int    fr_exec_nowait(request_t *request, fr_value_box_t *vb, fr_pair_list_t *env_pairs);
 
-int    fr_exec_wait_start(request_t *request, fr_value_box_t *vb, fr_pair_t *env_pairs, pid_t *pid_p, int *input_fd, int *output_fd);
+int    fr_exec_wait_start(request_t *request, fr_value_box_t *vb, fr_pair_list_t *env_pairs, pid_t *pid_p, int *input_fd, int *output_fd);
 
 void   fr_exec_waitpid(pid_t pid);
 
index 921a1e095fb0ca6ba1b5fdba864c10947da3e6b5..2bbb225b7b1d664757dd517e2f762b1218708300 100644 (file)
@@ -73,6 +73,7 @@ static inline void exfile_trigger_exec(exfile_t *ef, request_t *request, exfile_
        fr_dict_attr_t const    *da;
        fr_cursor_t             cursor;
 
+       fr_pair_list_init(&args);
        fr_assert(ef != NULL);
        fr_assert(name_suffix != NULL);
 
@@ -84,7 +85,7 @@ static inline void exfile_trigger_exec(exfile_t *ef, request_t *request, exfile_
                return;
        }
 
-       args = ef->trigger_args;
+       fr_pair_list_copy(request, &args, &ef->trigger_args);
        fr_cursor_init(&cursor, &args);
 
        MEM(vp = fr_pair_afrom_da(NULL, da));
@@ -93,9 +94,9 @@ static inline void exfile_trigger_exec(exfile_t *ef, request_t *request, exfile_
        fr_cursor_prepend(&cursor, vp);
 
        snprintf(name, sizeof(name), "%s.%s", ef->trigger_prefix, name_suffix);
-       trigger_exec(request, ef->conf, name, false, args);
+       trigger_exec(request, ef->conf, name, false, &args);
 
-       talloc_free(vp);
+       fr_pair_list_free(&args);
 }
 
 
@@ -194,7 +195,7 @@ exfile_t *exfile_init(TALLOC_CTX *ctx, uint32_t max_entries, uint32_t max_idle,
  * @param[in] trigger_args to make available in any triggers executed by the exfile api.
  *     Exfile-File is automatically added to this list.
  */
-void exfile_enable_triggers(exfile_t *ef, CONF_SECTION *conf, char const *trigger_prefix, fr_pair_t *trigger_args)
+void exfile_enable_triggers(exfile_t *ef, CONF_SECTION *conf, char const *trigger_prefix, fr_pair_list_t *trigger_args)
 {
        talloc_const_free(ef->trigger_prefix);
        MEM(ef->trigger_prefix = trigger_prefix ? talloc_typed_strdup(ef, trigger_prefix) : "");
@@ -205,7 +206,7 @@ void exfile_enable_triggers(exfile_t *ef, CONF_SECTION *conf, char const *trigge
 
        if (!trigger_args) return;
 
-       (void) fr_pair_list_copy(ef, &ef->trigger_args, &trigger_args);
+       (void) fr_pair_list_copy(ef, &ef->trigger_args, trigger_args);
 }
 
 
index 817bbab3803525e7622a15b8cf211e746a4af598..1dd9f8696d60189882042d77f2c8ea7c29438e2f 100644 (file)
@@ -38,7 +38,7 @@ typedef struct exfile_s exfile_t;
 exfile_t       *exfile_init(TALLOC_CTX *ctx, uint32_t entries, uint32_t idle, bool locking);
 
 void           exfile_enable_triggers(exfile_t *ef, CONF_SECTION *cs, char const *trigger_prefix,
-                                      fr_pair_t *trigger_args);
+                                      fr_pair_list_t *trigger_args);
 
 int            exfile_open(exfile_t *lf, request_t *request, char const *filename,
                            mode_t permissions);
index 3022b5698b282524b10b1e9c59ab56f194746036..9afd70b6531cb5ddb55985ce867fbd47a976e00c 100644 (file)
@@ -753,25 +753,26 @@ static inline CC_HINT(always_inline) fr_sbuff_t *log_request_oid_buff(void)
  *
  * @param[in] lvl      Debug lvl (1-4).
  * @param[in] request  to read logging params from.
- * @param[in] parent   of vp to print, may be NULL.
- * @param[in] vp       to print.
+ * @param[in] parent   of vps to print, may be NULL.
+ * @param[in] vps      to print.
  * @param[in] prefix   (optional).
  */
 void log_request_pair_list(fr_log_lvl_t lvl, request_t *request,
-                          fr_pair_t const *parent, fr_pair_t const *vp, char const *prefix)
+                          fr_pair_t const *parent, fr_pair_list_t const *vps, char const *prefix)
 {
        fr_cursor_t             cursor;
-       fr_pair_t               *m_vp;
+       fr_pair_list_t          *m_vp;
+       fr_pair_t               *vp;
        fr_dict_attr_t const    *parent_da = NULL;
 
-       if (!vp || !request->log.dst) return;
+       if (!*vps || !request->log.dst) return;
 
        if (!log_rdebug_enabled(lvl, request)) return;
 
-       memcpy(&m_vp, &vp, sizeof(m_vp));
+       memcpy(&m_vp, &vps, sizeof(m_vp));
 
        RINDENT();
-       for (vp = fr_cursor_init(&cursor, &m_vp);
+       for (vp = fr_cursor_init(&cursor, m_vp);
             vp;
             vp = fr_cursor_next(&cursor)) {
                VP_VERIFY(vp);
@@ -789,7 +790,7 @@ void log_request_pair_list(fr_log_lvl_t lvl, request_t *request,
 
                        RDEBUGX(lvl, "%s%pV {", prefix ? prefix : "",
                                fr_box_strvalue_len(fr_sbuff_start(oid_buff), fr_sbuff_used(oid_buff)));
-                       log_request_pair_list(lvl, request, vp, (fr_pair_t *) vp->vp_group, prefix);
+                       log_request_pair_list(lvl, request, vp, (fr_pair_list_t *) vp->vp_group, prefix);
                        RDEBUGX(lvl, "%s}", prefix ? prefix : "");      /* don't add extra space between closing brace and prefix */
                        continue;
                }
@@ -805,25 +806,23 @@ void log_request_pair_list(fr_log_lvl_t lvl, request_t *request,
  *
  * @param[in] lvl      Debug lvl (1-4).
  * @param[in] request  to read logging params from.
- * @param[in] parent   of vp to print, may be NULL.
- * @param[in] vp       to print.
+ * @param[in] parent   of vps to print, may be NULL.
+ * @param[in] vps      to print.
  * @param[in] prefix   (optional).
  */
 void log_request_proto_pair_list(fr_log_lvl_t lvl, request_t *request,
-                                fr_pair_t const *parent, fr_pair_t const *vp, char const *prefix)
+                                fr_pair_t const *parent, fr_pair_list_t const *vps, char const *prefix)
 {
        fr_cursor_t             cursor;
-       fr_pair_t               *m_vp;
        fr_dict_attr_t const    *parent_da = NULL;
+       fr_pair_t               *vp;
 
-       if (!vp || !request->log.dst) return;
+       if (!*vps || !request->log.dst) return;
 
        if (!log_rdebug_enabled(lvl, request)) return;
 
-       memcpy(&m_vp, &vp, sizeof(m_vp));
-
        RINDENT();
-       for (vp = fr_cursor_init(&cursor, &m_vp);
+       for (vp = fr_cursor_init(&cursor, vps);
             vp;
             vp = fr_cursor_next(&cursor)) {
                VP_VERIFY(vp);
@@ -843,7 +842,7 @@ void log_request_proto_pair_list(fr_log_lvl_t lvl, request_t *request,
 
                        RDEBUGX(lvl, "%s%pV {", prefix ? prefix : "",
                                fr_box_strvalue_len(fr_sbuff_start(oid_buff), fr_sbuff_used(oid_buff)));
-                       log_request_proto_pair_list(lvl, request, vp, (fr_pair_t *) vp->vp_group, prefix);
+                       log_request_proto_pair_list(lvl, request, vp, (fr_pair_list_t *) vp->vp_group, prefix);
                        RDEBUGX(lvl, "%s}", prefix ? prefix : "");
                        continue;
                }
index 1630bd5959a589d970f94304825a4fb0eaf51c20..70ae5ca33db38b2b8a102e592b03a7d2bc07274a 100644 (file)
@@ -104,11 +104,11 @@ void      log_request_perror(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request
        CC_HINT(format (printf, 6, 7)) CC_HINT(nonnull (3));
 
 void   log_request_pair_list(fr_log_lvl_t lvl, request_t *request,
-                             fr_pair_t const *parent, fr_pair_t const *vp, char const *prefix)
+                             fr_pair_t const *parent, fr_pair_list_t const *vps, char const *prefix)
                              CC_HINT(nonnull(2));
 
 void   log_request_proto_pair_list(fr_log_lvl_t lvl, request_t *request,
-                                   fr_pair_t const *parent, fr_pair_t const *vp, char const *prefix)
+                                   fr_pair_t const *parent, fr_pair_list_t const *vp, char const *prefix)
                                    CC_HINT(nonnull(2));
 
 void   log_request_marker(fr_log_type_t type, fr_log_lvl_t lvl, request_t *request,
index 44ba8f36cc0c2657cc22a071569f31acd633e9bc..dca59082346c14041f506d48c468d6fe7a595527 100644 (file)
@@ -886,7 +886,7 @@ void map_sort(map_t **maps, fr_cmp_t cmp)
  *     - 0 on success.
  *     - -1 on failure.
  */
-static int map_exec_to_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, map_t const *map)
+static int map_exec_to_vp(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, map_t const *map)
 {
        int result;
        char *expanded = NULL;
@@ -916,7 +916,7 @@ static int map_exec_to_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request,
         */
        result = radius_exec_program(ctx, answer, sizeof(answer),
                                     tmpl_is_list(map->lhs) ? &output_pairs : NULL,
-                                    request, map->rhs->name, input_pairs ? *input_pairs : NULL,
+                                    request, map->rhs->name, input_pairs ? input_pairs : NULL,
                                     true, true, fr_time_delta_from_sec(EXEC_TIMEOUT));
        talloc_free(expanded);
        if (result != 0) {
@@ -937,7 +937,9 @@ static int map_exec_to_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request,
        case TMPL_TYPE_ATTR:
        {
                fr_pair_t *vp;
+               fr_pair_list_t vps;
 
+               fr_pair_list_init(&vps);
                MEM(vp = fr_pair_afrom_da(ctx, tmpl_da(map->lhs)));
                vp->op = map->op;
                if (fr_pair_value_from_str(vp, answer, -1, '"', false) < 0) {
@@ -945,7 +947,8 @@ static int map_exec_to_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request,
                        fr_pair_list_free(&vp);
                        return -2;
                }
-               *out = vp;
+               fr_pair_add(&vps, vp);
+               *out = vps;
 
                return 0;
        }
@@ -967,17 +970,19 @@ static int map_exec_to_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request,
  *     - 0 on success.
  *     - -1 on failure.
  */
-int map_to_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, map_t const *map, UNUSED void *uctx)
+int map_to_vp(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, map_t const *map, UNUSED void *uctx)
 {
        int             rcode = 0;
        fr_pair_t       *vp = NULL, *n;
        fr_pair_list_t  found;
+       fr_pair_list_t  vps;
        request_t       *context = request;
        fr_cursor_t     cursor;
        ssize_t         slen;
        char            *str;
 
        fr_pair_list_init(&found);
+       fr_pair_list_init(&vps);
        *out = NULL;
 
        MAP_VERIFY(map);
@@ -1059,7 +1064,8 @@ int map_to_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, map_t const
                        goto error;
                }
                n->op = map->op;
-               *out = n;
+               fr_pair_add(&vps, n);
+               *out = vps;
                break;
 
        case TMPL_TYPE_UNRESOLVED:
@@ -1074,7 +1080,8 @@ int map_to_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, map_t const
                        goto error;
                }
                n->op = map->op;
-               *out = n;
+               fr_pair_add(&vps, n);
+               *out = vps;
                break;
 
        case TMPL_TYPE_ATTR:
@@ -1155,7 +1162,8 @@ int map_to_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, map_t const
                        }
                }
                n->op = map->op;
-               *out = n;
+               fr_pair_add(&vps, n);
+               *out = vps;
 
                MAP_VERIFY(map);
                break;
index ff0889851f9997568600b97f560abef3f04e3ab1..9118b58557961494aac1dfe46af67d425d72558a 100644 (file)
@@ -102,7 +102,7 @@ struct vp_list_mod_s {
 #endif
 
 typedef int (*map_validate_t)(map_t *map, void *ctx);
-typedef int (*radius_map_getvalue_t)(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request,
+typedef int (*radius_map_getvalue_t)(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request,
                                     map_t const *map, void *uctx);
 
 int            map_afrom_cp(TALLOC_CTX *ctx, map_t **out, CONF_PAIR *cp,
@@ -130,7 +130,7 @@ int         map_afrom_sbuff(TALLOC_CTX *ctx, map_t **out, fr_sbuff_t *in,
 
 void           map_sort(map_t **maps, fr_cmp_t cmp);
 
-int            map_to_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request,
+int            map_to_vp(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request,
                          map_t const *map, void *uctx) CC_HINT(nonnull (2,3,4));
 
 int            map_list_mod_apply(request_t *request, vp_list_mod_t const *vlm);
index d8611c11ca853329c2a760964ceadac33b82408d..877cd21817d5534d4a9aba1b0780530bc00b6b53 100644 (file)
@@ -311,7 +311,7 @@ exfile_t *module_exfile_init(TALLOC_CTX *ctx,
                             uint32_t max_idle,
                             bool locking,
                             char const *trigger_prefix,
-                            fr_pair_t *trigger_args)
+                            fr_pair_list_t *trigger_args)
 {
        char            trigger_prefix_buff[128];
        exfile_t        *handle;
@@ -467,7 +467,7 @@ fr_pool_t *module_connection_pool_init(CONF_SECTION *module,
                                       fr_pool_connection_alive_t a,
                                       char const *log_prefix,
                                       char const *trigger_prefix,
-                                      fr_pair_t *trigger_args)
+                                      fr_pair_list_t *trigger_args)
 {
        CONF_SECTION *cs, *mycs;
        char log_prefix_buff[128];
index 6e24eb9c19a5d20c050a75e2e06bddf4e11a3bcb..c0e683ec93c4a502542ce195ecc3c2b5fcca259a 100644 (file)
@@ -270,14 +270,14 @@ fr_pool_t *module_connection_pool_init(CONF_SECTION *module,
                                             fr_pool_connection_alive_t a,
                                             char const *log_prefix,
                                             char const *trigger_prefix,
-                                            fr_pair_t *trigger_args);
+                                            fr_pair_list_t *trigger_args);
 exfile_t       *module_exfile_init(TALLOC_CTX *ctx,
                                    CONF_SECTION *module,
                                    uint32_t max_entries,
                                    uint32_t max_idle,
                                    bool locking,
                                    char const *trigger_prefix,
-                                   fr_pair_t *trigger_args);
+                                   fr_pair_list_t *trigger_args);
 /** @} */
 
 /** @name Helper functions
index 1edbd27183846940151613fd4cdd071ca63f17db..2e9036842bd33e42cf59d2ddadec14522920983b 100644 (file)
@@ -115,9 +115,9 @@ static paircmp_t *cmp;
  */
 static int prefix_suffix_cmp(UNUSED void *instance,
                             request_t *request,
-                            fr_pair_t *req,
-                            fr_pair_t *check,
-                            fr_pair_t *check_list)
+                            fr_pair_list_t *request_list,
+                            fr_pair_t *check_item,
+                            fr_pair_list_t *check_list)
 {
        fr_pair_t       *vp;
        char const      *name;
@@ -132,22 +132,22 @@ static int prefix_suffix_cmp(UNUSED void *instance,
        if (!username) username = fr_pair_find_by_da(&request->request_pairs, attr_user_name);
        if (!username) return -1;
 
-       VP_VERIFY(check);
+       VP_VERIFY(check_item);
 
        name = username->vp_strvalue;
 
-       RDEBUG3("Comparing name \"%s\" and check value \"%pV\"", name, &check->data);
+       RDEBUG3("Comparing name \"%s\" and check value \"%pV\"", name, &check_item->data);
 
-       len = strlen(check->vp_strvalue);
+       len = strlen(check_item->vp_strvalue);
 
-       if (check->da == attr_prefix) {
-               ret = strncmp(name, check->vp_strvalue, len);
+       if (check_item->da == attr_prefix) {
+               ret = strncmp(name, check_item->vp_strvalue, len);
                if (ret == 0)
                        strlcpy(rest, name + len, sizeof(rest));
-       } else if (check->da == attr_suffix) {
+       } else if (check_item->da == attr_suffix) {
                namelen = strlen(name);
                if (namelen >= len) {
-                       ret = strcmp(name + namelen - len, check->vp_strvalue);
+                       ret = strcmp(name + namelen - len, check_item->vp_strvalue);
                        if (ret == 0) strlcpy(rest, name, namelen - len + 1);
                }
        }
@@ -157,20 +157,20 @@ static int prefix_suffix_cmp(UNUSED void *instance,
        /*
         *      If Strip-User-Name == No, then don't do any more.
         */
-       vp = fr_pair_find_by_da(&check_list, attr_strip_user_name);
+       vp = fr_pair_find_by_da(check_list, attr_strip_user_name);
        if (vp && !vp->vp_uint32) return ret;
 
        /*
         *      See where to put the stripped user name.
         */
-       vp = fr_pair_find_by_da(&check_list, attr_stripped_user_name);
+       vp = fr_pair_find_by_da(check_list, attr_stripped_user_name);
        if (!vp) {
                /*
                 *      If "request" is NULL, then the memory will be
                 *      lost!
                 */
                MEM(vp = fr_pair_afrom_da(request->packet, attr_stripped_user_name));
-               fr_pair_add(&req, vp);
+               fr_pair_add(request_list, vp);
        }
        fr_pair_value_strdup(vp, rest);
 
@@ -183,13 +183,13 @@ static int prefix_suffix_cmp(UNUSED void *instance,
  */
 static int packet_cmp(UNUSED void *instance,
                      request_t *request,
-                     UNUSED fr_pair_t *req,
-                     fr_pair_t *check,
-                     UNUSED fr_pair_t *check_list)
+                     UNUSED fr_pair_list_t *request_list,
+                     fr_pair_t *check_item,
+                     UNUSED fr_pair_list_t *check_list)
 {
-       VP_VERIFY(check);
+       VP_VERIFY(check_item);
 
-       if (request->packet->code == check->vp_uint32) return 0;
+       if (request->packet->code == check_item->vp_uint32) return 0;
 
        return 1;
 }
@@ -199,30 +199,30 @@ static int packet_cmp(UNUSED void *instance,
  */
 static int generic_cmp(UNUSED void *instance,
                       request_t *request,
-                      fr_pair_t *req,
-                      fr_pair_t *check,
-                      UNUSED fr_pair_t *check_list)
+                      UNUSED fr_pair_list_t *request_list,
+                      fr_pair_t *check_item,
+                      UNUSED fr_pair_list_t *check_list)
 {
-       VP_VERIFY(check);
+       VP_VERIFY(check_item);
 
-       if ((check->op != T_OP_REG_EQ) && (check->op != T_OP_REG_NE)) {
+       if ((check_item->op != T_OP_REG_EQ) && (check_item->op != T_OP_REG_NE)) {
                int rcode;
                char name[1024];
                char value[1024];
                fr_pair_t *vp;
 
-               snprintf(name, sizeof(name), "%%{%s}", check->da->name);
+               snprintf(name, sizeof(name), "%%{%s}", check_item->da->name);
 
                if (xlat_eval(value, sizeof(value), request, name, NULL, NULL) < 0) return 0;
 
-               MEM(vp = fr_pair_afrom_da(req, check->da));
-               vp->op = check->op;
+               MEM(vp = fr_pair_afrom_da(request, check_item->da));
+               vp->op = check_item->op;
                fr_pair_value_from_str(vp, value, -1, '"', false);
 
                /*
                 *      Paircmp returns 0 for failed comparison, 1 for succeeded -1 for error.
                 */
-               rcode = fr_pair_cmp(check, vp);
+               rcode = fr_pair_cmp(check_item, vp);
 
                /*
                 *      We're being called from paircmp_func,
@@ -242,7 +242,7 @@ static int generic_cmp(UNUSED void *instance,
                 *      returns 0 for matched, and 1 for didn't match.
                 */
                rcode = !rcode;
-               fr_pair_list_free(&vp);
+               talloc_free(vp);
 
                return rcode;
        }
@@ -250,7 +250,7 @@ static int generic_cmp(UNUSED void *instance,
        /*
         *      Will do the xlat for us
         */
-       return paircmp_pairs(request, check, NULL);
+       return paircmp_pairs(request, check_item, NULL);
 }
 
 /** See what attribute we want to compare with.
@@ -489,34 +489,38 @@ finish:
        return 0;
 }
 
-/** Compare check and vp. May call the attribute comparison function.
+/** Compare check_item and vp. May call the attribute comparison function.
  *
  * Unlike paircmp_pairs() this function will call any attribute-specific
- * comparison functions registered.
+ * comparison functions registered.  vp to be matched is request_item or
+ * found in check_list or looked up from external sources depending on the
+ * comparison function called.
  *
  * @param[in] request          Current request.
+ * @param[in] request_item     item to compare.
  * @param[in] request_list     list pairs.
- * @param[in] check            item to compare.
+ * @param[in] check_item       item to compare.
  * @param[in] check_list       list.
  * @return
- *     - 0 if check and vp are equal.
- *     - -1 if vp value is less than check value.
- *     - 1 is vp value is more than check value.
+ *     - 0 if check_item and vp are equal.
+ *     - -1 if vp value is less than check_item value.
+ *     - 1 is vp value is more than check_item value.
  */
 static int paircmp_func(request_t *request,
-                       fr_pair_t *request_list,
-                       fr_pair_t *check,
-                       fr_pair_t *check_list)
+                       fr_pair_t *request_item,
+                       fr_pair_list_t *request_list,
+                       fr_pair_t *check_item,
+                       fr_pair_list_t *check_list)
 {
        paircmp_t *c;
 
-       VP_VERIFY(check);
+       VP_VERIFY(check_item);
 
        /*
         *      Check for =* and !* and return appropriately
         */
-       if (check->op == T_OP_CMP_TRUE)  return 0;
-       if (check->op == T_OP_CMP_FALSE) return 1;
+       if (check_item->op == T_OP_CMP_TRUE)  return 0;
+       if (check_item->op == T_OP_CMP_FALSE) return 1;
 
        /*
         *      See if there is a special compare function.
@@ -524,31 +528,32 @@ static int paircmp_func(request_t *request,
         *      FIXME: use new RB-Tree code.
         */
        for (c = cmp; c; c = c->next) {
-               if (c->da == check->da) {
-                       return (c->compare)(c->instance, request, request_list, check, check_list);
+               if (c->da == check_item->da) {
+                       return (c->compare)(c->instance, request, request_list, check_item, check_list);
                }
        }
 
        if (!request) return -1; /* doesn't exist, don't compare it */
 
-       return paircmp_pairs(request, check, request_list);
+       return paircmp_pairs(request, check_item, request_item);
 }
 
 /** Compare two pair lists except for the password information.
  *
- * For every element in "check" at least one matching copy must be present
- * in "reply".
+ * For every element in "check_list" at least one matching copy must be present
+ * in "request_list".
  *
  * @param[in] request          Current request.
  * @param[in] request_list     request valuepairs.
- * @param[in] check            Check/control valuepairs.
+ * @param[in] check_list       Check/control valuepairs.
  * @return 0 on match.
  */
 int paircmp(request_t *request,
-           fr_pair_t *request_list,
-           fr_pair_t *check)
+           fr_pair_list_t *request_list,
+           fr_pair_list_t *check_list)
 {
        fr_cursor_t             cursor;
+       fr_cursor_t             request_cursor;
        fr_pair_t               *check_item;
        fr_pair_t               *auth_item;
        fr_dict_attr_t const    *from;
@@ -557,7 +562,7 @@ int paircmp(request_t *request,
        int                     compare;
        bool                    first_only;
 
-       for (check_item = fr_cursor_init(&cursor, &check);
+       for (check_item = fr_cursor_init(&cursor, check_list);
             check_item;
             check_item = fr_cursor_next(&cursor)) {
                /*
@@ -595,7 +600,7 @@ int paircmp(request_t *request,
                                WARN("Are you sure you don't mean Password.Cleartext?");
                                WARN("See \"man rlm_pap\" for more information");
                        }
-                       if (fr_pair_find_by_num(&request_list, 0, FR_USER_PASSWORD) == NULL) continue;
+                       if (fr_pair_find_by_num(request_list, 0, FR_USER_PASSWORD) == NULL) continue;
                }
 
                /*
@@ -603,14 +608,14 @@ int paircmp(request_t *request,
                 */
                first_only = other_attr(check_item->da, &from);
 
-               auth_item = request_list;
+               auth_item = fr_cursor_init(&request_cursor, request_list);
 
        try_again:
                if (!first_only) {
                        while (auth_item != NULL) {
                                if ((auth_item->da == from) || (!from)) break;
 
-                               auth_item = auth_item->next;
+                               auth_item = fr_cursor_next(&request_cursor);
                        }
                }
 
@@ -644,7 +649,7 @@ int paircmp(request_t *request,
                /*
                 *      OK it is present now compare them.
                 */
-               compare = paircmp_func(request, auth_item, check_item, check);
+               compare = paircmp_func(request, auth_item, request_list, check_item, check_list);
                switch (check_item->op) {
                case T_OP_EQ:
                default:
@@ -690,7 +695,7 @@ int paircmp(request_t *request,
                 *      another of the same attribute, which DOES match.
                 */
                if ((result != 0) && (!first_only)) {
-                       auth_item = auth_item->next;
+                       auth_item = fr_cursor_next(&request_cursor);
                        result = 0;
                        goto try_again;
                }
index 105506317d606e504b6bbfb91782378b5dc6e44f..937c42fd67e6a9eb07aeb2aa8ced047949a1b033 100644 (file)
@@ -35,11 +35,11 @@ extern "C" {
 #include <freeradius-devel/util/pair.h>
 
 /* for paircmp_register */
-typedef int (*RAD_COMPARE_FUNC)(void *instance, request_t *,fr_pair_t *, fr_pair_t *, fr_pair_t *);
+typedef int (*RAD_COMPARE_FUNC)(void *instance, request_t *,fr_pair_list_t *, fr_pair_t *, fr_pair_list_t *);
 
 int            paircmp_pairs(request_t *request, fr_pair_t *check, fr_pair_t *vp);
 
-int            paircmp(request_t *request, fr_pair_t *req_list, fr_pair_t *check);
+int            paircmp(request_t *request, fr_pair_list_t *request_list, fr_pair_list_t *check_list);
 
 int            paircmp_find(fr_dict_attr_t const *da);
 
index 8ded95f464cca986b6cd6377b3e716ec077fab4c..4fec2ffa2d33947ca0029b96fc57b733b4e55a30 100644 (file)
@@ -42,7 +42,7 @@ RCSID("$Id$")
  *     only fr_pair_list_copy() those attributes that we're really going to
  *     use.
  */
-void radius_pairmove(request_t *request, fr_pair_t **to, fr_pair_t *from, bool do_xlat)
+void radius_pairmove(request_t *request, fr_pair_list_t *to, fr_pair_list_t *from, bool do_xlat)
 {
        int             i, j, count, from_count, to_count, tailto;
        fr_cursor_t     cursor;
@@ -75,7 +75,7 @@ void radius_pairmove(request_t *request, fr_pair_t **to, fr_pair_t *from, bool d
         *      the matching attributes are deleted.
         */
        count = 0;
-       for (vp = fr_cursor_init(&cursor, &from); vp; vp = fr_cursor_next(&cursor)) count++;
+       for (vp = fr_cursor_init(&cursor, from); vp; vp = fr_cursor_next(&cursor)) count++;
        from_list = talloc_array(request, fr_pair_t *, count);
 
        for (vp = fr_cursor_init(&cursor, to); vp; vp = fr_cursor_next(&cursor)) count++;
@@ -89,7 +89,7 @@ void radius_pairmove(request_t *request, fr_pair_t **to, fr_pair_t *from, bool d
         *      chains.
         */
        from_count = 0;
-       for (vp = from; vp != NULL; vp = next) {
+       for (vp = *from; vp != NULL; vp = next) {
                next = vp->next;
                from_list[from_count++] = vp;
                vp->next = NULL;
index 8cd8512d5524d87370db184fb1340dadac55bf75..97b2035a32e6e3aa0884b36e59eba95be9a06430 100644 (file)
@@ -32,7 +32,7 @@ RCSIDH(pairmove_h, "$Id$")
 extern "C" {
 #endif
 
-void   radius_pairmove(request_t *request, fr_pair_t **to, fr_pair_t *from, bool do_xlat) CC_HINT(nonnull);
+void   radius_pairmove(request_t *request, fr_pair_list_t *to, fr_pair_list_t *from, bool do_xlat) CC_HINT(nonnull);
 
 #ifdef __cplusplus
 }
index 70a46b1d2a4057c12836e5e2ee9b837d5dc6c2b8..44955fa6f5988a33eed2d273a2155cbe92e4c95f 100644 (file)
@@ -256,7 +256,7 @@ static inline void fr_pool_trigger_exec(fr_pool_t *pool, request_t *request, cha
        if (!pool->triggers_enabled) return;
 
        snprintf(name, sizeof(name), "%s.%s", pool->trigger_prefix, event);
-       trigger_exec(request, pool->cs, name, true, pool->trigger_args);
+       trigger_exec(request, pool->cs, name, true, &pool->trigger_args);
 }
 
 /** Find a connection handle in the connection list
@@ -899,7 +899,7 @@ do_return:
  *                             Trigger args will be copied, input trigger_args should be freed
  *                             if necessary.
  */
-void fr_pool_enable_triggers(fr_pool_t *pool, char const *trigger_prefix, fr_pair_t *trigger_args)
+void fr_pool_enable_triggers(fr_pool_t *pool, char const *trigger_prefix, fr_pair_list_t *trigger_args)
 {
        pool->triggers_enabled = true;
 
@@ -910,7 +910,7 @@ void fr_pool_enable_triggers(fr_pool_t *pool, char const *trigger_prefix, fr_pai
 
        if (!trigger_args) return;
 
-       MEM(fr_pair_list_copy(pool, &pool->trigger_args, &trigger_args) >= 0);
+       MEM(fr_pair_list_copy(pool, &pool->trigger_args, trigger_args) >= 0);
 }
 
 /** Create a new connection pool
@@ -1132,7 +1132,7 @@ fr_pool_t *fr_pool_copy(TALLOC_CTX *ctx, fr_pool_t *pool, void *opaque)
        copy = fr_pool_init(ctx, pool->cs, opaque, pool->create, pool->alive, pool->log_prefix);
        if (!copy) return NULL;
 
-       if (pool->trigger_prefix) fr_pool_enable_triggers(copy, pool->trigger_prefix, pool->trigger_args);
+       if (pool->trigger_prefix) fr_pool_enable_triggers(copy, pool->trigger_prefix, &pool->trigger_args);
 
        return copy;
 }
index 711ecb2f3dcad0ab2d3df910467724dbfcdec8da..a47684928a38a8625c87554806b35f47badb36b9 100644 (file)
@@ -143,7 +143,7 @@ fr_pool_t   *fr_pool_copy(TALLOC_CTX *ctx, fr_pool_t *pool, void *opaque);
  *     Pool get/set
  */
 void   fr_pool_enable_triggers(fr_pool_t *pool,
-                                          char const *trigger_prefix, fr_pair_t *vp);
+                                          char const *trigger_prefix, fr_pair_list_t *trigger_args);
 
 fr_time_delta_t fr_pool_timeout(fr_pool_t *pool);
 
index 403b76854a633ea180108a443b9a935224363d8e..9feb84fbd3459e41bb62cdc096d1f26937d2b04b 100644 (file)
@@ -647,7 +647,7 @@ void fr_state_to_request(fr_state_tree_t *state, request_t *request)
 
        if (request->state) {
                RDEBUG2("Restored &session-state");
-               log_request_pair_list(L_DBG_LVL_2, request, NULL, request->state, "&session-state.");
+               log_request_pair_list(L_DBG_LVL_2, request, NULL, &request->state, "&session-state.");
        }
 
        /*
@@ -682,7 +682,7 @@ int fr_request_to_state(fr_state_tree_t *state, request_t *request)
 
        if (request->state) {
                RDEBUG2("Saving &session-state");
-               log_request_pair_list(L_DBG_LVL_2, request, NULL, request->state, "&session-state.");
+               log_request_pair_list(L_DBG_LVL_2, request, NULL, &request->state, "&session-state.");
        }
 
        vp = fr_pair_find_by_da(&request->request_pairs, state->da);
index e56b57c8a258dcfc52dff7dfd830f6b5970c41e1..74b9b0e024ffeffd17e7fd625bc03e0d2c56cbcb 100644 (file)
@@ -842,7 +842,7 @@ void _tmpl_cursor_pool_init(tmpl_cursor_ctx_t *cc)
  *
  */
 static inline CC_HINT(always_inline)
-void _tmpl_cursor_tlv_init(TALLOC_CTX *list_ctx, fr_pair_t **list, tmpl_attr_t const *ar, tmpl_cursor_ctx_t *cc)
+void _tmpl_cursor_tlv_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_attr_t const *ar, tmpl_cursor_ctx_t *cc)
 {
        tmpl_attr_t             *prev = fr_dlist_prev(&cc->vpt->data.attribute.ar, ar);
 
@@ -932,7 +932,7 @@ static fr_pair_t *_tmpl_cursor_group_eval(fr_pair_t **prev, UNUSED fr_pair_t *cu
  *
  */
 static inline CC_HINT(always_inline)
-void _tmpl_cursor_group_init(TALLOC_CTX *list_ctx, fr_pair_t **list, tmpl_attr_t const *ar, tmpl_cursor_ctx_t *cc)
+void _tmpl_cursor_group_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_attr_t const *ar, tmpl_cursor_ctx_t *cc)
 {
        tmpl_cursor_nested_t *ns;
 
@@ -968,7 +968,7 @@ static fr_pair_t *_tmpl_cursor_leaf_eval(fr_pair_t **prev, fr_pair_t *curr, tmpl
  *
  */
 static inline CC_HINT(always_inline)
-void _tmpl_cursor_leaf_init(TALLOC_CTX *list_ctx, fr_pair_t **list, tmpl_attr_t const *ar, tmpl_cursor_ctx_t *cc)
+void _tmpl_cursor_leaf_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_attr_t const *ar, tmpl_cursor_ctx_t *cc)
 {
        tmpl_cursor_nested_t    *ns = &cc->leaf;
 
@@ -1086,7 +1086,7 @@ fr_pair_t *_tmpl_cursor_eval(fr_pair_t **prev, fr_pair_t *curr, tmpl_cursor_ctx_
 }
 
 static inline CC_HINT(always_inline)
-void _tmpl_cursor_init(TALLOC_CTX *list_ctx, fr_pair_t **list, tmpl_attr_t const *ar, tmpl_cursor_ctx_t *cc)
+void _tmpl_cursor_init(TALLOC_CTX *list_ctx, fr_pair_list_t *list, tmpl_attr_t const *ar, tmpl_cursor_ctx_t *cc)
 {
        if (fr_dlist_next(&cc->vpt->data.attribute.ar, ar)) switch (ar->ar_da->type) {
        case FR_TYPE_TLV:
@@ -1318,7 +1318,7 @@ void tmpl_cursor_clear(tmpl_cursor_ctx_t *cc)
  *     - -3 if context could not be found (no parent #request_t available).
  *     - -4 on memory allocation error.
  */
-int tmpl_copy_pairs(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, tmpl_t const *vpt)
+int tmpl_copy_pairs(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, tmpl_t const *vpt)
 {
        fr_pair_t               *vp;
        fr_cursor_t             from, to;
@@ -1367,7 +1367,7 @@ int tmpl_copy_pairs(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, tmpl_t
  *     - -3 if context could not be found (no parent #request_t available).
  *     - -4 on memory allocation error.
  */
-int tmpl_copy_pair_children(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, tmpl_t const *vpt)
+int tmpl_copy_pair_children(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, tmpl_t const *vpt)
 {
        fr_pair_t               *vp;
        fr_cursor_t             from;
index 66b36712d43585a25775c44792a1ee81fea668f1..6cebe0dbc6570af5ca5cd33f41c45b86bcd9378a 100644 (file)
@@ -268,7 +268,7 @@ static unlang_action_t trigger_process(rlm_rcode_t *p_result, module_ctx_t const
  * @return             - 0 on success.
  *                     - -1 on failure.
  */
-int trigger_exec(request_t *request, CONF_SECTION const *cs, char const *name, bool rate_limit, fr_pair_t *args)
+int trigger_exec(request_t *request, CONF_SECTION const *cs, char const *name, bool rate_limit, fr_pair_list_t *args)
 {
        CONF_SECTION const      *subcs;
 
index db1817396d875791e9a99b86297c1e63ab3a425f..045ebd19a53d23cb898b8b515221e9aed0bee7b9 100644 (file)
@@ -43,7 +43,7 @@ ssize_t               trigger_xlat(UNUSED TALLOC_CTX *ctx, char **out, UNUSED size_t outlen,
 int            trigger_exec_init(CONF_SECTION const *cs);
 
 int            trigger_exec(request_t *request, CONF_SECTION const *cs,
-                            char const *name, bool quench, fr_pair_t *args)
+                            char const *name, bool quench, fr_pair_list_t *args)
                             CC_HINT(nonnull (3));
 
 void           trigger_exec_free(void);
index ac86c6bcd4c91d728bd723d5ad2d03cdc4ad9607..a68213d6cd416baa2901ff9c4578515d49974f69 100644 (file)
@@ -160,7 +160,7 @@ int fr_tls_validate_cert_cb(int ok, X509_STORE_CTX *x509_ctx)
                        /*
                         *      Print out all the pairs we have so far
                         */
-                       log_request_pair_list(L_DBG_LVL_2, request, NULL, cert_vps, "&session-state.");
+                       log_request_pair_list(L_DBG_LVL_2, request, NULL, &cert_vps, "&session-state.");
 
                        /*
                         *      cert_vps have a different talloc parent, so we
@@ -309,7 +309,7 @@ int fr_tls_validate_cert_cb(int ok, X509_STORE_CTX *x509_ctx)
 
                RDEBUG2("Verifying client certificate with cmd");
                if (radius_exec_program(request, NULL, 0, NULL, request, conf->verify_client_cert_cmd,
-                                       request->request_pairs, true, true, fr_time_delta_from_sec(EXEC_TIMEOUT)) != 0) {
+                                       &request->request_pairs, true, true, fr_time_delta_from_sec(EXEC_TIMEOUT)) != 0) {
                        REDEBUG("Client certificate CN \"%s\" failed external verification", common_name);
                        my_ok = 0;
                } else {
index a1b9f8a804e9a97c9fa6177a31b012f73cb24c4d..1d797ebc98ef39d07580bbe2080f79d8e771d6cb 100644 (file)
@@ -521,7 +521,7 @@ unlang_action_t unlang_module_yield_to_xlat(TALLOC_CTX *ctx, fr_value_box_t **ou
  */
 unlang_action_t unlang_module_yield_to_tmpl(TALLOC_CTX *ctx, fr_value_box_t **out, int *status,
                                            request_t *request, tmpl_t const *vpt,
-                                           fr_pair_t *vps,
+                                           fr_pair_list_t *vps,
                                            unlang_module_resume_t resume,
                                            unlang_module_signal_t signal, void *rctx)
 {
index 0f2671209454fec3c4c5bd6810d2762c19eabb3b..7ce0cab581e0447c433395d1cae7a268f05925a3 100644 (file)
@@ -133,7 +133,7 @@ unlang_action_t     unlang_module_yield_to_xlat(TALLOC_CTX *ctx, fr_value_box_t **ou
 
 unlang_action_t        unlang_module_yield_to_tmpl(TALLOC_CTX *ctx, fr_value_box_t **out, int *status,
                                            request_t *request, tmpl_t const *exp,
-                                           fr_pair_t *vps,
+                                           fr_pair_list_t *vps,
                                            unlang_module_resume_t resume,
                                            unlang_module_signal_t signal, void *rctx);
 
index 9e854f6c36be786e069051735717fe448d73463b..49e856e1dd610f35faf2988f2420a09fff55e4f0 100644 (file)
@@ -209,7 +209,7 @@ static unlang_action_t unlang_subrequest_start(rlm_rcode_t *p_result, request_t
                                                             state->session.unique_int);
 
        RDEBUG2("Creating subrequest (%s)", child->name);
-       log_request_pair_list(L_DBG_LVL_1, request, NULL, child->request_pairs, NULL);
+       log_request_pair_list(L_DBG_LVL_1, request, NULL, &child->request_pairs, NULL);
 
        frame->process = unlang_subrequest_process;
        return unlang_subrequest_process(p_result, request);
index fadf4207934662688a6f6c4c0bbc3ed0cccc6717..4746e3c8751ac3b89cb642331bf4e1531429093e 100644 (file)
@@ -112,7 +112,7 @@ static void unlang_tmpl_signal(request_t *request, fr_state_signal_t action)
  * @param[in] vps              the input VPs.  May be NULL.  Used only for #TMPL_TYPE_EXEC
  * @param[out] status          where the status of exited programs will be stored.
  */
-int unlang_tmpl_push(TALLOC_CTX *ctx, fr_value_box_t **out, request_t *request, tmpl_t const *tmpl, fr_pair_t *vps, int *status)
+int unlang_tmpl_push(TALLOC_CTX *ctx, fr_value_box_t **out, request_t *request, tmpl_t const *tmpl, fr_pair_list_t *vps, int *status)
 {
        unlang_stack_t                  *stack = request->stack;
        unlang_stack_frame_t            *frame;
index f33e49b111fe7ac51cded6a803e094d695260374..f09da6b52f2642e6dc92372cd8fc7948eb01af53 100644 (file)
@@ -58,7 +58,7 @@ typedef void (*fr_unlang_tmpl_signal_t)(request_t *request, void *rctx, fr_state
 typedef rlm_rcode_t (*fr_unlang_tmpl_resume_t)(request_t *request, void *rctx);
 
 int            unlang_tmpl_push(TALLOC_CTX *ctx, fr_value_box_t **out,
-                                request_t *request, tmpl_t const *tmpl, fr_pair_t *vps, int *status)
+                                request_t *request, tmpl_t const *tmpl, fr_pair_list_t *vps, int *status)
                CC_HINT(warn_unused_result);
 
 #ifdef __cplusplus
index 23193bd48f0e30688dc40c232fc86f51600a1d9f..62300e77f26a7d3251e65985016f09ed27497076 100644 (file)
@@ -49,7 +49,7 @@ typedef struct {
        fr_event_timer_t const          *ev;            //!< for timing out the child
        fr_event_pid_t const            *ev_pid;        //!< for cleaning up the process
 
-       fr_pair_list_t                  vps;            //!< input VPs
+       fr_pair_list_t                  *vps;           //!< input VPs
        char                            *buffer;        //!< for reading the answer
        char                            *ptr;           //!< where in the buffer we are writing to
        int                             status;         //!< return code of the program
index a35ae1463ab47ba3ce8fdf65710b6093f499a09b..cbbc59c953f7cdebb7328556047934ded76f10db 100644 (file)
@@ -148,7 +148,7 @@ void fr_cursor_free_list(fr_cursor_t *cursor) CC_HINT(nonnull);
  *     - The first item returned by the iterator.
  */
 #define fr_cursor_talloc_iter_init(_cursor, _head, _iter, _uctx, _type) \
-       _fr_cursor_init(_cursor, (void **)_head, offsetof(__typeof__(**(_head)), next), _iter, _uctx, #_type)
+       _fr_cursor_init(_cursor, (void * const *)_head, offsetof(__typeof__(**(_head)), next), _iter, _uctx, #_type)
 
 /** Initialise a cursor with a custom iterator
  *
index 4995f8c4b9a34a461418dc6e1048a46a2782d2d1..d063b1405a321c52b75832c286ae41df25a26b06 100644 (file)
@@ -411,7 +411,7 @@ void *fr_pair_iter_next_by_ancestor(void **prev, void *to_eval, void *uctx)
  *
  * @hidecallergraph
  */
-fr_pair_t *fr_pair_find_by_da(fr_pair_list_t *head, fr_dict_attr_t const *da)
+fr_pair_t *fr_pair_find_by_da(fr_pair_list_t const *head, fr_dict_attr_t const *da)
 {
        fr_pair_t       *vp;
 
index d4ef2bc797d9baa15979638d11150e9341b967f6..a01c6a8f1827e39631042d6df9d06d27a29c5a7f 100644 (file)
@@ -174,6 +174,16 @@ void               fr_pair_list_verify(char const *file, int line, TALLOC_CTX const *expected
                                fr_pair_list_t *  : NULL, \
                                default           : (fr_pair_list_t *) NULL))
 
+/*
+ *  Temporary macro to point the head of a pair_list to a specific vp
+ */
+#define fr_pair_list_set_head(_list, _vp) (_list = &_vp)
+
+/*
+ *  Temporary macro to point a pair_list to a single vp
+ */
+#define        fr_pair_list_single_value(_list, _vp) (_list = &_vp)
+
 /* Allocation and management */
 fr_pair_t      *fr_pair_alloc_null(TALLOC_CTX *ctx);
 
@@ -234,7 +244,7 @@ static inline fr_pair_t *fr_cursor_iter_by_ancestor_init(fr_cursor_t *cursor,
 /**
  * @hidecallergraph
  */
-fr_pair_t      *fr_pair_find_by_da(fr_pair_list_t *head, fr_dict_attr_t const *da);
+fr_pair_t      *fr_pair_find_by_da(fr_pair_list_t const *head, fr_dict_attr_t const *da);
 
 fr_pair_t      *fr_pair_find_by_num(fr_pair_list_t *head, unsigned int vendor, unsigned int attr);
 
index 190ab323b7e97745d04284f6c3a33d24aadc9eec..5ac5ce632439b762638dbc2705e6e8a6a32bc5a5 100644 (file)
@@ -95,7 +95,7 @@ static int mod_decode(UNUSED void const *instance, request_t *request, uint8_t *
                       fr_arp_packet_codes[request->packet->code],
                       request->async->listen->name);
 
-               log_request_pair_list(L_DBG_LVL_1, request, NULL, request->request_pairs, NULL);
+               log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->request_pairs, NULL);
        }
 
        return 0;
@@ -127,7 +127,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf
                return 1;
        }
 
-       slen = fr_arp_encode(&FR_DBUFF_TMP(buffer, buffer_len), request->packet->data, request->reply_pairs);
+       slen = fr_arp_encode(&FR_DBUFF_TMP(buffer, buffer_len), request->packet->data, &request->reply_pairs);
        if (slen <= 0) {
                RPEDEBUG("Failed encoding reply");
                return -1;
@@ -146,7 +146,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf
                       request->reply->code,
                       request->async->listen->name);
 
-               log_request_pair_list(L_DBG_LVL_1, request, NULL, request->reply_pairs, NULL);
+               log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->reply_pairs, NULL);
        }
 
        return slen;
index 35a25110d1c1d1cd1f702d79e76e141a10da6970..cb56747e1a6e21339ee8b09f1e41eed32113ef22 100644 (file)
@@ -76,7 +76,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, UNUSED module_ctx_t co
        case REQUEST_INIT:
                if (request->parent && RDEBUG_ENABLED) {
                        RDEBUG("Received ARP %s", fr_arp_packet_codes[request->packet->code]);
-                       log_request_pair_list(L_DBG_LVL_1, request, NULL, request->request_pairs, NULL);
+                       log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->request_pairs, NULL);
                }
 
                request->component = "arp";
@@ -215,7 +215,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, UNUSED module_ctx_t co
 
                if (request->parent && RDEBUG_ENABLED) {
                        RDEBUG("Sending %s", fr_arp_packet_codes[request->reply->code]);
-                       log_request_pair_list(L_DBG_LVL_1, request, NULL, request->reply_pairs, NULL);
+                       log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->reply_pairs, NULL);
                }
                break;
 
index 3833dd53bad5aae2975a9ab187182db631aaf351..e77abc5dd0b1a24768292c3161dc541fce44424a 100644 (file)
@@ -61,7 +61,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mc
                RDEBUG("Received %s ID %i",
                       fr_dict_enum_name_by_value(inst->attr_packet_type, fr_box_uint32(request->packet->code)),
                       request->packet->id);
-               log_request_pair_list(L_DBG_LVL_1, request, NULL, request->request_pairs, NULL);
+               log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->request_pairs, NULL);
 
                request->component = "radius";
 
@@ -190,7 +190,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mc
                               request->reply->id);
                }
 
-               log_request_proto_pair_list(L_DBG_LVL_1, request, NULL, request->reply_pairs, NULL);
+               log_request_proto_pair_list(L_DBG_LVL_1, request, NULL, &request->reply_pairs, NULL);
                break;
 
        default:
index 6207dc74090185c1b30ea127dc47c2ab089b298d..387b0c6282569af3e40e6eeca0ef526941f9e16e 100644 (file)
@@ -330,7 +330,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf
        }
 
        data_len = fr_dhcpv4_encode(buffer, buffer_len, original, request->reply->code,
-                                   ntohl(original->xid), request->reply_pairs);
+                                   ntohl(original->xid), &request->reply_pairs);
        if (data_len < 0) {
                RPEDEBUG("Failed encoding DHCPV4 reply");
                return -1;
index 1b7390a8d5d48ed77c76c508783c5e54ef725f97..6c6e6050ec1191ae70aaf78d40d879b1962c17ac 100644 (file)
@@ -103,9 +103,9 @@ static void dhcpv4_packet_debug(request_t *request, fr_radius_packet_t *packet,
        REXDENT();
 
        if (received || request->parent) {
-               log_request_pair_list(L_DBG_LVL_1, request, NULL, packet->vps, NULL);
+               log_request_pair_list(L_DBG_LVL_1, request, NULL, &packet->vps, NULL);
        } else {
-               log_request_proto_pair_list(L_DBG_LVL_1, request, NULL, packet->vps, NULL);
+               log_request_proto_pair_list(L_DBG_LVL_1, request, NULL, &packet->vps, NULL);
        }
 }
 
index 8c6608ea99f4f15b4bc878cd0a95018436ab5365..d6fcbb31682c3f8a56a8444a2bb8bda08b395513 100644 (file)
@@ -319,7 +319,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf
 
        data_len = fr_dhcpv6_encode(&FR_DBUFF_TMP(buffer, buffer_len),
                                    request->packet->data, request->packet->data_len,
-                                   request->reply->code, request->reply_pairs);
+                                   request->reply->code, &request->reply_pairs);
        if (data_len < 0) {
                RPEDEBUG("Failed encoding DHCPv6 reply");
                return -1;
index 7eb64e60c4b6a315462a4f3f63ebf3da7a4f02e4..edb39cbc6935ec5345274fe5ba16d6f44b98f27a 100644 (file)
@@ -96,9 +96,9 @@ static void dhcpv6_packet_debug(request_t *request, fr_radius_packet_t *packet,
                    );
 
        if (received || request->parent) {
-               log_request_pair_list(L_DBG_LVL_1, request, NULL, packet->vps, NULL);
+               log_request_pair_list(L_DBG_LVL_1, request, NULL, &packet->vps, NULL);
        } else {
-               log_request_proto_pair_list(L_DBG_LVL_1, request, NULL, packet->vps, NULL);
+               log_request_proto_pair_list(L_DBG_LVL_1, request, NULL, &packet->vps, NULL);
        }
 }
 
index ad89f6bacbf45214881329c8279728914723de03..39b3eb53c7ec282324c3d34cac61a9b9d520afc7 100644 (file)
@@ -289,7 +289,7 @@ static int mod_decode(void const *instance, request_t *request, uint8_t *const d
                       request->packet->data_len,
                       request->async->listen->name);
 
-               log_request_pair_list(L_DBG_LVL_1, request, NULL, request->request_pairs, NULL);
+               log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->request_pairs, NULL);
        }
 
        if (!inst->io.app_io->decode) return 0;
@@ -388,7 +388,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf
 
        data_len = fr_radius_encode(buffer, buffer_len, request->packet->data,
                                    client->secret, talloc_array_length(client->secret) - 1,
-                                   request->reply->code, request->reply->id, request->reply_pairs);
+                                   request->reply->code, request->reply->id, &request->reply_pairs);
        if (data_len < 0) {
                RPEDEBUG("Failed encoding RADIUS reply");
                return -1;
@@ -411,7 +411,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf
                       data_len,
                       request->async->listen->name);
 
-               log_request_pair_list(L_DBG_LVL_1, request, NULL, request->reply_pairs, NULL);
+               log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->reply_pairs, NULL);
        }
 
        return data_len;
index 8b662e5f35e214946a3cffebdd66f8c025e12815..4808ebadbdcc133d34dbb8bcbfda291dd12aad5e 100644 (file)
@@ -62,7 +62,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, UNUSED module_ctx_t co
        case REQUEST_INIT:
                if (request->parent && RDEBUG_ENABLED) {
                        RDEBUG("Received %s ID %i", fr_packet_codes[request->packet->code], request->packet->id);
-                       log_request_pair_list(L_DBG_LVL_1, request, NULL, request->request_pairs, NULL);
+                       log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->request_pairs, NULL);
                }
 
                request->component = "radius";
@@ -236,7 +236,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, UNUSED module_ctx_t co
 
                if (request->parent && RDEBUG_ENABLED) {
                        RDEBUG("Sending %s ID %i", fr_packet_codes[request->reply->code], request->reply->id);
-                       log_request_pair_list(L_DBG_LVL_1, request, NULL, request->reply_pairs, NULL);
+                       log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->reply_pairs, NULL);
                }
                break;
 
index 651e8630c960608f6a2c6dd77ba44e4352f8ff9e..c35ecb2c89b80d3f74966ebdda4f81c08b0feb14 100644 (file)
@@ -284,7 +284,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mc
        case REQUEST_INIT:
                if (request->parent && RDEBUG_ENABLED) {
                        RDEBUG("Received %s ID %i", fr_packet_codes[request->packet->code], request->packet->id);
-                       log_request_pair_list(L_DBG_LVL_1, request, NULL, request->request_pairs, NULL);
+                       log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->request_pairs, NULL);
                }
 
                request->component = "radius";
@@ -673,7 +673,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, module_ctx_t const *mc
                }
                if (request->parent && RDEBUG_ENABLED) {
                        RDEBUG("Sending %s ID %i", fr_packet_codes[request->reply->code], request->reply->id);
-                       log_request_pair_list(L_DBG_LVL_1, request, NULL, request->reply_pairs, NULL);
+                       log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->reply_pairs, NULL);
                }
                break;
 
index 5f7435fc232beb7930c1c733b3e41f7e960a2d33..e50dc12370e8824c75a4a6ee2612c2caec883742 100644 (file)
@@ -63,7 +63,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, UNUSED module_ctx_t co
        case REQUEST_INIT:
                if (request->parent && RDEBUG_ENABLED) {
                        RDEBUG("Received %s ID %i", fr_packet_codes[request->packet->code], request->packet->id);
-                       log_request_pair_list(L_DBG_LVL_1, request, NULL, request->request_pairs, NULL);
+                       log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->request_pairs, NULL);
                }
 
                request->component = "radius";
@@ -230,7 +230,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, UNUSED module_ctx_t co
 
                if (request->parent && RDEBUG_ENABLED) {
                        RDEBUG("Sending %s ID %i", fr_packet_codes[request->reply->code], request->reply->id);
-                       log_request_pair_list(L_DBG_LVL_1, request, NULL, request->reply_pairs, NULL);
+                       log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->reply_pairs, NULL);
                }
                break;
 
index fc98f71366cb6b92334552dad2d09d9e3f99749c..a869fa403be9941b3ed0cd24f69e5fcf2089ae79 100644 (file)
@@ -418,7 +418,7 @@ static int mod_instantiate(void *instance, CONF_SECTION *cs)
         */
        packet_len = fr_radius_encode(inst->packet, inst->max_packet_size, NULL,
                                      client->secret, talloc_array_length(client->secret),
-                                     code, 0, vps);
+                                     code, 0, &vps);
        if (packet_len <= 0) {
                cf_log_perr(cs, "Failed encoding packet from %s",
                            inst->filename);
index 402d8d15cf1091ae4d8ec52c437ebe22a0e546a4..36721adf773dc40911c801f6d40d83099a21973c 100644 (file)
@@ -59,7 +59,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, UNUSED module_ctx_t co
        case REQUEST_INIT:
                if (request->parent && RDEBUG_ENABLED) {
                        RDEBUG("Received %s ID %i", fr_packet_codes[request->packet->code], request->packet->id);
-                       log_request_pair_list(L_DBG_LVL_1, request, NULL, request->request_pairs, NULL);
+                       log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->request_pairs, NULL);
                }
 
                request->component = "radius";
@@ -180,7 +180,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, UNUSED module_ctx_t co
 
                if (request->parent && RDEBUG_ENABLED) {
                        RDEBUG("Sending %s ID %i", fr_packet_codes[request->reply->code], request->reply->id);
-                       log_request_pair_list(L_DBG_LVL_1, request, NULL, request->reply_pairs, NULL);
+                       log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->reply_pairs, NULL);
                }
                break;
 
index f9910a294df683bf86181219b389cf494f2629da..9c447f19339dadde6f7127c57800ce7801a10cd3 100644 (file)
@@ -291,7 +291,7 @@ static int mod_decode(void const *instance, request_t *request, uint8_t *const d
                       request->packet->data_len,
                       request->async->listen->name);
 
-               log_request_pair_list(L_DBG_LVL_1, request, NULL, request->request_pairs, NULL);
+               log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->request_pairs, NULL);
 
                /*
                 *      Maybe the shared secret is wrong?
@@ -384,7 +384,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf
 
        data_len = fr_tacacs_encode(&FR_DBUFF_TMP(buffer, buffer_len), request->packet->data,
                                    client->secret, talloc_array_length(client->secret) - 1,
-                                   request->reply_pairs);
+                                   &request->reply_pairs);
        if (data_len < 0) {
                RPEDEBUG("Failed encoding TACACS+ reply");
                return -1;
@@ -401,7 +401,7 @@ static ssize_t mod_encode(void const *instance, request_t *request, uint8_t *buf
                       data_len,
                       request->async->listen->name);
 
-               log_request_pair_list(L_DBG_LVL_1, request, NULL, request->reply_pairs, NULL);
+               log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->reply_pairs, NULL);
        }
 
        RHEXDUMP3(buffer, data_len, "proto_tacacs encode packet");
index bc327a25078236004d0414e7f0ed7cd6aafc1bc7..269116cbd665a17f1ed009c58ab0e3ba908fc9ad 100644 (file)
@@ -67,7 +67,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, UNUSED module_ctx_t co
        switch (request->request_state) {
        case REQUEST_INIT:
                RDEBUG("Received %s ID %i", fr_vmps_codes[request->packet->code], request->packet->id);
-               log_request_proto_pair_list(L_DBG_LVL_1, request, NULL, request->request_pairs, NULL);
+               log_request_proto_pair_list(L_DBG_LVL_1, request, NULL, &request->request_pairs, NULL);
 
                request->component = "vmps";
 
@@ -184,7 +184,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, UNUSED module_ctx_t co
                } else {
                        RDEBUG("Denying client");
                }
-               if (RDEBUG_ENABLED) log_request_pair_list(L_DBG_LVL_1, request, NULL, request->reply_pairs, NULL);
+               if (RDEBUG_ENABLED) log_request_pair_list(L_DBG_LVL_1, request, NULL, &request->reply_pairs, NULL);
                break;
 
        default:
index e784e4cfeacf857a5aa9f08f5feefd99d7a0802a..8bf66de42ce2e4804d06107f21ff943252bc4e47 100644 (file)
@@ -59,7 +59,7 @@ static unlang_action_t mod_process(rlm_rcode_t *p_result, UNUSED module_ctx_t co
        switch (request->request_state) {
        case REQUEST_INIT:
                RDEBUG("Received %s ID %08x", fr_vmps_codes[request->packet->code], request->packet->id);
-               log_request_proto_pair_list(L_DBG_LVL_1, request, NULL, request->request_pairs, NULL);
+               log_request_proto_pair_list(L_DBG_LVL_1, request, NULL, &request->request_pairs, NULL);
 
                request->component = "vmps";
 
index 06c7d4eeab42a44598915db360903ded7323fedc..6cfbb9092bb9b14455b788549346beaee1a092df 100644 (file)
@@ -39,7 +39,7 @@ typedef struct {
        char const      *field;         //!< Field name.
 } client_get_vp_ctx_t;
 
-static int _map_proc_client_get_vp(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request,
+static int _map_proc_client_get_vp(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request,
                                   map_t const *map, void *uctx)
 {
        client_get_vp_ctx_t     *client = uctx;
index fa8f43943efff4718072f180c3fec45415d7e26e..a36b47e4b55cb4a15f7b4739e70225461d129772 100644 (file)
@@ -604,7 +604,7 @@ json_object *mod_value_pair_to_json_object(request_t *request, fr_pair_t *vp)
  *     - 0 on success.
  *     - -1 on failure.
  */
-int mod_ensure_start_timestamp(json_object *json, fr_pair_t *vps)
+int mod_ensure_start_timestamp(json_object *json, fr_pair_list_t *vps)
 {
        json_object *j_value;      /* json object value */
        struct tm tm;           /* struct to hold event time */
@@ -627,7 +627,7 @@ int mod_ensure_start_timestamp(json_object *json, fr_pair_t *vps)
        }
 
        /* get current event timestamp */
-       if ((vp = fr_pair_find_by_da(&vps, attr_event_timestamp)) != NULL) {
+       if ((vp = fr_pair_find_by_da(vps, attr_event_timestamp)) != NULL) {
                /* get seconds value from attribute */
                ts = fr_time_to_sec(vp->vp_date);
        } else {
@@ -641,7 +641,7 @@ int mod_ensure_start_timestamp(json_object *json, fr_pair_t *vps)
        memset(value, 0, sizeof(value));
 
        /* get elapsed session time */
-       if ((vp = fr_pair_find_by_da(&vps, attr_acct_session_time)) != NULL) {
+       if ((vp = fr_pair_find_by_da(vps, attr_acct_session_time)) != NULL) {
                /* calculate diff */
                ts = (ts - vp->vp_uint32);
                /* calculate start time */
index 9993e1fb9a01cf2bb4e5abb7b18b50aba6f8f7a9..62bf87d85ab51f817b80c2bc582ab8e1b4981176 100644 (file)
@@ -86,7 +86,7 @@ int mod_json_object_to_map(TALLOC_CTX *ctx, fr_cursor_t *out, request_t *request
 
 json_object *mod_value_pair_to_json_object(request_t *request, fr_pair_t *vp);
 
-int mod_ensure_start_timestamp(json_object *json, fr_pair_t *vps);
+int mod_ensure_start_timestamp(json_object *json, fr_pair_list_t *vps);
 
 int mod_client_map_section(CONF_SECTION *client, CONF_SECTION const *map, json_object *json, char const *docid);
 
index f89020637c093a3023bbcc5d20a5a8ad917252cc..02d7c4ecd9dee65868ccb5429de8acbd4a3f2120 100644 (file)
@@ -349,12 +349,12 @@ static unlang_action_t mod_accounting(rlm_rcode_t *p_result, module_ctx_t const
                                               mod_value_pair_to_json_object(request, vp));
                }
                /* check start timestamp and adjust if needed */
-               mod_ensure_start_timestamp(cookie->jobj, request->request_pairs);
+               mod_ensure_start_timestamp(cookie->jobj, &request->request_pairs);
                break;
 
        case FR_STATUS_ALIVE:
                /* check start timestamp and adjust if needed */
-               mod_ensure_start_timestamp(cookie->jobj, request->request_pairs);
+               mod_ensure_start_timestamp(cookie->jobj, &request->request_pairs);
                break;
 
        default:
index 7d468acfbf3a546f86ee848d4aa9d820f7bfd43f..bc1640a431a1ed65c3bc7e21204020c96423dd23 100644 (file)
@@ -841,7 +841,7 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
 /*
  *     Convert field X to a VP.
  */
-static int csv_map_getvalue(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request, map_t const *map, void *uctx)
+static int csv_map_getvalue(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, map_t const *map, void *uctx)
 {
        char const              *str = uctx;
        fr_pair_list_t          head;
index deafd310d1ec156e9283bde10a11e1bf8980078f..5c6082f686a35a18321610491244a7deff6cd5d6 100644 (file)
@@ -686,7 +686,7 @@ static unlang_action_t mod_authenticate(rlm_rcode_t *p_result, module_ctx_t cons
         *      attribute.  The relevant decoder should have already
         *      concatenated the fragments into a single buffer.
         */
-       eap_packet = eap_packet_from_vp(request, request->request_pairs);
+       eap_packet = eap_packet_from_vp(request, &request->request_pairs);
        if (!eap_packet) {
                RPERROR("Malformed EAP Message");
                RETURN_MODULE_FAIL;
index b3dfa759dc84fcd6cbf7b2d01364c14eea8c3ab4..5fa6a378172bd06bb888763911f6bfbed6667eeb 100644 (file)
@@ -592,7 +592,7 @@ static FR_CODE eap_fast_eap_payload(request_t *request, eap_session_t *eap_sessi
        fr_pair_value_memdup(fake->request_pairs, tlv_eap_payload->vp_octets, tlv_eap_payload->vp_length, false);
 
        RDEBUG2("Got tunneled request");
-       log_request_pair_list(L_DBG_LVL_1, fake, NULL, fake->request_pairs, NULL);
+       log_request_pair_list(L_DBG_LVL_1, fake, NULL, &fake->request_pairs, NULL);
 
        /*
         *      Tell the request that it's a fake one.
@@ -795,7 +795,7 @@ static FR_CODE eap_fast_crypto_binding(request_t *request, UNUSED eap_session_t
 }
 
 static FR_CODE eap_fast_process_tlvs(request_t *request, eap_session_t *eap_session,
-                                    fr_tls_session_t *tls_session, fr_pair_t *fast_vps)
+                                    fr_tls_session_t *tls_session, fr_pair_list_t *fast_vps)
 {
        eap_fast_tunnel_t               *t = talloc_get_type_abort(tls_session->opaque, eap_fast_tunnel_t);
        fr_pair_t                       *vp;
@@ -804,7 +804,7 @@ static FR_CODE eap_fast_process_tlvs(request_t *request, eap_session_t *eap_sess
 
        memset(&my_binding, 0, sizeof(my_binding));
 
-       for (vp = fr_cursor_init(&cursor, &fast_vps);
+       for (vp = fr_cursor_init(&cursor, fast_vps);
             vp;
             vp = fr_cursor_next(&cursor)) {
                FR_CODE code = FR_CODE_ACCESS_REJECT;
@@ -955,8 +955,8 @@ FR_CODE eap_fast_process(request_t *request, eap_session_t *eap_session, fr_tls_
                                 data, data_len, NULL) < 0) return FR_CODE_ACCESS_REJECT;
 
        RDEBUG2("Got Tunneled FAST TLVs");
-       log_request_pair_list(L_DBG_LVL_1, request, NULL, fast_vps, NULL);
-       code = eap_fast_process_tlvs(request, eap_session, tls_session, fast_vps);
+       log_request_pair_list(L_DBG_LVL_1, request, NULL, &fast_vps, NULL);
+       code = eap_fast_process_tlvs(request, eap_session, tls_session, &fast_vps);
        fr_pair_list_free(&fast_vps);
 
        if (code == FR_CODE_ACCESS_REJECT) return FR_CODE_ACCESS_REJECT;
index 9489134034eb84ab0538168374079434a9d0cdcb..7b04b84763f134b1da62e79bf9300bf5adc84952 100644 (file)
@@ -523,7 +523,7 @@ static unlang_action_t CC_HINT(nonnull) mod_process(rlm_rcode_t *p_result, modul
                        }
 
                        RDEBUG2("Built change password packet");
-                       log_request_pair_list(L_DBG_LVL_2, request, NULL, request->request_pairs, NULL);
+                       log_request_pair_list(L_DBG_LVL_2, request, NULL, &request->request_pairs, NULL);
 
                        /*
                         * jump to "authentication"
@@ -557,7 +557,7 @@ failure:
 
                        if (data->mppe_keys) {
                                RDEBUG2("Adding stored attributes to parent");
-                               log_request_pair_list(L_DBG_LVL_2, request, NULL, data->mppe_keys, "&parent.reply.");
+                               log_request_pair_list(L_DBG_LVL_2, request, NULL, &data->mppe_keys, "&parent.reply.");
                                MEM(fr_pair_list_copy(parent->reply, &parent->reply->vps, &data->mppe_keys) >= 0);
                        } else {
                                RDEBUG2("No stored attributes to copy to parent");
index 788a2f4326377eeb428b1f6dec94e3077802540d..a475ee8fc59ad8f98f965abfc2919eaf27f56814 100644 (file)
@@ -309,9 +309,9 @@ static fr_pair_t *eap_peap_inner_to_pairs(UNUSED request_t *request, fr_radius_p
  *     Convert a list of fr_pair_t's to an EAP packet, through the
  *     simple expedient of dumping the EAP message
  */
-static int eap_peap_inner_from_pairs(request_t *request, fr_tls_session_t *tls_session, fr_pair_t *vp)
+static int eap_peap_inner_from_pairs(request_t *request, fr_tls_session_t *tls_session, fr_pair_list_t *vps)
 {
-       fr_assert(vp != NULL);
+       fr_assert(*vps != NULL);
        fr_pair_t *this;
        fr_cursor_t cursor;
 
@@ -319,13 +319,13 @@ static int eap_peap_inner_from_pairs(request_t *request, fr_tls_session_t *tls_s
         *      Send the EAP data in the first attribute, WITHOUT the
         *      header.
         */
-       (tls_session->record_from_buff)(&tls_session->clean_in, vp->vp_octets + EAP_HEADER_LEN,
-                                       vp->vp_length - EAP_HEADER_LEN);
+       this = fr_cursor_init(&cursor, vps);
+       (tls_session->record_from_buff)(&tls_session->clean_in, this->vp_octets + EAP_HEADER_LEN,
+                                       this->vp_length - EAP_HEADER_LEN);
 
        /*
         *      Send the rest of the EAP data, but skipping the first VP.
         */
-       fr_cursor_init(&cursor, &vp);
        for (this = fr_cursor_next(&cursor);
             this;
             this = fr_cursor_next(&cursor)) {
@@ -389,7 +389,7 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_session_t *eap_session, fr
                } else {
                        RDEBUG2("Got tunneled reply code %i", reply->code);
                }
-               log_request_pair_list(L_DBG_LVL_2, request, NULL, reply->vps, NULL);
+               log_request_pair_list(L_DBG_LVL_2, request, NULL, &reply->vps, NULL);
        }
 
        switch (reply->code) {
@@ -423,7 +423,7 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(eap_session_t *eap_session, fr
                 *      VP's back to the client.
                 */
                if (vp) {
-                       eap_peap_inner_from_pairs(request, tls_session, vp);
+                       eap_peap_inner_from_pairs(request, tls_session, &vp);
                        fr_pair_list_free(&vp);
                }
 
@@ -706,7 +706,7 @@ unlang_action_t eap_peap_process(rlm_rcode_t *p_result, request_t *request,
        }
 
        RDEBUG2("Got tunneled request");
-       log_request_pair_list(L_DBG_LVL_2, request, NULL, fake->request_pairs, NULL);
+       log_request_pair_list(L_DBG_LVL_2, request, NULL, &fake->request_pairs, NULL);
 
        /*
         *      Update other items in the request_t data structure.
index 75c18e1696841078e689b98765204c2ea8371f04..73dba98e713502dcd2e8298227b7f7c446ba3725 100644 (file)
@@ -573,7 +573,7 @@ static rlm_rcode_t CC_HINT(nonnull) process_reply(NDEBUG_UNUSED eap_session_t *e
         */
        if (tunnel_vps) {
                RDEBUG2("Sending tunneled reply attributes");
-               log_request_pair_list(L_DBG_LVL_2, request, NULL, tunnel_vps, NULL);
+               log_request_pair_list(L_DBG_LVL_2, request, NULL, &tunnel_vps, NULL);
 
                vp2diameter(request, tls_session, tunnel_vps);
                fr_pair_list_free(&tunnel_vps);
@@ -693,7 +693,7 @@ FR_CODE eap_ttls_process(request_t *request, eap_session_t *eap_session, fr_tls_
        /*
         *      Process channel binding.
         */
-       chbind = eap_chbind_vp2packet(request, request->request_pairs);
+       chbind = eap_chbind_vp2packet(request, &request->request_pairs);
        if (chbind) {
                FR_CODE chbind_code;
                CHBIND_REQ *req = talloc_zero(request, CHBIND_REQ);
index b34dd74b04d6ccc3d0232048d04b0a84e80b95b2..2690894c62f1922fee41c25b9f616ff892473a68 100644 (file)
@@ -124,7 +124,7 @@ static ssize_t exec_xlat(UNUSED TALLOC_CTX *ctx, char **out, size_t outlen,
         *      This function does it's own xlat of the input program
         *      to execute.
         */
-       result = radius_exec_program(request, *out, outlen, NULL, request, fmt, input_pairs ? *input_pairs : NULL,
+       result = radius_exec_program(request, *out, outlen, NULL, request, fmt, input_pairs ? input_pairs : NULL,
                                     inst->wait, inst->shell_escape, inst->timeout);
        if (result != 0) return -1;
 
@@ -278,7 +278,7 @@ static unlang_action_t mod_exec_nowait_resume(rlm_rcode_t *p_result, module_ctx_
                env_pairs = *input_pairs;
        }
 
-       if (fr_exec_nowait(request, box, env_pairs) < 0) {
+       if (fr_exec_nowait(request, box, &env_pairs) < 0) {
                RPEDEBUG("Failed executing program");
                RETURN_MODULE_FAIL;
        }
@@ -439,7 +439,7 @@ static unlang_action_t CC_HINT(nonnull) mod_exec_dispatch(rlm_rcode_t *p_result,
 
        m = talloc_zero(ctx, rlm_exec_ctx_t);
 
-       return unlang_module_yield_to_tmpl(m, &m->box, &m->status, request, inst->tmpl, env_pairs, mod_exec_wait_resume, NULL, m);
+       return unlang_module_yield_to_tmpl(m, &m->box, &m->status, request, inst->tmpl, &env_pairs, mod_exec_wait_resume, NULL, m);
 }
 
 
index 19f61bfc8b99726a1485e2b3144f5f0812095538..7032700a02a4d17e2cd370165f9d735215887729 100644 (file)
@@ -110,8 +110,8 @@ static unlang_action_t CC_HINT(nonnull) mod_authorize(rlm_rcode_t *p_result, UNU
 /*
  *      Compare the expiration date.
  */
-static int expirecmp(UNUSED void *instance, request_t *req, UNUSED fr_pair_t *request, fr_pair_t *check,
-                    UNUSED fr_pair_t *check_list)
+static int expirecmp(UNUSED void *instance, request_t *req, UNUSED fr_pair_list_t *request_list, fr_pair_t *check,
+                    UNUSED fr_pair_list_t *check_list)
 {
        time_t now = 0;
 
index 5b5c57d1e076a0425c8c2c7816b9e1f12b302a93..c54a251797bd7bec38683518679deca406db00e4 100644 (file)
@@ -78,10 +78,10 @@ fr_dict_attr_autoload_t rlm_files_dict_attr[] = {
 /*
  *     See if a fr_pair_t list contains Fall-Through = Yes
  */
-static int fall_through(fr_pair_t *vp)
+static int fall_through(fr_pair_list_t const *vps)
 {
        fr_pair_t *tmp;
-       tmp = fr_pair_find_by_da(&vp, attr_fall_through);
+       tmp = fr_pair_find_by_da(vps, attr_fall_through);
 
        return tmp ? tmp->vp_uint32 : 0;
 }
@@ -359,14 +359,14 @@ static unlang_action_t file_common(rlm_rcode_t *p_result, rlm_files_t const *ins
                        }
                }
 
-               if (paircmp(request, packet->vps, check_tmp) == 0) {
+               if (paircmp(request, &packet->vps, &check_tmp) == 0) {
                        RDEBUG2("Found match \"%s\" one line %d of %s", pl->name, pl->lineno, filename);
                        found = true;
 
                        /* ctx may be reply */
                        if (pl->reply) {
                                MEM(fr_pair_list_copy(reply, &reply_tmp, &pl->reply) >= 0);
-                               radius_pairmove(request, &reply->vps, reply_tmp, true);
+                               radius_pairmove(request, &reply->vps, &reply_tmp, true);
                        }
                        fr_pair_list_move(&request->control_pairs, &check_tmp);
 
@@ -376,7 +376,7 @@ static unlang_action_t file_common(rlm_rcode_t *p_result, rlm_files_t const *ins
                        /*
                         *      Fallthrough?
                         */
-                       if (!fall_through(pl->reply)) break;
+                       if (!fall_through(&pl->reply)) break;
                }
 
                /* Ensure temporary check list is clear before next match */
index f2ecd897b79a5c20b7359172766d917338c39020..60367b8d6699e4c7716f14723b956cec24d80d9b 100644 (file)
@@ -283,7 +283,7 @@ static xlat_action_t json_encode_xlat(TALLOC_CTX *ctx, fr_cursor_t *out, request
         */
        MEM(vb = fr_value_box_alloc_null(ctx));
 
-       json_str = fr_json_afrom_pair_list(vb, json_vps, format);
+       json_str = fr_json_afrom_pair_list(vb, &json_vps, format);
        if (!json_str) {
                REDEBUG("Failed to generate JSON string");
                goto error;
@@ -393,7 +393,7 @@ static int mod_map_proc_instantiate(CONF_SECTION *cs, UNUSED void *mod_inst, voi
  *     - 0 on success.
  *     - -1 on failure.
  */
-static int _json_map_proc_get_value(TALLOC_CTX *ctx, fr_pair_t **out, request_t *request,
+static int _json_map_proc_get_value(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request,
                                    map_t const *map, void *uctx)
 {
        fr_pair_t                       *vp;
@@ -402,7 +402,7 @@ static int _json_map_proc_get_value(TALLOC_CTX *ctx, fr_pair_t **out, request_t
        fr_value_box_t                  *head, *value;
        int                             ret;
 
-       *out = NULL;
+       fr_pair_list_init(out);
 
        ret = fr_jpath_evaluate_leaf(request, &head, tmpl_da(map->lhs)->type, tmpl_da(map->lhs),
                                     to_eval->root, to_eval->jpath);
index b61ac2a7b43dd3412cd81aa5aaf636ce1ff13f13..40c93c99e28910b3b0403efb6661976935e70347 100644 (file)
@@ -586,15 +586,15 @@ free_urldesc:
  *
  * @param instance of the rlm_ldap module.
  * @param request Current request.
- * @param thing Unknown.
+ * @param request_list Unknown.
  * @param check Which group to check for user membership.
  * @param check_list Unknown.
  * @return
  *     - 1 on failure (or if the user is not a member).
  *     - 0 on success.
  */
-static int rlm_ldap_groupcmp(void *instance, request_t *request, UNUSED fr_pair_t *thing, fr_pair_t *check,
-                            UNUSED fr_pair_t *check_list)
+static int rlm_ldap_groupcmp(void *instance, request_t *request, UNUSED fr_pair_list_t *request_list, fr_pair_t *check,
+                            UNUSED fr_pair_list_t *check_list)
 {
        rlm_ldap_t const        *inst = talloc_get_type_abort_const(instance, rlm_ldap_t);
        rlm_rcode_t             rcode;
index da32b65429ac3bb43f19da5a3d6de6dcf615099d..7b7607f7da74ee2390f5ec45d869e75d03630da4 100644 (file)
@@ -78,8 +78,8 @@ fr_dict_attr_autoload_t rlm_logintime_dict_attr[] = {
 /*
  *      Compare the current time to a range.
  */
-static int timecmp(UNUSED void *instance, request_t *req, UNUSED fr_pair_t *request, fr_pair_t *check,
-                  UNUSED fr_pair_t *check_list)
+static int timecmp(UNUSED void *instance, request_t *req, UNUSED fr_pair_list_t *request_list, fr_pair_t *check,
+                  UNUSED fr_pair_list_t *check_list)
 {
        /*
         *      If there's a request, use that timestamp.
@@ -94,8 +94,8 @@ static int timecmp(UNUSED void *instance, request_t *req, UNUSED fr_pair_t *requ
  *     Time-Of-Day support
  */
 static int time_of_day(UNUSED void *instance, request_t *request,
-                      UNUSED fr_pair_t *request_list, fr_pair_t *check,
-                      UNUSED fr_pair_t *check_list)
+                      UNUSED fr_pair_list_t *request_list, fr_pair_t *check,
+                      UNUSED fr_pair_list_t *check_list)
 {
        int             scan;
        int             hhmmss, when;
index 6361b9cfd5c1fb72b08976dc6aa33c7ced8722f2..8e770c063fecc91cf76fd9619e4373450b8a149f 100644 (file)
@@ -210,7 +210,7 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
        return 0;
 }
 
-static int mruby_vps_to_array(request_t *request, mrb_value *out, mrb_state *mrb, fr_pair_t **vps)
+static int mruby_vps_to_array(request_t *request, mrb_value *out, mrb_state *mrb, fr_pair_list_t *vps)
 {
        mrb_value       res;
        fr_pair_t       *vp;
@@ -302,7 +302,7 @@ static int mruby_vps_to_array(request_t *request, mrb_value *out, mrb_state *mrb
        return 0;
 }
 
-static void add_vp_tuple(TALLOC_CTX *ctx, request_t *request, fr_pair_t **vps, mrb_state *mrb, mrb_value value, char const *function_name)
+static void add_vp_tuple(TALLOC_CTX *ctx, request_t *request, fr_pair_list_t *vps, mrb_state *mrb, mrb_value value, char const *function_name)
 {
        int i;
 
@@ -384,7 +384,7 @@ static void add_vp_tuple(TALLOC_CTX *ctx, request_t *request, fr_pair_t **vps, m
 }
 
 static inline int mruby_set_vps(request_t *request, mrb_state *mrb, mrb_value mruby_request,
-                               char const *list_name, fr_pair_t **vps)
+                               char const *list_name, fr_pair_list_t *vps)
 {
        mrb_value res;
 
index cc175702e00809aebdc5b82466caf206f4301549..3529ce6d80a62bd3529578811def73c5c4a17123 100644 (file)
@@ -513,7 +513,7 @@ static int mod_detach (void *instance) {
 }
 
 static void result_add(TALLOC_CTX *ctx, rlm_passwd_t const *inst, request_t *request,
-                      fr_pair_t **vps, struct mypasswd * pw, char when, char const *listname)
+                      fr_pair_list_t *vps, struct mypasswd * pw, char when, char const *listname)
 {
        uint32_t i;
        fr_pair_t *vp;
index f842338771aa09276d51f01066e282ccd3ac168b..2a8cae6674278ecda3030805a88268d4e772e572 100644 (file)
@@ -672,7 +672,7 @@ static void perl_vp_to_svpvn_element(request_t *request, AV *av, fr_pair_t const
  *     Example for this is Vendor-Specific.Cisco.AVPair that holds multiple values.
  *     Which will be available as array_ref in $RAD_REQUEST{'Vendor-Specific.Cisco.AVPair'}
  */
-static void perl_store_vps(UNUSED TALLOC_CTX *ctx, request_t *request, fr_pair_t **vps, HV *rad_hv,
+static void perl_store_vps(UNUSED TALLOC_CTX *ctx, request_t *request, fr_pair_list_t *vps, HV *rad_hv,
                           const char *hash_name, const char *list_name)
 {
        fr_pair_t *vp;
@@ -749,7 +749,7 @@ static void perl_store_vps(UNUSED TALLOC_CTX *ctx, request_t *request, fr_pair_t
  *     Value Pair Format
  *
  */
-static int pairadd_sv(TALLOC_CTX *ctx, request_t *request, fr_pair_t **vps, char *key, SV *sv, fr_token_t op,
+static int pairadd_sv(TALLOC_CTX *ctx, request_t *request, fr_pair_list_t *vps, char *key, SV *sv, fr_token_t op,
                      const char *hash_name, const char *list_name)
 {
        char            *val;
@@ -790,7 +790,7 @@ static int pairadd_sv(TALLOC_CTX *ctx, request_t *request, fr_pair_t **vps, char
 /*
  *     Gets the content from hashes
  */
-static int get_hv_content(TALLOC_CTX *ctx, request_t *request, HV *my_hv, fr_pair_t **vps,
+static int get_hv_content(TALLOC_CTX *ctx, request_t *request, HV *my_hv, fr_pair_list_t *vps,
                          const char *hash_name, const char *list_name)
 {
        SV              *res_sv, **av_sv;
index 1a9b7610143e9f1b57bb828310dc598c337d9b48..60ebd973f6a1a4017cc331c98028d518e7d53b46 100644 (file)
@@ -269,7 +269,7 @@ failed:
 }
 
 static void mod_vptuple(TALLOC_CTX *ctx, rlm_python_t const *inst, request_t *request,
-                       fr_pair_t **vps, PyObject *p_value, char const *funcname, char const *list_name)
+                       fr_pair_list_t *vps, PyObject *p_value, char const *funcname, char const *list_name)
 {
        int             i;
        Py_ssize_t      tuple_len;
@@ -376,7 +376,7 @@ static void mod_vptuple(TALLOC_CTX *ctx, rlm_python_t const *inst, request_t *re
                              fr_table_str_by_value(fr_tokens_table, op, "="), s2);
                }
 
-               radius_pairmove(current, vps, vp, false);
+               radius_pairmove(current, vps, &vp, false);
        }
 }
 
index cb6aac51c478322e49226d8a96cba9a2f9c9325f..7c4c781520edb77110d824fdc86a690eef2b41a1 100644 (file)
@@ -265,7 +265,7 @@ static void         conn_writable_status_check(UNUSED fr_event_list_t *el, UNUSED int f
 
 static int             encode(rlm_radius_udp_t const *inst, request_t *request, udp_request_t *u, uint8_t id);
 
-static decode_fail_t   decode(TALLOC_CTX *ctx, fr_pair_t **reply, uint8_t *response_code,
+static decode_fail_t   decode(TALLOC_CTX *ctx, fr_pair_list_t *reply, uint8_t *response_code,
                               udp_handle_t *h, request_t *request, udp_request_t *u,
                               uint8_t const request_authenticator[static RADIUS_AUTH_VECTOR_LENGTH],
                               uint8_t *data, size_t data_len);
@@ -426,7 +426,7 @@ static void CC_HINT(nonnull) status_check_alloc(fr_event_list_t *el, udp_handle_
        request->packet->code = u->code;
 
        DEBUG3("%s - Status check packet type will be %s", h->module_name, fr_packet_codes[u->code]);
-       log_request_pair_list(L_DBG_LVL_3, request, NULL, request->request_pairs, NULL);
+       log_request_pair_list(L_DBG_LVL_3, request, NULL, &request->request_pairs, NULL);
 
        MEM(h->status_r = talloc_zero(request, udp_result_t));
        h->status_u = u;
@@ -1176,7 +1176,7 @@ static int8_t request_prioritise(void const *one, void const *two)
  *     - DECODE_FAIL_NONE on success.
  *     - DECODE_FAIL_* on failure.
  */
-static decode_fail_t decode(TALLOC_CTX *ctx, fr_pair_t **reply, uint8_t *response_code,
+static decode_fail_t decode(TALLOC_CTX *ctx, fr_pair_list_t *reply, uint8_t *response_code,
                            udp_handle_t *h, request_t *request, udp_request_t *u,
                            uint8_t const request_authenticator[static RADIUS_AUTH_VECTOR_LENGTH],
                            uint8_t *data, size_t data_len)
@@ -1251,7 +1251,7 @@ static decode_fail_t decode(TALLOC_CTX *ctx, fr_pair_t **reply, uint8_t *respons
 
        RDEBUG("Received %s ID %d length %ld reply packet on connection %s",
               fr_packet_codes[code], code, packet_len, h->name);
-       log_request_pair_list(L_DBG_LVL_2, request, NULL, *reply, NULL);
+       log_request_pair_list(L_DBG_LVL_2, request, NULL, reply, NULL);
 
        *response_code = code;
 
@@ -1355,7 +1355,7 @@ static int encode(rlm_radius_udp_t const *inst, request_t *request, udp_request_
         */
        packet_len = fr_radius_encode(u->packet, u->packet_len - (proxy_state + message_authenticator), NULL,
                                      inst->secret, talloc_array_length(inst->secret) - 1,
-                                     u->code, id, request->request_pairs);
+                                     u->code, id, &request->request_pairs);
        if (fr_pair_encode_is_error(packet_len)) {
                RPERROR("Failed encoding packet");
 
@@ -1840,8 +1840,8 @@ static void request_mux(fr_event_list_t *el,
                               fr_packet_codes[u->code], u->id, u->packet_len, h->name);
                }
 
-               log_request_pair_list(L_DBG_LVL_2, request, NULL, request->request_pairs, NULL);
-               if (u->extra) log_request_pair_list(L_DBG_LVL_2, request, NULL, u->extra, NULL);
+               log_request_pair_list(L_DBG_LVL_2, request, NULL, &request->request_pairs, NULL);
+               if (u->extra) log_request_pair_list(L_DBG_LVL_2, request, NULL, &u->extra, NULL);
 
                /*
                 *      Record pointers to the buffer we'll be writing
index 1887f4fd35ad9408002891c97bdd01acdf4d408a..cbd96344ab6bc280d761ded55e93a47442d93d37 100644 (file)
@@ -546,7 +546,7 @@ static size_t rest_encode_json(void *out, size_t size, size_t nmemb, void *userd
        fr_assert(freespace > 0);
 
        if (ctx->state == READ_STATE_INIT) {
-               encoded = fr_json_afrom_pair_list(data, request->request_pairs, NULL);
+               encoded = fr_json_afrom_pair_list(data, &request->request_pairs, NULL);
                if (!encoded) return -1;
 
                data->start = data->p = encoded;
@@ -1158,7 +1158,7 @@ static int json_pair_alloc(rlm_rest_t const *instance, rlm_rest_section_t const
                        RINDENT();
                        RDEBUG2("&%s:%pP", fr_table_str_by_value(pair_list_table, tmpl_list(dst), ""), vp);
                        REXDENT();
-                       radius_pairmove(current, vps, vp, false);
+                       radius_pairmove(current, vps, &vp, false);
                /*
                 *  If we call json_object_array_get_idx on something that's not an array
                 *  the behaviour appears to be to occasionally segfault.
index 3615703ba2959e2baed3359a25cb9099fb1db0b1..002731274bdf346841cbfd1e4823f06cd8f2fbf2 100644 (file)
@@ -145,10 +145,10 @@ static size_t sql_escape_for_xlat_func(request_t *request, char *out, size_t out
 /*
  *     Fall-Through checking function from rlm_files.c
  */
-static sql_fall_through_t fall_through(fr_pair_t *vp)
+static sql_fall_through_t fall_through(fr_pair_list_t *vps)
 {
        fr_pair_t *tmp;
-       tmp = fr_pair_find_by_da(&vp, attr_fall_through);
+       tmp = fr_pair_find_by_da(vps, attr_fall_through);
 
        return tmp ? tmp->vp_uint32 : FALL_THROUGH_DEFAULT;
 }
@@ -275,12 +275,15 @@ finish:
  *     - 0 on success.
  *     - -1 on failure.
  */
-static int _sql_map_proc_get_value(TALLOC_CTX *ctx, fr_pair_t **out,
+static int _sql_map_proc_get_value(TALLOC_CTX *ctx, fr_pair_list_t *out,
                                   request_t *request, map_t const *map, void *uctx)
 {
        fr_pair_t       *vp;
        char const      *value = uctx;
+       fr_cursor_t     cursor;
 
+       fr_pair_list_init(out);
+       fr_cursor_init(&cursor, out);
        vp = fr_pair_afrom_da(ctx, tmpl_da(map->lhs));
        if (!vp) return -1;
 
@@ -297,7 +300,7 @@ static int _sql_map_proc_get_value(TALLOC_CTX *ctx, fr_pair_t **out,
        }
 
        vp->op = map->op;
-       *out = vp;
+       fr_cursor_append(&cursor, vp);
 
        return 0;
 }
@@ -728,11 +731,11 @@ static int sql_get_grouplist(rlm_sql_t const *inst, rlm_sql_handle_t **handle, r
  * The group membership query should only return one element which is the username. The returned
  * username will then be checked with the passed check string.
  */
-static int sql_groupcmp(void *instance, request_t *request, UNUSED fr_pair_t *request_vp,
-                       fr_pair_t *check, UNUSED fr_pair_t *check_list) CC_HINT(nonnull (1, 2, 4));
+static int sql_groupcmp(void *instance, request_t *request, UNUSED fr_pair_list_t *request_list,
+                       fr_pair_t *check, UNUSED fr_pair_list_t *check_list) CC_HINT(nonnull (1, 2, 4));
 
-static int sql_groupcmp(void *instance, request_t *request, UNUSED fr_pair_t *request_vp,
-                       fr_pair_t *check, UNUSED fr_pair_t *check_list)
+static int sql_groupcmp(void *instance, request_t *request, UNUSED fr_pair_list_t *request_list,
+                       fr_pair_t *check, UNUSED fr_pair_list_t *check_list)
 {
        rlm_sql_handle_t        *handle;
        rlm_sql_t const         *inst = talloc_get_type_abort_const(instance, rlm_sql_t);
@@ -881,7 +884,7 @@ static unlang_action_t rlm_sql_process_groups(rlm_rcode_t *p_result,
                         *      process the reply rows
                         */
                        if ((rows > 0) &&
-                           (paircmp(request, request->request_pairs, check_tmp) != 0)) {
+                           (paircmp(request, &request->request_pairs, &check_tmp) != 0)) {
                                fr_pair_list_free(&check_tmp);
                                entry = entry->next;
 
@@ -904,7 +907,7 @@ static unlang_action_t rlm_sql_process_groups(rlm_rcode_t *p_result,
                                RDEBUG2("&%pP", vp);
                        }
                        REXDENT();
-                       radius_pairmove(request, &request->control_pairs, check_tmp, true);
+                       radius_pairmove(request, &request->control_pairs, &check_tmp, true);
 
                        fr_pair_list_init(&check_tmp);
                }
@@ -937,14 +940,14 @@ static unlang_action_t rlm_sql_process_groups(rlm_rcode_t *p_result,
                        }
 
                        fr_assert(reply_tmp != NULL); /* coverity, among others */
-                       *do_fall_through = fall_through(reply_tmp);
+                       *do_fall_through = fall_through(&reply_tmp);
 
                        RDEBUG2("Group \"%s\": Merging reply items", entry->name);
                        if (rcode == RLM_MODULE_NOOP) rcode = RLM_MODULE_UPDATED;
 
-                       log_request_pair_list(L_DBG_LVL_2, request, NULL, reply_tmp, NULL);
+                       log_request_pair_list(L_DBG_LVL_2, request, NULL, &reply_tmp, NULL);
 
-                       radius_pairmove(request, &request->reply_pairs, reply_tmp, true);
+                       radius_pairmove(request, &request->reply_pairs, &reply_tmp, true);
                        fr_pair_list_init(&reply_tmp);
                /*
                 *      If there's no reply query configured, then we assume
@@ -1266,7 +1269,7 @@ static unlang_action_t CC_HINT(nonnull) mod_authorize(rlm_rcode_t *p_result, mod
                 */
                RDEBUG2("User found in radcheck table");
                user_found = true;
-               if (paircmp(request, request->request_pairs, check_tmp) != 0) {
+               if (paircmp(request, &request->request_pairs, &check_tmp) != 0) {
                        fr_pair_list_free(&check_tmp);
                        check_tmp = NULL;
                        goto skip_reply;
@@ -1281,7 +1284,7 @@ static unlang_action_t CC_HINT(nonnull) mod_authorize(rlm_rcode_t *p_result, mod
                        RDEBUG2("&%pP", vp);
                }
                REXDENT();
-               radius_pairmove(request, &request->control_pairs, check_tmp, true);
+               radius_pairmove(request, &request->control_pairs, &check_tmp, true);
 
                rcode = RLM_MODULE_OK;
                check_tmp = NULL;
@@ -1311,14 +1314,14 @@ static unlang_action_t CC_HINT(nonnull) mod_authorize(rlm_rcode_t *p_result, mod
 
                if (rows == 0) goto skip_reply;
 
-               do_fall_through = fall_through(reply_tmp);
+               do_fall_through = fall_through(&reply_tmp);
 
                RDEBUG2("User found in radreply table, merging reply items");
                user_found = true;
 
-               log_request_pair_list(L_DBG_LVL_2, request, NULL, reply_tmp, NULL);
+               log_request_pair_list(L_DBG_LVL_2, request, NULL, &reply_tmp, NULL);
 
-               radius_pairmove(request, &request->reply_pairs, reply_tmp, true);
+               radius_pairmove(request, &request->reply_pairs, &reply_tmp, true);
 
                rcode = RLM_MODULE_OK;
                reply_tmp = NULL;
index 75fcd5b7be149f5f188cbe308c937be994cd3781..cd9353421c5066c193f57ae4c2df1aa745d60a3b 100644 (file)
@@ -340,8 +340,8 @@ static ssize_t sqlcounter_expand(char *out, int outlen, rlm_sqlcounter_t const *
 /*
  *     See if the counter matches.
  */
-static int counter_cmp(void *instance, request_t *request, UNUSED fr_pair_t *req , fr_pair_t *check,
-                      UNUSED fr_pair_t *check_list)
+static int counter_cmp(void *instance, request_t *request, UNUSED fr_pair_list_t *request_list , fr_pair_t *check,
+                      UNUSED fr_pair_list_t *check_list)
 {
        rlm_sqlcounter_t const *inst = talloc_get_type_abort_const(instance, rlm_sqlcounter_t);
        uint64_t counter;
index 6ca67a00fd6589a20ed174da2191bd85ceac3411..1d4680c61463224f2a066d0777735a0714464367 100644 (file)
@@ -189,8 +189,8 @@ fr_dict_attr_autoload_t rlm_test_dict_attr[] = {
        { NULL }
 };
 
-static int rlm_test_cmp(UNUSED void *instance, request_t *request, UNUSED fr_pair_t *thing, fr_pair_t *check,
-                       UNUSED fr_pair_t *check_list)
+static int rlm_test_cmp(UNUSED void *instance, request_t *request, UNUSED fr_pair_list_t *request_list, fr_pair_t *check,
+                       UNUSED fr_pair_list_t *check_list)
 {
        fr_assert(check->vp_type == FR_TYPE_STRING);
 
index 8d405dcdc3a6b6016b12c563de23feb990cc9d63..2c25de836eaaa5372a5e12d92e58d2887caa6517 100644 (file)
@@ -100,8 +100,8 @@ fr_dict_attr_autoload_t rlm_unix_dict_attr[] = {
 /*
  *     The Unix-Group = handler.
  */
-static int groupcmp(UNUSED void *instance, request_t *request, UNUSED fr_pair_t *req_vp,
-                   fr_pair_t *check, UNUSED fr_pair_t *check_list)
+static int groupcmp(UNUSED void *instance, request_t *request, UNUSED fr_pair_list_t *request_list,
+                   fr_pair_t *check, UNUSED fr_pair_list_t *check_list)
 {
        struct passwd   *pwd;
        struct group    *grp;
index c50a13c78284a5a0c3ebf9c0fafe8df16ad5b35a..b19f23b90fda9e01323d4a3eeaf00a248c7500e9 100644 (file)
@@ -76,7 +76,7 @@ fr_dict_attr_autoload_t rlm_winbind_dict_attr[] = {
  *
  * @param instance     Instance of this module
  * @param request      The current request
- * @param req          The request list
+ * @param request_list The request list
  * @param check                Value pair containing group to be searched
  * @param check_list   Unknown
  *
@@ -84,8 +84,8 @@ fr_dict_attr_autoload_t rlm_winbind_dict_attr[] = {
  *     - 0 user is in group
  *     - 1 failure or user is not in group
  */
-static int winbind_group_cmp(void *instance, request_t *request, UNUSED fr_pair_t *req, fr_pair_t *check,
-                            UNUSED fr_pair_t *check_list)
+static int winbind_group_cmp(void *instance, request_t *request, UNUSED fr_pair_list_t *request_list, fr_pair_t *check,
+                            UNUSED fr_pair_list_t *check_list)
 {
        rlm_winbind_t           *inst = instance;
        int                     ret = 1;
index f1a2edbdf938451bfe556e96aa036d2ad7302b44..c30344e85666e7051baaddb014f6078e2f950c45 100644 (file)
@@ -40,7 +40,7 @@
 int fr_arp_init(void);
 void fr_arp_free(void);
 
-ssize_t fr_arp_encode(fr_dbuff_t *dbuff, uint8_t const *original, fr_pair_t *vps);
+ssize_t fr_arp_encode(fr_dbuff_t *dbuff, uint8_t const *original, fr_pair_list_t *vps);
 ssize_t fr_arp_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_len, fr_pair_list_t *list);
 
 int fr_arp_entry_add(int fd, char const *interface, uint8_t ipaddr[static 4], uint8_t macaddr[static 6]);
index db6db694649e0e4bd1d7390d6481aeaf586cc35a..355a8147f24f98bd0e8b35ca244073d4a1730d10 100644 (file)
@@ -141,7 +141,7 @@ int fr_arp_entry_add(UNUSED int fd, UNUSED char const *interface,
 /** Encode VPS into a raw ARP packet.
  *
  */
-ssize_t fr_arp_encode(fr_dbuff_t *dbuff, uint8_t const *original, fr_pair_t *vps)
+ssize_t fr_arp_encode(fr_dbuff_t *dbuff, uint8_t const *original, fr_pair_list_t *vps)
 {
        ssize_t                 slen;
        fr_pair_t               *vp;
@@ -150,7 +150,7 @@ ssize_t fr_arp_encode(fr_dbuff_t *dbuff, uint8_t const *original, fr_pair_t *vps
        fr_da_stack_t           da_stack;
        fr_dbuff_t              work_dbuff = FR_DBUFF_NO_ADVANCE(dbuff);
 
-       if (!vps) {
+       if (!*vps) {
                fr_strerror_printf("Cannot encode empty packet");
                return -1;
        }
@@ -158,7 +158,7 @@ ssize_t fr_arp_encode(fr_dbuff_t *dbuff, uint8_t const *original, fr_pair_t *vps
        /*
         *      Find the first attribute which is parented by ARP-Packet.
         */
-       for (vp = fr_cursor_init(&cursor, &vps);
+       for (vp = fr_cursor_init(&cursor, vps);
             vp;
             vp = fr_cursor_next(&cursor)) {
                if (vp->da->parent == attr_arp_packet) break;
@@ -330,7 +330,7 @@ static int encode_test_ctx(void **out, TALLOC_CTX *ctx)
  *     Because ARP has no TLVs, we don't have test points for pair
  *     encode / decode.
  */
-static ssize_t fr_arp_encode_proto(UNUSED TALLOC_CTX *ctx, fr_pair_t *vps, uint8_t *data, size_t data_len, UNUSED void *proto_ctx)
+static ssize_t fr_arp_encode_proto(UNUSED TALLOC_CTX *ctx, fr_pair_list_t *vps, uint8_t *data, size_t data_len, UNUSED void *proto_ctx)
 {
        return fr_arp_encode(&FR_DBUFF_TMP(data, data_len), NULL, vps);
 }
index 5fc35d7af70f2cc9b4b01a6ab18cabd574f2b4fe..2a19ed7ccfa50d702c201bb325a07fb14838f945 100644 (file)
@@ -289,12 +289,12 @@ bool fr_dhcpv4_is_encodable(void const *item, UNUSED void const *uctx)
        return (vp->da->dict == dict_dhcpv4) && (!vp->da->flags.internal);
 }
 
-ssize_t fr_dhcpv4_encode(uint8_t *buffer, size_t buflen, dhcp_packet_t *original, int code, uint32_t xid, fr_pair_t *vps)
+ssize_t fr_dhcpv4_encode(uint8_t *buffer, size_t buflen, dhcp_packet_t *original, int code, uint32_t xid, fr_pair_list_t *vps)
 {
        return fr_dhcpv4_encode_dbuff(&FR_DBUFF_TMP(buffer, buflen), original, code, xid, vps);
 }
 
-ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int code, uint32_t xid, fr_pair_t *vps)
+ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int code, uint32_t xid, fr_pair_list_t *vps)
 {
        fr_cursor_t     cursor;
        fr_pair_t       *vp;
@@ -314,7 +314,7 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c
         */
 
        /* Maximum-Msg-Size */
-       vp = fr_pair_find_by_da(&vps, attr_dhcp_dhcp_maximum_msg_size);
+       vp = fr_pair_find_by_da(vps, attr_dhcp_dhcp_maximum_msg_size);
        if (vp && (vp->vp_uint32 > mms)) {
                mms = vp->vp_uint32;
 
@@ -322,7 +322,7 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c
        }
 #endif
 
-       vp = fr_pair_find_by_da(&vps, attr_dhcp_opcode);
+       vp = fr_pair_find_by_da(vps, attr_dhcp_opcode);
        if (vp) {
                FR_DBUFF_IN_RETURN(&work_dbuff, (uint8_t) vp->vp_uint8);
        } else {
@@ -330,7 +330,7 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c
        }
 
        /* Hardware-Type */
-       vp = fr_pair_find_by_da(&vps, attr_dhcp_hardware_type);
+       vp = fr_pair_find_by_da(vps, attr_dhcp_hardware_type);
        if (vp) {
                FR_DBUFF_IN_RETURN(&work_dbuff, vp->vp_uint8);
 
@@ -342,7 +342,7 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c
        }
 
        /* Hardware-Address-len */
-       vp = fr_pair_find_by_da(&vps, attr_dhcp_hardware_address_length);
+       vp = fr_pair_find_by_da(vps, attr_dhcp_hardware_address_length);
        if (vp) {
                FR_DBUFF_IN_RETURN(&work_dbuff, vp->vp_uint8);
 
@@ -354,7 +354,7 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c
        }
 
        /* Hop-Count */
-       vp = fr_pair_find_by_da(&vps, attr_dhcp_hop_count);
+       vp = fr_pair_find_by_da(vps, attr_dhcp_hop_count);
        if (vp) {
                FR_DBUFF_IN_RETURN(&work_dbuff, vp->vp_uint8);
 
@@ -369,7 +369,7 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c
        FR_DBUFF_IN_RETURN(&work_dbuff, xid);
 
        /* Number-of-Seconds */
-       vp = fr_pair_find_by_da(&vps, attr_dhcp_number_of_seconds);
+       vp = fr_pair_find_by_da(vps, attr_dhcp_number_of_seconds);
        if (vp) {
                FR_DBUFF_IN_RETURN(&work_dbuff, vp->vp_uint16);
        } else {
@@ -377,7 +377,7 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c
        }
 
        /* Flags */
-       vp = fr_pair_find_by_da(&vps, attr_dhcp_flags);
+       vp = fr_pair_find_by_da(vps, attr_dhcp_flags);
        if (vp) {
                FR_DBUFF_IN_RETURN(&work_dbuff, vp->vp_uint16);
        } else {
@@ -385,7 +385,7 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c
        }
 
        /* Client-IP-Address */
-       vp = fr_pair_find_by_da(&vps, attr_dhcp_client_ip_address);
+       vp = fr_pair_find_by_da(vps, attr_dhcp_client_ip_address);
        if (vp) {
                FR_DBUFF_IN_MEMCPY_RETURN(&work_dbuff, (uint8_t const *)&vp->vp_ipv4addr, sizeof(vp->vp_ipv4addr));
        } else {
@@ -393,7 +393,7 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c
        }
 
        /* Your-IP-address */
-       vp = fr_pair_find_by_da(&vps, attr_dhcp_your_ip_address);
+       vp = fr_pair_find_by_da(vps, attr_dhcp_your_ip_address);
        if (vp) {
                FR_DBUFF_IN_MEMCPY_RETURN(&work_dbuff, (uint8_t const *)&vp->vp_ipv4addr, sizeof(vp->vp_ipv4addr));
        } else {
@@ -401,7 +401,7 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c
        }
 
        /* Server-IP-Address */
-       vp = fr_pair_find_by_da(&vps, attr_dhcp_server_ip_address);
+       vp = fr_pair_find_by_da(vps, attr_dhcp_server_ip_address);
        if (vp) {
                FR_DBUFF_IN_MEMCPY_RETURN(&work_dbuff, (uint8_t const *)&vp->vp_ipv4addr, sizeof(vp->vp_ipv4addr));
        } else {
@@ -411,7 +411,7 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c
        /*
         *      Gateway-IP-Address
         */
-       vp = fr_pair_find_by_da(&vps, attr_dhcp_gateway_ip_address);
+       vp = fr_pair_find_by_da(vps, attr_dhcp_gateway_ip_address);
        if (vp) {
                FR_DBUFF_IN_MEMCPY_RETURN(&work_dbuff, (uint8_t const *)&vp->vp_ipv4addr, sizeof(vp->vp_ipv4addr));
 
@@ -423,7 +423,7 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c
        }
 
        /* Client-Hardware-Address */
-       if ((vp = fr_pair_find_by_da(&vps, attr_dhcp_client_hardware_address))) {
+       if ((vp = fr_pair_find_by_da(vps, attr_dhcp_client_hardware_address))) {
                FR_DBUFF_IN_MEMCPY_RETURN(&work_dbuff, (uint8_t const *)vp->vp_ether, sizeof(vp->vp_ether));
                FR_DBUFF_MEMSET_RETURN(&work_dbuff, 0, DHCP_CHADDR_LEN - sizeof(vp->vp_ether));
 
@@ -435,7 +435,7 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c
        }
 
        /* Server-Host-Name */
-       if ((vp = fr_pair_find_by_da(&vps, attr_dhcp_server_host_name))) {
+       if ((vp = fr_pair_find_by_da(vps, attr_dhcp_server_host_name))) {
                if (vp->vp_length > DHCP_SNAME_LEN) {
                        FR_DBUFF_IN_MEMCPY_RETURN(&work_dbuff, vp->vp_strvalue, DHCP_SNAME_LEN);
                } else {
@@ -457,7 +457,7 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c
         */
 
        /* Boot-Filename */
-       if ((vp = fr_pair_find_by_da(&vps, attr_dhcp_boot_filename))) {
+       if ((vp = fr_pair_find_by_da(vps, attr_dhcp_boot_filename))) {
                if (vp->vp_length > DHCP_FILE_LEN) {
                        FR_DBUFF_IN_MEMCPY_RETURN(&work_dbuff, vp->vp_strvalue, DHCP_FILE_LEN);
                } else {
@@ -471,7 +471,7 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c
        /* DHCP magic number */
        FR_DBUFF_IN_RETURN(&work_dbuff, (uint32_t) DHCP_OPTION_MAGIC_NUMBER);
 
-       if ((vp = fr_pair_find_by_da(&vps, attr_dhcp_message_type))) {
+       if ((vp = fr_pair_find_by_da(vps, attr_dhcp_message_type))) {
                FR_DBUFF_IN_BYTES_RETURN(&work_dbuff, FR_MESSAGE_TYPE, 0x01, vp->vp_uint8);
        } else {
                FR_DBUFF_IN_BYTES_RETURN(&work_dbuff, FR_MESSAGE_TYPE, 0x01, (uint8_t)code);
@@ -481,8 +481,8 @@ ssize_t fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int c
         *  Pre-sort attributes into contiguous blocks so that fr_dhcpv4_encode_option
         *  operates correctly. This changes the order of the list, but never mind...
         */
-       fr_pair_list_sort(&vps, fr_dhcpv4_attr_cmp);
-       fr_cursor_talloc_iter_init(&cursor, &vps, fr_proto_next_encodable, dict_dhcpv4, fr_pair_t);
+       fr_pair_list_sort(vps, fr_dhcpv4_attr_cmp);
+       fr_cursor_talloc_iter_init(&cursor, vps, fr_proto_next_encodable, dict_dhcpv4, fr_pair_t);
 
        /*
         *  Each call to fr_dhcpv4_encode_option will encode one complete DHCP option,
index 535d23d695f910ec7c9f61037d9a79c415728678..776f17e89efb2be7e42ee4292dea1a2dc45d251a 100644 (file)
@@ -147,8 +147,8 @@ int8_t              fr_dhcpv4_attr_cmp(void const *a, void const *b);
 bool           fr_dhcpv4_ok(uint8_t const *data, ssize_t data_len, uint8_t *message_type, uint32_t *xid);
 fr_radius_packet_t     *fr_dhcpv4_packet_alloc(uint8_t const *data, ssize_t data_len);
 bool           fr_dhcpv4_is_encodable(void const *item, void const *uctx);
-ssize_t                fr_dhcpv4_encode(uint8_t *buffer, size_t buflen, dhcp_packet_t *original, int code, uint32_t xid, fr_pair_t *vps);
-ssize_t                fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int code, uint32_t xid, fr_pair_t *vps);
+ssize_t                fr_dhcpv4_encode(uint8_t *buffer, size_t buflen, dhcp_packet_t *original, int code, uint32_t xid, fr_pair_list_t *vps);
+ssize_t                fr_dhcpv4_encode_dbuff(fr_dbuff_t *dbuff, dhcp_packet_t *original, int code, uint32_t xid, fr_pair_list_t *vps);
 int            fr_dhcpv4_global_init(void);
 void           fr_dhcpv4_global_free(void);
 void           fr_dhcpv4_print_hex(FILE *fp, uint8_t const *packet, size_t packet_len);
index d409988c6d208a933bdba5920f34d56ed772b536..b4b825d52d7a89dec1a0558aeaf27275b6e50369 100644 (file)
@@ -531,7 +531,7 @@ ssize_t fr_dhcpv4_encode_option(fr_dbuff_t *dbuff, fr_cursor_t *cursor, void *en
        return fr_dbuff_set(dbuff, &work_dbuff);
 }
 
-static ssize_t fr_dhcpv4_encode_proto(UNUSED TALLOC_CTX *ctx, fr_pair_t *vps, uint8_t *data, size_t data_len, UNUSED void *proto_ctx)
+static ssize_t fr_dhcpv4_encode_proto(UNUSED TALLOC_CTX *ctx, fr_pair_list_t *vps, uint8_t *data, size_t data_len, UNUSED void *proto_ctx)
 {
        return fr_dhcpv4_encode_dbuff(&FR_DBUFF_TMP(data, data_len), NULL, 0, 0, vps);
 }
index 9be022c1c487aad24685fcbad5f4bedb769923f7..bc2df6be416d61d418f4f59ab742d779bb32b915 100644 (file)
@@ -411,7 +411,7 @@ int fr_dhcpv4_packet_encode(fr_radius_packet_t *packet)
                packet->id = fr_rand();
        }
 
-       len = fr_dhcpv4_encode(packet->data, packet->data_len, NULL, packet->code, packet->id, packet->vps);
+       len = fr_dhcpv4_encode(packet->data, packet->data_len, NULL, packet->code, packet->id, &packet->vps);
        if (len < 0) return -1;
 
        packet->data_len = len;
index 2040351e0d1940a23064724365667beafe6b97b7..cc565762151fa6666e56f8c4902bc03b3b3c1e0f 100644 (file)
@@ -772,7 +772,7 @@ void *fr_dhcpv6_next_encodable(void **prev, void *to_eval, void *uctx)
 /** Encode a DHCPv6 packet
  *
  */
-ssize_t        fr_dhcpv6_encode(fr_dbuff_t *dbuff, uint8_t const *original, size_t length, int msg_type, fr_pair_t *vps)
+ssize_t        fr_dhcpv6_encode(fr_dbuff_t *dbuff, uint8_t const *original, size_t length, int msg_type, fr_pair_list_t *vps)
 {
        fr_dbuff_t              frame_dbuff = FR_DBUFF_NO_ADVANCE(dbuff);
        fr_pair_t               *vp;
@@ -784,7 +784,7 @@ ssize_t     fr_dhcpv6_encode(fr_dbuff_t *dbuff, uint8_t const *original, size_t leng
        root = fr_dict_root(dict_dhcpv6);
 
        if (!msg_type) {
-               vp = fr_pair_find_by_da(&vps, attr_packet_type);
+               vp = fr_pair_find_by_da(vps, attr_packet_type);
                if (vp) msg_type = vp->vp_uint32;
        }
 
@@ -798,21 +798,21 @@ ssize_t   fr_dhcpv6_encode(fr_dbuff_t *dbuff, uint8_t const *original, size_t leng
        switch (msg_type) {
        case FR_DHCPV6_RELAY_REPLY:
        case FR_DHCPV6_RELAY_FORWARD:
-               vp = fr_pair_find_by_da(&vps, attr_hop_count);
+               vp = fr_pair_find_by_da(vps, attr_hop_count);
                if (likely(vp != NULL)) {
                        FR_VALUE_BOX_TO_NETWORK_RETURN(&frame_dbuff, &vp->data);
                } else {
                        FR_DBUFF_MEMSET_RETURN(&frame_dbuff, 0, DHCPV6_HOP_COUNT_LEN);
                }
 
-               vp = fr_pair_find_by_da(&vps, attr_relay_link_address);
+               vp = fr_pair_find_by_da(vps, attr_relay_link_address);
                if (likely(vp != NULL)) {
                        FR_VALUE_BOX_TO_NETWORK_RETURN(&frame_dbuff, &vp->data);
                } else {
                        FR_DBUFF_MEMSET_RETURN(&frame_dbuff, 0, DHCPV6_LINK_ADDRESS_LEN);
                }
 
-               vp = fr_pair_find_by_da(&vps, attr_relay_peer_address);
+               vp = fr_pair_find_by_da(vps, attr_relay_peer_address);
                if (likely(vp != NULL)) {
                        FR_VALUE_BOX_TO_NETWORK_RETURN(&frame_dbuff, &vp->data);
                } else {
@@ -824,7 +824,7 @@ ssize_t     fr_dhcpv6_encode(fr_dbuff_t *dbuff, uint8_t const *original, size_t leng
                /*
                 *      We can set an XID, or we can pick a random one.
                 */
-               vp = fr_pair_find_by_da(&vps, attr_transaction_id);
+               vp = fr_pair_find_by_da(vps, attr_transaction_id);
                if (vp && (vp->vp_length >= DHCPV6_TRANSACTION_ID_LEN)) {
                        FR_DBUFF_IN_MEMCPY_RETURN(&frame_dbuff, vp->vp_octets, DHCPV6_TRANSACTION_ID_LEN);
                } else {
@@ -842,7 +842,7 @@ ssize_t     fr_dhcpv6_encode(fr_dbuff_t *dbuff, uint8_t const *original, size_t leng
        packet_ctx.original = original;
        packet_ctx.original_length = length;
 
-       fr_cursor_talloc_iter_init(&cursor, &vps, fr_dhcpv6_next_encodable, dict_dhcpv6, fr_pair_t);
+       fr_cursor_talloc_iter_init(&cursor, vps, fr_dhcpv6_next_encodable, dict_dhcpv6, fr_pair_t);
        while ((fr_dbuff_extend(&frame_dbuff) > 0) && (fr_cursor_current(&cursor) != NULL)) {
                slen = fr_dhcpv6_encode_option(&frame_dbuff, &cursor, &packet_ctx);
                switch (slen) {
index 33cba5f11b00df3f1f8e25f7d4176779c8af7f55..bf276f73957bb65ec9ba04174d1c879e5db99da3 100644 (file)
@@ -152,7 +152,7 @@ bool                fr_dhcpv6_verify(uint8_t const *packet, size_t packet_len, fr_dhcpv6_decod
                                 bool from_server);
 
 ssize_t                fr_dhcpv6_encode(fr_dbuff_t *dbuff, uint8_t const *original, size_t length,
-                                int msg_type, fr_pair_t *vps);
+                                int msg_type, fr_pair_list_t *vps);
 
 ssize_t                fr_dhcpv6_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_len,
                                 fr_cursor_t *cursor);
index 41b290a4167c36c2600eff66bed5a83d660157ff..89310294b3d5a82e05d8c809860522611a329086 100644 (file)
@@ -714,7 +714,7 @@ static ssize_t encode_relay_message(fr_dbuff_t *dbuff,
        FR_DBUFF_ADVANCE_RETURN(dbuff, 2);              /* Advanced past the length field */
 
        vp = fr_cursor_current(cursor);
-       slen = fr_dhcpv6_encode(dbuff, NULL, 0, 0, vp->vp_group);
+       slen = fr_dhcpv6_encode(dbuff, NULL, 0, 0, &vp->vp_group);
        if (slen <= 0) {
                fr_dbuff_marker_release(&start_m);
                return slen;
@@ -818,7 +818,7 @@ static int encode_test_ctx(void **out, TALLOC_CTX *ctx)
        return 0;
 }
 
-static ssize_t fr_dhcpv6_encode_proto(UNUSED TALLOC_CTX *ctx, fr_pair_t *vps, uint8_t *data, size_t data_len, UNUSED void *proto_ctx)
+static ssize_t fr_dhcpv6_encode_proto(UNUSED TALLOC_CTX *ctx, fr_pair_list_t *vps, uint8_t *data, size_t data_len, UNUSED void *proto_ctx)
 {
        ssize_t slen;
 
index f103325d37311fda965266fc6e574de707832ea4..9a20f6b32f4fb3ad0b01e9550979d0298022adde 100644 (file)
@@ -900,13 +900,13 @@ void *fr_radius_next_encodable(void **prev, void *to_eval, void *uctx)
  *
  */
 ssize_t fr_radius_encode(uint8_t *packet, size_t packet_len, uint8_t const *original,
-                        char const *secret, size_t secret_len, int code, int id, fr_pair_t *vps)
+                        char const *secret, size_t secret_len, int code, int id, fr_pair_list_t *vps)
 {
        return fr_radius_encode_dbuff(&FR_DBUFF_TMP(packet, packet_len), original, secret, secret_len, code, id, vps);
 }
 
 ssize_t fr_radius_encode_dbuff(fr_dbuff_t *dbuff, uint8_t const *original,
-                        char const *secret, UNUSED size_t secret_len, int code, int id, fr_pair_t *vps)
+                        char const *secret, UNUSED size_t secret_len, int code, int id, fr_pair_list_t *vps)
 {
        ssize_t                 slen;
        fr_pair_t const *vp;
@@ -978,7 +978,7 @@ ssize_t fr_radius_encode_dbuff(fr_dbuff_t *dbuff, uint8_t const *original,
        /*
         *      Loop over the reply attributes for the packet.
         */
-       fr_cursor_talloc_iter_init(&cursor, &vps, fr_radius_next_encodable, dict_radius, fr_pair_t);
+       fr_cursor_talloc_iter_init(&cursor, vps, fr_radius_next_encodable, dict_radius, fr_pair_t);
        while ((vp = fr_cursor_current(&cursor))) {
                VP_VERIFY(vp);
 
index 28a801233f60cc2076dd4f60bea8684ddadc530e..e211954c5c9639026a955ceb4173ddafaad6ebba 100644 (file)
@@ -319,7 +319,7 @@ static ssize_t encode_tlv_hdr(fr_dbuff_t *dbuff,
        return fr_dbuff_set(dbuff, &work_dbuff);
 }
 
-static ssize_t encode_tags(fr_dbuff_t *dbuff, fr_pair_t *vps, void *encoder_ctx)
+static ssize_t encode_tags(fr_dbuff_t *dbuff, fr_pair_list_t const *vps, void *encoder_ctx)
 {
        ssize_t                 slen;
        fr_pair_t const *vp;
@@ -328,7 +328,7 @@ static ssize_t encode_tags(fr_dbuff_t *dbuff, fr_pair_t *vps, void *encoder_ctx)
        /*
         *      Note that we skip tags inside of tags!
         */
-       fr_cursor_talloc_iter_init(&cursor, &vps, fr_proto_next_encodable, dict_radius, fr_pair_t);
+       fr_cursor_talloc_iter_init(&cursor, vps, fr_proto_next_encodable, dict_radius, fr_pair_t);
        while ((vp = fr_cursor_current(&cursor))) {
                VP_VERIFY(vp);
 
@@ -1282,7 +1282,7 @@ ssize_t fr_radius_encode_pair(fr_dbuff_t *dbuff, fr_cursor_t *cursor, void *enco
                fr_assert(packet_ctx->tag < 0x20);
 
                // recurse to encode the children of this attribute
-               len = encode_tags(&work_dbuff, vp->vp_group, encoder_ctx);
+               len = encode_tags(&work_dbuff, &vp->vp_group, encoder_ctx);
                packet_ctx->tag = 0;
                if (len < 0) return len;
 
@@ -1441,18 +1441,18 @@ static int encode_test_ctx(void **out, TALLOC_CTX *ctx)
        return 0;
 }
 
-static ssize_t fr_radius_encode_proto(UNUSED TALLOC_CTX *ctx, fr_pair_t *vps, uint8_t *data, size_t data_len, void *proto_ctx)
+static ssize_t fr_radius_encode_proto(UNUSED TALLOC_CTX *ctx, fr_pair_list_t *vps, uint8_t *data, size_t data_len, void *proto_ctx)
 {
        fr_radius_ctx_t *test_ctx = talloc_get_type_abort(proto_ctx, fr_radius_ctx_t);
        int packet_type = FR_CODE_ACCESS_REQUEST;
        fr_pair_t *vp;
        ssize_t slen;
 
-       vp = fr_pair_find_by_da(&vps, attr_packet_type);
+       vp = fr_pair_find_by_da(vps, attr_packet_type);
        if (vp) packet_type = vp->vp_uint32;
 
        if ((packet_type == FR_CODE_ACCESS_REQUEST) || (packet_type == FR_CODE_STATUS_SERVER)) {
-               vp = fr_pair_find_by_da(&vps, attr_packet_authentication_vector);
+               vp = fr_pair_find_by_da(vps, attr_packet_authentication_vector);
                if (vp && (vp->vp_length == RADIUS_AUTH_VECTOR_LENGTH)) {
                        memcpy(data + 4, vp->vp_octets, RADIUS_AUTH_VECTOR_LENGTH);
                } else {
index e0907616fc52b96f01ba490c2fe51fe456d56ccc..eb28be0c248679d010c925bad3c0614b239e665f 100644 (file)
@@ -77,7 +77,7 @@ ssize_t fr_radius_packet_encode(fr_radius_packet_t *packet, fr_radius_packet_t c
        memcpy(data + 4, packet->vector, sizeof(packet->vector));
 
        slen = fr_radius_encode(data, sizeof(data), original_data, secret, talloc_array_length(secret) - 1,
-                               packet->code, packet->id, packet->vps);
+                               packet->code, packet->id, &packet->vps);
        if (slen < 0) return slen;
 
        /*
index 697f2c784e76431646b6a9938e244717d04e27b7..2de7401d39be902886ffedfa265cc894a16c56a5 100644 (file)
@@ -124,10 +124,10 @@ ssize_t           fr_radius_ascend_secret(fr_dbuff_t *dbuff, uint8_t const *in, size_t in
 ssize_t                fr_radius_recv_header(int sockfd, fr_ipaddr_t *src_ipaddr, uint16_t *src_port, unsigned int *code);
 
 ssize_t                fr_radius_encode(uint8_t *packet, size_t packet_len, uint8_t const *original,
-                                char const *secret, size_t secret_len, int code, int id, fr_pair_t *vps);
+                                char const *secret, size_t secret_len, int code, int id, fr_pair_list_t *vps);
 
 ssize_t                fr_radius_encode_dbuff(fr_dbuff_t *dbuff, uint8_t const *original,
-                                char const *secret, UNUSED size_t secret_len, int code, int id, fr_pair_t *vps);
+                                char const *secret, UNUSED size_t secret_len, int code, int id, fr_pair_list_t *vps);
 
 ssize_t                fr_radius_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_len, uint8_t const *original,
                                 char const *secret, UNUSED size_t secret_len, fr_cursor_t *cursor) CC_HINT(nonnull(1,2,5,7));
index 8852151c82eacb4a5e0317b636dbdf3331a940c1..ebce15ffb4770d98f9323d1f8a5c329ffad3a479 100644 (file)
 /**
  *     Encode a TACACS+ 'arg_N' fields.
  */
-static uint8_t tacacs_encode_body_arg_n_len(fr_dbuff_t *dbuff, fr_pair_t *vps, fr_dict_attr_t const *da)
+static uint8_t tacacs_encode_body_arg_n_len(fr_dbuff_t *dbuff, fr_pair_list_t *vps, fr_dict_attr_t const *da)
 {
        uint8_t     arg_cnt = 0;
        fr_pair_t   *vp;
        fr_cursor_t cursor;
        fr_dbuff_t  work_dbuff = FR_DBUFF_NO_ADVANCE(dbuff);
 
-       for (vp = fr_cursor_init(&cursor, &vps);
+       for (vp = fr_cursor_init(&cursor, vps);
             vp;
             vp = fr_cursor_next(&cursor)) {
                if (arg_cnt == 255) break;
@@ -65,14 +65,14 @@ static uint8_t tacacs_encode_body_arg_n_len(fr_dbuff_t *dbuff, fr_pair_t *vps, f
        return arg_cnt;
 }
 
-static ssize_t tacacs_encode_body_arg_n(fr_dbuff_t *dbuff, fr_pair_t *vps, fr_dict_attr_t const *da)
+static ssize_t tacacs_encode_body_arg_n(fr_dbuff_t *dbuff, fr_pair_list_t *vps, fr_dict_attr_t const *da)
 {
        fr_pair_t   *vp;
        fr_cursor_t cursor;
        uint8_t     arg_cnt = 0;
        fr_dbuff_t  work_dbuff = FR_DBUFF_NO_ADVANCE(dbuff);
 
-       for (vp = fr_cursor_init(&cursor, &vps);
+       for (vp = fr_cursor_init(&cursor, vps);
             vp;
             vp = fr_cursor_next(&cursor), arg_cnt++) {
                if (arg_cnt == 255) break;
@@ -89,12 +89,12 @@ static ssize_t tacacs_encode_body_arg_n(fr_dbuff_t *dbuff, fr_pair_t *vps, fr_di
 /*
  *     Encode a TACACS+ field.
  */
-static ssize_t tacacs_encode_field(fr_dbuff_t *dbuff, fr_pair_t *vps, fr_dict_attr_t const *da, size_t max_len)
+static ssize_t tacacs_encode_field(fr_dbuff_t *dbuff, fr_pair_list_t *vps, fr_dict_attr_t const *da, size_t max_len)
 {
        fr_pair_t  *vp;
        fr_dbuff_t work_dbuff = FR_DBUFF_NO_ADVANCE(dbuff);
 
-       vp = fr_pair_find_by_da(&vps, da);
+       vp = fr_pair_find_by_da(vps, da);
        if (!vp || !vp->vp_length || (vp->vp_length > max_len)) return 0;
 
        if (da->type == FR_TYPE_STRING) {
@@ -113,7 +113,7 @@ static ssize_t tacacs_encode_field(fr_dbuff_t *dbuff, fr_pair_t *vps, fr_dict_at
  *     doesn't specify them, then they don't get encoded.
  */
 #define ENCODE_FIELD_UINT8(_field, _da) do { \
-       vp = fr_pair_find_by_da(&vps, _da); \
+       vp = fr_pair_find_by_da(vps, _da); \
        _field = (vp) ? vp->vp_uint8 : 0; \
 } while (0)
 
@@ -123,7 +123,7 @@ static ssize_t tacacs_encode_field(fr_dbuff_t *dbuff, fr_pair_t *vps, fr_dict_at
 /**
  *     Encode VPS into a raw TACACS packet.
  */
-ssize_t fr_tacacs_encode(fr_dbuff_t *dbuff, uint8_t const *original_packet, char const *secret, size_t secret_len, fr_pair_t *vps)
+ssize_t fr_tacacs_encode(fr_dbuff_t *dbuff, uint8_t const *original_packet, char const *secret, size_t secret_len, fr_pair_list_t *vps)
 {
        fr_pair_t               *vp;
        fr_tacacs_packet_t      *packet;
@@ -196,7 +196,7 @@ ssize_t fr_tacacs_encode(fr_dbuff_t *dbuff, uint8_t const *original_packet, char
        /*
         *      Find the first attribute which is parented by TACACS-Packet.
         */
-       for (vp = fr_cursor_init(&cursor, &vps);
+       for (vp = fr_cursor_init(&cursor, vps);
             vp;
             vp = fr_cursor_next(&cursor)) {
                if (vp->da->parent == attr_tacacs_packet) break;
@@ -569,7 +569,7 @@ ssize_t fr_tacacs_encode(fr_dbuff_t *dbuff, uint8_t const *original_packet, char
                        /*
                         *      If the caller didn't set a session ID, use a random one.
                         */
-                       if (!fr_pair_find_by_da(&vps, attr_tacacs_session_id)) {
+                       if (!fr_pair_find_by_da(vps, attr_tacacs_session_id)) {
                                packet->hdr.session_id = fr_rand();
                        }
 
@@ -697,7 +697,7 @@ ssize_t fr_tacacs_encode(fr_dbuff_t *dbuff, uint8_t const *original_packet, char
 /*
  *     Test points for protocol encode
  */
-static ssize_t fr_tacacs_encode_proto(UNUSED TALLOC_CTX *ctx, fr_pair_t *vps, uint8_t *data, size_t data_len, UNUSED void *proto_ctx)
+static ssize_t fr_tacacs_encode_proto(UNUSED TALLOC_CTX *ctx, fr_pair_list_t *vps, uint8_t *data, size_t data_len, UNUSED void *proto_ctx)
 {
        fr_tacacs_ctx_t *test_ctx = talloc_get_type_abort(proto_ctx, fr_tacacs_ctx_t);
 
index e252e3380af784f0e6a5c80c5fb6b8d0df8b697c..95305fd2d91cd0af91dc37f3cc3a0e6260270952 100644 (file)
@@ -288,7 +288,7 @@ typedef struct {
 } fr_tacacs_ctx_t;
 
 /* encode.c */
-ssize_t fr_tacacs_encode(fr_dbuff_t *dbuff, uint8_t const *original, char const *const secret, size_t secret_len, fr_pair_t *vps);
+ssize_t fr_tacacs_encode(fr_dbuff_t *dbuff, uint8_t const *original, char const *const secret, size_t secret_len, fr_pair_list_t *vps);
 
 /* decode.c */
 ssize_t fr_tacacs_decode(TALLOC_CTX *ctx, uint8_t const *buffer, size_t buffer_len, UNUSED const uint8_t *original, char const * const secret, size_t secret_len, fr_cursor_t *cursor);
index 1ca4eaa7af66f9b89a41f58001cd6015b5bb669f..06a6cc072d57d0972b2d1ff3a8365750c3f5b9d9 100644 (file)
@@ -569,11 +569,11 @@ fr_test_point_proto_decode_t vmps_tp_decode_proto = {
 /*
  *     Test points for protocol encode
  */
-static ssize_t fr_vmps_encode_proto(UNUSED TALLOC_CTX *ctx, fr_pair_t *vps, uint8_t *data, size_t data_len, UNUSED void *proto_ctx)
+static ssize_t fr_vmps_encode_proto(UNUSED TALLOC_CTX *ctx, fr_pair_list_t *vps, uint8_t *data, size_t data_len, UNUSED void *proto_ctx)
 {
        fr_cursor_t cursor;
 
-       fr_cursor_talloc_iter_init(&cursor, &vps, fr_proto_next_encodable, dict_vmps, fr_pair_t);
+       fr_cursor_talloc_iter_init(&cursor, vps, fr_proto_next_encodable, dict_vmps, fr_pair_t);
 
        return fr_vmps_encode(&FR_DBUFF_TMP(data, data_len), NULL, -1, -1, &cursor);
 }