]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Replace more vp_cursor_t calls with fr_cursor_t calls
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 15 Sep 2017 01:34:28 +0000 (08:34 +0700)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 15 Sep 2017 01:37:02 +0000 (08:37 +0700)
src/modules/rlm_mschap/rlm_mschap.c
src/modules/rlm_pap/rlm_pap.c
src/modules/rlm_perl/rlm_perl.c
src/modules/rlm_python/rlm_python.c
src/modules/rlm_radutmp/rlm_radutmp.c
src/modules/rlm_sigtran/client.c
src/modules/rlm_sql/rlm_sql.c
src/modules/rlm_unix/rlm_unix.c
src/modules/rlm_utf8/rlm_utf8.c

index 89453179013b7b0b52c051222d75cbb8a17e0c35..ee87b095d715846446b6d71bc720a9abd975ce51 100644 (file)
@@ -1666,12 +1666,12 @@ static rlm_rcode_t CC_HINT(nonnull) process_cpw_request(rlm_mschap_t const *inst
         */
        new_nt_enc_len = 0;
        for (seq = 1; seq < 4; seq++) {
-               vp_cursor_t cursor;
+               fr_cursor_t cursor;
                int found = 0;
 
-               for (nt_enc = fr_pair_cursor_init(&cursor, &request->packet->vps);
+               for (nt_enc = fr_cursor_init(&cursor, &request->packet->vps);
                     nt_enc;
-                    nt_enc = fr_pair_cursor_next(&cursor)) {
+                    nt_enc = fr_cursor_next(&cursor)) {
                        if (nt_enc->da->vendor != VENDORPEC_MICROSOFT)
                                continue;
 
index ca5f496135938a1fd2885762c16e6b160aaf437d..a7fbc42b83d6b521bb48844762cb0e6f937d65cc 100644 (file)
@@ -349,11 +349,11 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, UNUSED void *t
        bool                    auth_type = false;
        bool                    found_pw = false;
        VALUE_PAIR              *vp;
-       vp_cursor_t             cursor;
+       fr_cursor_t             cursor;
 
-       for (vp = fr_pair_cursor_init(&cursor, &request->control);
+       for (vp = fr_cursor_init(&cursor, &request->control);
             vp;
-            vp = fr_pair_cursor_next(&cursor)) {
+            vp = fr_cursor_next(&cursor)) {
                VP_VERIFY(vp);
        next:
                switch (vp->da->attr) {
@@ -380,15 +380,15 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, UNUSED void *t
                        }
 
                        new = normify_with_header(request, vp);
-                       if (new) fr_pair_cursor_append(&cursor, new); /* inserts at the end of the list */
+                       if (new) fr_cursor_append(&cursor, new); /* inserts at the end of the list */
 
                        RDEBUG2("Removing &control:Password-With-Header");
-                       vp = fr_pair_cursor_remove(&cursor);    /* advances the cursor for us */
+                       vp = fr_cursor_remove(&cursor); /* advances the cursor for us */
                        talloc_free(vp);
 
                        found_pw = true;
 
-                       vp = fr_pair_cursor_current(&cursor);
+                       vp = fr_cursor_current(&cursor);
                        if (vp) goto next;
                }
                        break;
@@ -1352,7 +1352,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authenticate(void *instance, UNUSED void
        rlm_pap_t const *inst = instance;
        VALUE_PAIR      *vp;
        rlm_rcode_t     rc = RLM_MODULE_INVALID;
-       vp_cursor_t     cursor;
+       fr_cursor_t     cursor;
        rlm_rcode_t     (*auth_func)(rlm_pap_t const *, REQUEST *, VALUE_PAIR *) = NULL;
 
        if (!request->password ||
@@ -1382,9 +1382,9 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authenticate(void *instance, UNUSED void
         *      config items, to find out which authentication
         *      function to call.
         */
-       for (vp = fr_pair_cursor_init(&cursor, &request->control);
+       for (vp = fr_cursor_init(&cursor, &request->control);
             vp;
-            vp = fr_pair_cursor_next(&cursor)) {
+            vp = fr_cursor_next(&cursor)) {
                if (!vp->da->vendor) switch (vp->da->attr) {
                case FR_CLEARTEXT_PASSWORD:
                        auth_func = &pap_auth_clear;
index 095f4f4306d06750ef7dd07f585bb508aa8075f5..723503c047bb6c81cc0ee7b1d69f2a309255b618 100644 (file)
@@ -664,13 +664,13 @@ static void perl_store_vps(UNUSED TALLOC_CTX *ctx, REQUEST *request, VALUE_PAIR
 
        hv_undef(rad_hv);
 
-       vp_cursor_t cursor;
+       fr_cursor_t cursor;
 
        RINDENT();
        fr_pair_list_sort(vps, fr_pair_cmp_by_da_tag);
-       for (vp = fr_pair_cursor_init(&cursor, vps);
+       for (vp = fr_cursor_init(&cursor, vps);
             vp;
-            vp = fr_pair_cursor_next(&cursor)) {
+            vp = fr_cursor_next(&cursor)) {
                VALUE_PAIR *next;
 
                char const *name;
@@ -695,7 +695,7 @@ static void perl_store_vps(UNUSED TALLOC_CTX *ctx, REQUEST *request, VALUE_PAIR
                 *      We've sorted by type, then tag, so attributes of the
                 *      same type/tag should follow on from each other.
                 */
-               if ((next = fr_pair_cursor_next_peek(&cursor)) && ATTRIBUTE_EQ(vp, next)) {
+               if ((next = fr_cursor_next_peek(&cursor)) && ATTRIBUTE_EQ(vp, next)) {
                        int i = 0;
                        AV *av;
 
@@ -703,8 +703,8 @@ static void perl_store_vps(UNUSED TALLOC_CTX *ctx, REQUEST *request, VALUE_PAIR
                        perl_vp_to_svpvn_element(request, av, vp, &i, hash_name, list_name);
                        do {
                                perl_vp_to_svpvn_element(request, av, next, &i, hash_name, list_name);
-                               fr_pair_cursor_next(&cursor);
-                       } while ((next = fr_pair_cursor_next_peek(&cursor)) && ATTRIBUTE_EQ(vp, next));
+                               fr_cursor_next(&cursor);
+                       } while ((next = fr_cursor_next_peek(&cursor)) && ATTRIBUTE_EQ(vp, next));
                        (void)hv_store(rad_hv, name, strlen(name), newRV_noinc((SV *)av), 0);
 
                        continue;
index 2bc7ff79c1c0ee554fbd86d39804774afd1701db..b7c80bf1e4708e57ef1e54ec029cea8231dbeb88 100644 (file)
@@ -460,7 +460,7 @@ static int mod_populate_vptuple(PyObject *pp, VALUE_PAIR *vp)
 
 static rlm_rcode_t do_python_single(REQUEST *request, PyObject *pFunc, char const *funcname)
 {
-       vp_cursor_t     cursor;
+       fr_cursor_t     cursor;
        VALUE_PAIR      *vp;
        PyObject        *pRet = NULL;
        PyObject        *pArgs = NULL;
@@ -480,9 +480,9 @@ static rlm_rcode_t do_python_single(REQUEST *request, PyObject *pFunc, char cons
         */
        tuplelen = 0;
        if (request != NULL) {
-               for (vp = fr_pair_cursor_init(&cursor, &request->packet->vps);
+               for (vp = fr_cursor_init(&cursor, &request->packet->vps);
                     vp;
-                    vp = fr_pair_cursor_next(&cursor)) tuplelen++;
+                    vp = fr_cursor_next(&cursor)) tuplelen++;
        }
 
        if (tuplelen == 0) {
@@ -495,9 +495,9 @@ static rlm_rcode_t do_python_single(REQUEST *request, PyObject *pFunc, char cons
                        goto finish;
                }
 
-               for (vp = fr_pair_cursor_init(&cursor, &request->packet->vps);
+               for (vp = fr_cursor_init(&cursor, &request->packet->vps);
                     vp;
-                    vp = fr_pair_cursor_next(&cursor), i++) {
+                    vp = fr_cursor_next(&cursor), i++) {
                        PyObject *pp;
 
                        /* The inside tuple has two only: */
index 6e25fc466e2d845b8f42021773a501779d15a7e1..f13b2b85b9236ce19f48c9c06de29afd9ebb036b 100644 (file)
@@ -146,7 +146,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, UNUSED void *
 {
        rlm_rcode_t     rcode = RLM_MODULE_OK;
        struct radutmp  ut, u;
-       vp_cursor_t     cursor;
+       fr_cursor_t     cursor;
        VALUE_PAIR      *vp;
        int             status = -1;
        int             protocol = -1;
@@ -217,9 +217,9 @@ static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, UNUSED void *
        /*
         *      First, find the interesting attributes.
         */
-       for (vp = fr_pair_cursor_init(&cursor, &request->packet->vps);
+       for (vp = fr_cursor_init(&cursor, &request->packet->vps);
             vp;
-            vp = fr_pair_cursor_next(&cursor)) {
+            vp = fr_cursor_next(&cursor)) {
                if (!vp->da->vendor) switch (vp->da->attr) {
                case FR_LOGIN_IP_HOST:
                case FR_FRAMED_IP_ADDRESS:
index 6c1bb573a151e9da134d705565c5c78dcc6b7e0f..6cbbcc5ac5f8234bf755f53ef247fcc8c6e068ef 100644 (file)
@@ -273,12 +273,12 @@ rlm_rcode_t sigtran_client_map_send_auth_info(rlm_sigtran_t *inst, REQUEST *requ
        case SIGTRAN_RESPONSE_OK:
        {
                unsigned int            i = 0;
-               vp_cursor_t             cursor;
+               fr_cursor_t             cursor;
                VALUE_PAIR              *vp;
                sigtran_vector_t        *vec;
                sigtran_map_send_auth_info_res_t *res = talloc_get_type_abort(txn->response.data,
                                                                              sigtran_map_send_auth_info_res_t);
-               fr_pair_cursor_init(&cursor, &request->control);
+               fr_cursor_init(&cursor, &request->control);
 
                for (vec = res->vector; vec; vec = vec->next) {
                        switch (vec->type) {
@@ -301,17 +301,17 @@ rlm_rcode_t sigtran_client_map_send_auth_info(rlm_sigtran_t *inst, REQUEST *requ
                                vp = fr_pair_afrom_child_num(request, root, FR_EAP_SIM_RAND);
                                fr_pair_value_memsteal(vp, vec->sim.rand);
                                rdebug_pair(L_DBG_LVL_2, request, vp, "&control:");
-                               fr_pair_cursor_append(&cursor, vp);
+                               fr_cursor_append(&cursor, vp);
 
                                vp = fr_pair_afrom_child_num(request, root, FR_EAP_SIM_SRES);
                                fr_pair_value_memsteal(vp, vec->sim.sres);
                                rdebug_pair(L_DBG_LVL_2, request, vp, "&control:");
-                               fr_pair_cursor_append(&cursor, vp);
+                               fr_cursor_append(&cursor, vp);
 
                                vp = fr_pair_afrom_child_num(request, root, FR_EAP_SIM_KC);
                                fr_pair_value_memsteal(vp, vec->sim.kc);
                                rdebug_pair(L_DBG_LVL_2, request, vp, "&control:");
-                               fr_pair_cursor_append(&cursor, vp);
+                               fr_cursor_append(&cursor, vp);
                                REXDENT();
 
                                i++;
@@ -339,27 +339,27 @@ rlm_rcode_t sigtran_client_map_send_auth_info(rlm_sigtran_t *inst, REQUEST *requ
                                vp = fr_pair_afrom_child_num(request, root, FR_EAP_AKA_RAND);
                                fr_pair_value_memsteal(vp, vec->umts.rand);
                                rdebug_pair(L_DBG_LVL_2, request, vp, "&control:");
-                               fr_pair_cursor_append(&cursor, vp);
+                               fr_cursor_append(&cursor, vp);
 
                                vp = fr_pair_afrom_child_num(request, root, FR_EAP_AKA_XRES);
                                fr_pair_value_memsteal(vp, vec->umts.xres);
                                rdebug_pair(L_DBG_LVL_2, request, vp, "&control:");
-                               fr_pair_cursor_append(&cursor, vp);
+                               fr_cursor_append(&cursor, vp);
 
                                vp = fr_pair_afrom_child_num(request, root, FR_EAP_AKA_CK);
                                fr_pair_value_memsteal(vp, vec->umts.ck);
                                rdebug_pair(L_DBG_LVL_2, request, vp, "&control:");
-                               fr_pair_cursor_append(&cursor, vp);
+                               fr_cursor_append(&cursor, vp);
 
                                vp = fr_pair_afrom_child_num(request, root, FR_EAP_AKA_IK);
                                fr_pair_value_memsteal(vp, vec->umts.ik);
                                rdebug_pair(L_DBG_LVL_2, request, vp, "&control:");
-                               fr_pair_cursor_append(&cursor, vp);
+                               fr_cursor_append(&cursor, vp);
 
                                vp = fr_pair_afrom_child_num(request, root, FR_EAP_AKA_AUTN);
                                fr_pair_value_memsteal(vp, vec->umts.authn);
                                rdebug_pair(L_DBG_LVL_2, request, vp, "&control:");
-                               fr_pair_cursor_append(&cursor, vp);
+                               fr_cursor_append(&cursor, vp);
                                REXDENT();
 
                                i++;
index 368b3cf81cdc71729ed6a51429310587a9cc46d0..2a022215ee08356d36dca2ae4d8840aa896178e5 100644 (file)
@@ -910,7 +910,7 @@ static rlm_rcode_t rlm_sql_process_groups(rlm_sql_t const *inst, REQUEST *reques
                fr_pair_value_strcpy(sql_group, entry->name);
 
                if (inst->config->authorize_group_check_query) {
-                       vp_cursor_t     cursor;
+                       fr_cursor_t     cursor;
                        VALUE_PAIR      *vp;
 
                        /*
@@ -950,9 +950,9 @@ static rlm_rcode_t rlm_sql_process_groups(rlm_sql_t const *inst, REQUEST *reques
 
                        RDEBUG2("Group \"%s\": Merging assignment check items", entry->name);
                        RINDENT();
-                       for (vp = fr_pair_cursor_init(&cursor, &check_tmp);
+                       for (vp = fr_cursor_init(&cursor, &check_tmp);
                             vp;
-                            vp = fr_pair_cursor_next(&cursor)) {
+                            vp = fr_cursor_next(&cursor)) {
                                if (!fr_assignment_op[vp->op]) continue;
 
                                rcode = RLM_MODULE_UPDATED;
@@ -1297,8 +1297,8 @@ static rlm_rcode_t mod_authorize(void *instance, UNUSED void *thread, REQUEST *r
         *      Query the check table to find any conditions associated with this user/realm/whatever...
         */
        if (inst->config->authorize_check_query) {
-               vp_cursor_t cursor;
-               VALUE_PAIR *vp;
+               fr_cursor_t     cursor;
+               VALUE_PAIR      *vp;
 
                if (xlat_aeval(request, &expanded, request, inst->config->authorize_check_query,
                                 inst->sql_escape_func, handle) < 0) {
@@ -1330,9 +1330,9 @@ static rlm_rcode_t mod_authorize(void *instance, UNUSED void *thread, REQUEST *r
 
                RDEBUG2("Conditional check items matched, merging assignment check items");
                RINDENT();
-               for (vp = fr_pair_cursor_init(&cursor, &check_tmp);
+               for (vp = fr_cursor_init(&cursor, &check_tmp);
                     vp;
-                    vp = fr_pair_cursor_next(&cursor)) {
+                    vp = fr_cursor_next(&cursor)) {
                        if (!fr_assignment_op[vp->op]) continue;
 
                        rdebug_pair(2, request, vp, NULL);
index ab633607f6db27dfa69f5412d9434cb95bcce8e0..35132e220eea63be36d6e40a41cb8883ca490b6c 100644 (file)
@@ -360,7 +360,7 @@ static char *uue(void *in)
 static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, UNUSED void *thread, REQUEST *request)
 {
        VALUE_PAIR      *vp;
-       vp_cursor_t     cursor;
+       fr_cursor_t     cursor;
        FILE            *fp;
        struct utmp     ut;
        time_t          t;
@@ -419,9 +419,9 @@ static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, UNUSED void *
        /*
         *      First, find the interesting attributes.
         */
-       for (vp = fr_pair_cursor_init(&cursor, &request->packet->vps);
+       for (vp = fr_cursor_init(&cursor, &request->packet->vps);
             vp;
-            vp = fr_pair_cursor_next(&cursor)) {
+            vp = fr_cursor_next(&cursor)) {
                if (!vp->da->vendor) switch (vp->da->attr) {
                case FR_USER_NAME:
                        if (vp->vp_length >= sizeof(ut.ut_name)) {
index d6489f0a6b140f8ff58185f9b1a10f36e355d488..d1e0088edc8c6e8f9e47ee1cf43509d12773eef8 100644 (file)
@@ -31,13 +31,13 @@ RCSID("$Id$")
  */
 static rlm_rcode_t CC_HINT(nonnull) mod_utf8_clean(UNUSED void *instance, UNUSED void *thread, REQUEST *request)
 {
-       size_t i, len;
-       VALUE_PAIR *vp;
-       vp_cursor_t cursor;
+       size_t          i, len;
+       VALUE_PAIR      *vp;
+       fr_cursor_t     cursor;
 
-       for (vp = fr_pair_cursor_init(&cursor, &request->packet->vps);
+       for (vp = fr_cursor_init(&cursor, &request->packet->vps);
             vp;
-            vp = fr_pair_cursor_next(&cursor)) {
+            vp = fr_cursor_next(&cursor)) {
                if (vp->vp_type != FR_TYPE_STRING) continue;
 
                for (i = 0; i < vp->vp_length; i += len) {