]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Convert some pairfind calls to pairfind_da calls
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 10 Nov 2014 17:44:07 +0000 (12:44 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 10 Nov 2014 17:45:01 +0000 (12:45 -0500)
src/lib/pair.c
src/main/xlat.c
src/modules/rlm_eap/types/rlm_eap_peap/peap.c
src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c
src/modules/rlm_ldap/attrmap.c
src/modules/rlm_otp/otp_mppe.c
src/modules/rlm_passwd/rlm_passwd.c
src/modules/rlm_sometimes/rlm_sometimes.c
src/modules/rlm_sqlcounter/rlm_sqlcounter.c
src/modules/rlm_yubikey/decrypt.c

index 0d7ffb13a8759e961a4d88166f6ad7b4a39c8a50..e252e4323e87692b8d41946e89ba45a3d89e08ac 100644 (file)
@@ -886,7 +886,7 @@ void pairmove(TALLOC_CTX *ctx, VALUE_PAIR **to, VALUE_PAIR **from)
                 *      it doesn't already exist.
                 */
                case T_OP_EQ:
-                       found = pairfind(*to, i->da->attr, i->da->vendor, TAG_ANY);
+                       found = pairfind_da(*to, i->da, TAG_ANY);
                        if (!found) goto do_add;
 
                        tail_from = &(i->next);
@@ -897,7 +897,7 @@ void pairmove(TALLOC_CTX *ctx, VALUE_PAIR **to, VALUE_PAIR **from)
                 *      of the same vendor/attr which already exists.
                 */
                case T_OP_SET:
-                       found = pairfind(*to, i->da->attr, i->da->vendor, TAG_ANY);
+                       found = pairfind_da(*to, i->da, TAG_ANY);
                        if (!found) goto do_add;
 
                        /*
index 7398fd9bf46adbf904e25892274efd7bd1c81f26..cdc0a8c0e214b479b3df4b1651c6a4ff1fb6bcd6 100644 (file)
@@ -1663,7 +1663,7 @@ static char *xlat_getvp(TALLOC_CTX *ctx, REQUEST *request, pair_lists_t list, DI
         *      This allows users to manipulate virtual attributes as if they
         *      were real ones.
         */
-       vp = pairfind(vps, da->attr, da->vendor, tag);
+       vp = pairfind_da(vps, da, tag);
        if (vp) goto do_print;
 
        /*
index e16822bc4e3df6d2b323738edc69e709266228ad..1920bc407d68055faa2a5f78a4a4a56c996ce31a 100644 (file)
@@ -1250,9 +1250,7 @@ static int CC_HINT(nonnull) setup_fake_request(REQUEST *request, REQUEST *fake,
                         *      AND attributes which are copied there
                         *      from below.
                         */
-                       if (pairfind(fake->packet->vps, vp->da->attr, vp->da->vendor, TAG_ANY)) {
-                               continue;
-                       }
+                       if (pairfind_da(fake->packet->vps, vp->da, TAG_ANY)) continue;
 
                        /*
                         *      Some attributes are handled specially.
index 4fe8af3da6435495ca0e69b29e8f391cffb1d5a1..c589113ffe6bab6c48a51531155869957db9afdf 100644 (file)
@@ -1122,7 +1122,7 @@ PW_CODE eapttls_process(eap_handler_t *handler, tls_session_t *tls_session)
                         *      AND attributes which are copied there
                         *      from below.
                         */
-                       if (pairfind(fake->packet->vps, vp->da->attr, vp->da->vendor, TAG_ANY)) {
+                       if (pairfind_da(fake->packet->vps, vp->da, TAG_ANY)) {
                                continue;
                        }
 
index 4c0eb8975aa342a8a671386f5485f1686dbf0a5c..7561263ae04b8af8fdaf26f1f9ce309925470c63 100644 (file)
@@ -277,7 +277,7 @@ int rlm_ldap_map_xlat(REQUEST *request, value_pair_map_t const *maps, rlm_ldap_m
                        }
                        if (!from) continue;
 
-                       found = pairfind(*from, map->rhs->tmpl_da->attr, map->rhs->tmpl_da->vendor, TAG_ANY);
+                       found = pairfind_da(*from, map->rhs->tmpl_da, TAG_ANY);
                        if (!found) continue;
 
                        expanded->attrs[total++] = talloc_typed_strdup(request, found->vp_strvalue);
index f8f624511b5de6482e32962ea5b1e060c3d109fe..d58d1f937a7588e49da2e36667e70e974d4140ec 100644 (file)
@@ -46,8 +46,8 @@ void otp_mppe(REQUEST *request, otp_pwe_t pwe, rlm_otp_t const *opt, char const
 {
        VALUE_PAIR *cvp, *rvp;
 
-       cvp = pairfind(request->packet->vps, pwattr[pwe - 1]->attr, pwattr[pwe - 1]->vendor, TAG_ANY);
-       rvp = pairfind(request->packet->vps, pwattr[pwe]->attr, pwattr[pwe]->vendor, TAG_ANY);
+       cvp = pairfind_da(request->packet->vps, pwattr[pwe - 1], TAG_ANY);
+       rvp = pairfind_da(request->packet->vps, pwattr[pwe], TAG_ANY);
        if (!cvp || !rvp) {
                return;
        }
index 2583a67aeaed23205ff57cf71fb4cbd0a6d11319..bb42c98ba81e31466a44f11d1129e0f821707d6f 100644 (file)
@@ -543,7 +543,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_passwd_map(void *instance, REQUEST *requ
        struct mypasswd * pw, *last_found;
        vp_cursor_t cursor;
 
-       key = pairfind(request->packet->vps, inst->keyattr->attr, inst->keyattr->vendor, TAG_ANY);
+       key = pairfind_da(request->packet->vps, inst->keyattr, TAG_ANY);
        if (!key) {
                return RLM_MODULE_NOTFOUND;
        }
index 27ce5d554e19ad92dc9493638238ff38bbf7d827..fe679c26bb7e27d67308d73cee021d1ca0ce14f5 100644 (file)
@@ -97,7 +97,7 @@ static rlm_rcode_t sometimes_return(void *instance, RADIUS_PACKET *packet, RADIU
        /*
         *      Hash based on the given key.  Usually User-Name.
         */
-       vp = pairfind(packet->vps, inst->da->attr, inst->da->vendor, TAG_ANY);
+       vp = pairfind_da(packet->vps, inst->da, TAG_ANY);
        if (!vp) return RLM_MODULE_NOOP;
 
        hash = fr_hash(&vp->data, vp->length);
index 51c7dac9a7c9df8ffa3fc8c7a007511a802cfae7..1ae1ed8f65d13f473efcb4f26d1f867be0dc97e2 100644 (file)
@@ -469,7 +469,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, REQUEST *reque
        if ((inst->key_attr->vendor == 0) && (inst->key_attr->attr == PW_USER_NAME)) {
                key_vp = request->username;
        } else {
-               key_vp = pairfind(request->packet->vps, inst->key_attr->attr, inst->key_attr->vendor, TAG_ANY);
+               key_vp = pairfind_da(request->packet->vps, inst->key_attr, TAG_ANY);
        }
        if (!key_vp) {
                RWDEBUG2("Couldn't find key attribute, request:%s, doing nothing...", inst->key_attr->name);
@@ -483,7 +483,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, REQUEST *reque
                return rcode;
        }
 
-       limit = pairfind(request->config_items, da->attr, da->vendor, TAG_ANY);
+       limit = pairfind_da(request->config_items, da, TAG_ANY);
        if (limit == NULL) {
                /* Yes this really is 'check' as distinct from control */
                RWDEBUG2("Couldn't find check attribute, control:%s, doing nothing...", inst->limit_name);
@@ -556,7 +556,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, REQUEST *reque
        /*
         *      Limit the reply attribute to the minimum of the existing value, or this new one.
         */
-       reply_item = pairfind(request->reply->vps, inst->reply_attr->attr, inst->reply_attr->vendor, TAG_ANY);
+       reply_item = pairfind_da(request->reply->vps, inst->reply_attr, TAG_ANY);
        if (reply_item) {
                if (reply_item->vp_integer64 <= res) {
                        RDEBUG2("Leaving existing reply:%s value of %" PRIu64, inst->reply_attr->name,
index 59cbd44bb286614326e6cd707e39ff327f6a44a2..a1b4fff357e6227ddd28e2ed16b595af031f6bf9 100644 (file)
@@ -32,7 +32,7 @@ rlm_rcode_t rlm_yubikey_decrypt(rlm_yubikey_t *inst, REQUEST *request, char cons
                return RLM_MODULE_FAIL;
        }
 
-       key = pairfind(request->config_items, da->attr, da->vendor, TAG_ANY);
+       key = pairfind_da(request->config_items, da, TAG_ANY);
        if (!key) {
                REDEBUG("Yubikey-Key attribute not found in control list, can't decrypt OTP data");
                return RLM_MODULE_INVALID;
@@ -119,7 +119,7 @@ rlm_rcode_t rlm_yubikey_decrypt(rlm_yubikey_t *inst, REQUEST *request, char cons
        /*
         *      Now we check for replay attacks
         */
-       vp = pairfind(request->config_items, vp->da->attr, vp->da->vendor, TAG_ANY);
+       vp = pairfind_da(request->config_items, da, TAG_ANY);
        if (!vp) {
                RWDEBUG("Yubikey-Counter not found in control list, skipping replay attack checks");
                return RLM_MODULE_OK;