]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
reject on no auth-type
authorAlan T. DeKok <aland@freeradius.org>
Fri, 18 Nov 2016 16:18:59 +0000 (11:18 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 18 Nov 2016 16:39:24 +0000 (11:39 -0500)
src/modules/proto_radius/proto_radius_auth.c

index 97a85c2280243ae6fe407bb60dcb9a81a4741bfd..40b23bd929a5e09ed8e8ef2dad69cfafd0a10b0c 100644 (file)
@@ -429,30 +429,37 @@ static void auth_running(REQUEST *request, fr_state_action_t action)
                        RWDEBUG("Ignoring extra Auth-Type = %s", fr_dict_enum_name_by_da(NULL, auth_type->da, vp->vp_integer));
                }
 
+               /*
+                *      No Auth-Type, force it to reject.
+                */
+               if (!auth_type) {
+                       REDEBUG2("No Auth-Type available: rejecting the user.");
+                       request->reply->code = PW_CODE_ACCESS_REJECT;
+                       goto setup_send;
+               }
+
                /*
                 *      Handle hard-coded Accept and Reject.
                 */
-               if (auth_type) {
-                       if (auth_type->vp_integer == PW_AUTH_TYPE_ACCEPT) {
-                               RDEBUG2("Auth-Type = Accept, allowing user");
-                               goto setup_send;
-                       }
+               if (auth_type->vp_integer == PW_AUTH_TYPE_ACCEPT) {
+                       RDEBUG2("Auth-Type = Accept, allowing user");
+                       goto setup_send;
+               }
 
-                       if (auth_type->vp_integer == PW_AUTH_TYPE_REJECT) {
-                               RDEBUG2("Auth-Type = Reject, rejecting user");
-                               goto setup_send;
-                       }
+               if (auth_type->vp_integer == PW_AUTH_TYPE_REJECT) {
+                       RDEBUG2("Auth-Type = Reject, rejecting user");
+                       goto setup_send;
+               }
 
-                       /*
-                        *      Find the appropriate Auth-Type by name.
-                        */
-                       vp = auth_type;
-                       dv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_integer);
-                       if (!dv) {
-                               REDEBUG2("Unknown Auth-Type %d found: rejecting the user.", vp->vp_integer);
-                               request->reply->code = PW_CODE_ACCESS_REJECT;
-                               goto setup_send;
-                       }
+               /*
+                *      Find the appropriate Auth-Type by name.
+                */
+               vp = auth_type;
+               dv = fr_dict_enum_by_da(NULL, vp->da, vp->vp_integer);
+               if (!dv) {
+                       REDEBUG2("Unknown Auth-Type %d found: rejecting the user.", vp->vp_integer);
+                       request->reply->code = PW_CODE_ACCESS_REJECT;
+                       goto setup_send;
                }
 
                unlang = cf_section_sub_find_name2(request->server_cs, "process", dv->name);