From ccced6155a50e54406acf2a1cb3d85ef30bbc912 Mon Sep 17 00:00:00 2001 From: Arran Cudbard-Bell Date: Mon, 10 Nov 2014 12:44:07 -0500 Subject: [PATCH] Convert some pairfind calls to pairfind_da calls --- src/lib/pair.c | 4 ++-- src/main/xlat.c | 2 +- src/modules/rlm_eap/types/rlm_eap_peap/peap.c | 4 +--- src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c | 2 +- src/modules/rlm_ldap/attrmap.c | 2 +- src/modules/rlm_otp/otp_mppe.c | 4 ++-- src/modules/rlm_passwd/rlm_passwd.c | 2 +- src/modules/rlm_sometimes/rlm_sometimes.c | 2 +- src/modules/rlm_sqlcounter/rlm_sqlcounter.c | 6 +++--- src/modules/rlm_yubikey/decrypt.c | 4 ++-- 10 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/lib/pair.c b/src/lib/pair.c index 0d7ffb13a87..e252e4323e8 100644 --- a/src/lib/pair.c +++ b/src/lib/pair.c @@ -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; /* diff --git a/src/main/xlat.c b/src/main/xlat.c index 7398fd9bf46..cdc0a8c0e21 100644 --- a/src/main/xlat.c +++ b/src/main/xlat.c @@ -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; /* diff --git a/src/modules/rlm_eap/types/rlm_eap_peap/peap.c b/src/modules/rlm_eap/types/rlm_eap_peap/peap.c index e16822bc4e3..1920bc407d6 100644 --- a/src/modules/rlm_eap/types/rlm_eap_peap/peap.c +++ b/src/modules/rlm_eap/types/rlm_eap_peap/peap.c @@ -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. diff --git a/src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c b/src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c index 4fe8af3da64..c589113ffe6 100644 --- a/src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c +++ b/src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c @@ -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; } diff --git a/src/modules/rlm_ldap/attrmap.c b/src/modules/rlm_ldap/attrmap.c index 4c0eb8975aa..7561263ae04 100644 --- a/src/modules/rlm_ldap/attrmap.c +++ b/src/modules/rlm_ldap/attrmap.c @@ -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); diff --git a/src/modules/rlm_otp/otp_mppe.c b/src/modules/rlm_otp/otp_mppe.c index f8f624511b5..d58d1f937a7 100644 --- a/src/modules/rlm_otp/otp_mppe.c +++ b/src/modules/rlm_otp/otp_mppe.c @@ -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; } diff --git a/src/modules/rlm_passwd/rlm_passwd.c b/src/modules/rlm_passwd/rlm_passwd.c index 2583a67aeae..bb42c98ba81 100644 --- a/src/modules/rlm_passwd/rlm_passwd.c +++ b/src/modules/rlm_passwd/rlm_passwd.c @@ -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; } diff --git a/src/modules/rlm_sometimes/rlm_sometimes.c b/src/modules/rlm_sometimes/rlm_sometimes.c index 27ce5d554e1..fe679c26bb7 100644 --- a/src/modules/rlm_sometimes/rlm_sometimes.c +++ b/src/modules/rlm_sometimes/rlm_sometimes.c @@ -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); diff --git a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c index 51c7dac9a7c..1ae1ed8f65d 100644 --- a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c +++ b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c @@ -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, diff --git a/src/modules/rlm_yubikey/decrypt.c b/src/modules/rlm_yubikey/decrypt.c index 59cbd44bb28..a1b4fff357e 100644 --- a/src/modules/rlm_yubikey/decrypt.c +++ b/src/modules/rlm_yubikey/decrypt.c @@ -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; -- 2.47.3