]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix Auth-Type checks in rlm_pap and rlm_chap
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 29 Aug 2019 01:33:17 +0000 (21:33 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 29 Aug 2019 01:37:14 +0000 (21:37 -0400)
They were looking in the wrong list, and the output should not have been an error

src/modules/rlm_chap/rlm_chap.c
src/modules/rlm_pap/rlm_pap.c

index a2140eacfe2199b731bdc4ed2a4fee9c87bd073c..d16ffc669fc0c1e023cb2f3f301a15f0b138b72e 100644 (file)
@@ -65,17 +65,17 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, UNUSED void *t
        rlm_chap_t      *inst = instance;
        VALUE_PAIR      *vp;
 
+       if (fr_pair_find_by_da(request->control, attr_auth_type, TAG_ANY) != NULL) {
+               RDEBUG3("Auth-Type is already set.  Not setting 'Auth-Type := %s'", inst->name);
+               return RLM_MODULE_NOOP;
+       }
+
        /*
         *      This case means the warnings below won't be printed
         *      unless there's a CHAP-Password in the request.
         */
        if (!fr_pair_find_by_da(request->packet->vps, attr_chap_password, TAG_ANY)) return RLM_MODULE_NOOP;
 
-       if (fr_pair_find_by_da(request->packet->vps, attr_auth_type, TAG_ANY) != NULL) {
-               REDEBUG("Auth-Type is already set.  Not setting 'Auth-Type := %s'", inst->name);
-               return RLM_MODULE_NOOP;
-       }
-
        /*
         *      Create the CHAP-Challenge if it wasn't already in the packet.
         *
index 1847a0742d0463112ddab32582341fe9aad2d347..3ff97e9d02f03e9da805944ff1a472332d3e1b8e 100644 (file)
@@ -172,8 +172,8 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, UNUSED void *t
        rlm_pap_t const         *inst = instance;
        VALUE_PAIR              *password;
 
-       if (fr_pair_find_by_da(request->packet->vps, attr_auth_type, TAG_ANY) != NULL) {
-               REDEBUG("Auth-Type is already set.  Not setting 'Auth-Type := %s'", inst->name);
+       if (fr_pair_find_by_da(request->control, attr_auth_type, TAG_ANY) != NULL) {
+               RDEBUG3("Auth-Type is already set.  Not setting 'Auth-Type := %s'", inst->name);
                return RLM_MODULE_NOOP;
        }