From: Arran Cudbard-Bell Date: Wed, 25 Apr 2018 11:26:01 +0000 (+1200) Subject: Use common boilerplate for setting Auth-Type X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b2820da9f90f5ee53d5e88012e382c31fc064eed;p=thirdparty%2Ffreeradius-server.git Use common boilerplate for setting Auth-Type --- diff --git a/src/modules/rlm_chap/rlm_chap.c b/src/modules/rlm_chap/rlm_chap.c index 64c91127519..4ebd662295a 100644 --- a/src/modules/rlm_chap/rlm_chap.c +++ b/src/modules/rlm_chap/rlm_chap.c @@ -84,11 +84,11 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, UNUSED void *t } if (fr_pair_find_by_da(request->control, attr_auth_type, TAG_ANY) != NULL) { - RWDEBUG2("&control:Auth-Type already set. Not setting to CHAP"); + RWDEBUG2("&control:%s already set. Not setting to %pV", attr_auth_type->name, inst->auth_type->alias); return RLM_MODULE_NOOP; } - RDEBUG("&control:%s := %s", attr_auth_type->name, inst->auth_type->alias); + RDEBUG("&control:%s = %s", attr_auth_type->name, inst->auth_type->alias); MEM(vp = pair_update_control(attr_auth_type, TAG_ANY)); fr_value_box_copy(vp, &vp->data, inst->auth_type->value); diff --git a/src/modules/rlm_eap/rlm_eap.c b/src/modules/rlm_eap/rlm_eap.c index 36bfcb9a5e1..2f3b113423f 100644 --- a/src/modules/rlm_eap/rlm_eap.c +++ b/src/modules/rlm_eap/rlm_eap.c @@ -717,16 +717,17 @@ static rlm_rcode_t mod_authorize(void *instance, UNUSED void *thread, REQUEST *r * each EAP sub-module to look for eap_session->request->username, * and to get excited if it doesn't appear. */ - MEM(vp = pair_update_control(attr_auth_type, TAG_ANY)); - if (vp->vp_uint32 != FR_AUTH_TYPE_REJECT) { - RDEBUG("&control:%s := %s", attr_auth_type->name, inst->auth_type->alias); - - fr_value_box_copy(vp, &vp->data, inst->auth_type->value); - vp->data.enumv = vp->da; - } else { - RWDEBUG2("Auth-Type already set. Not setting to EAP"); + if (fr_pair_find_by_da(request->control, attr_auth_type, TAG_ANY) != NULL) { + RWDEBUG2("&control:%s already set. Not setting to %pV", attr_auth_type->name, inst->auth_type->alias); + return RLM_MODULE_NOOP; } + RDEBUG("&control:%s = %s", attr_auth_type->name, inst->auth_type->alias); + + MEM(vp = pair_update_control(attr_auth_type, TAG_ANY)); + fr_value_box_copy(vp, &vp->data, inst->auth_type->value); + vp->data.enumv = vp->da; + if (status == RLM_MODULE_OK) return RLM_MODULE_OK; return RLM_MODULE_UPDATED;