]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Use common boilerplate for setting Auth-Type
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 25 Apr 2018 11:26:01 +0000 (23:26 +1200)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 25 Apr 2018 11:32:58 +0000 (23:32 +1200)
src/modules/rlm_chap/rlm_chap.c
src/modules/rlm_eap/rlm_eap.c

index 64c911275195545e30574bf33efa1970d8b1c20a..4ebd662295ae268d3a8a570cec1ad2508c8c479b 100644 (file)
@@ -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);
index 36bfcb9a5e13d609df5a731a15c7ea5ef628eebb..2f3b113423f6938d14f8e806be4edc37c8137bc1 100644 (file)
@@ -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;