From: Alan T. DeKok Date: Fri, 18 Nov 2016 16:18:59 +0000 (-0500) Subject: reject on no auth-type X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4053ee4e14954bca800d0db360ae9be3cf575d43;p=thirdparty%2Ffreeradius-server.git reject on no auth-type --- diff --git a/src/modules/proto_radius/proto_radius_auth.c b/src/modules/proto_radius/proto_radius_auth.c index 97a85c22802..40b23bd929a 100644 --- a/src/modules/proto_radius/proto_radius_auth.c +++ b/src/modules/proto_radius/proto_radius_auth.c @@ -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);