]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix Auth-Type Accept/Reject
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 20 Mar 2021 17:45:23 +0000 (17:45 +0000)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 31 Mar 2021 15:07:17 +0000 (16:07 +0100)
src/process/radius/base.c

index 8b53fd702114ca77244403779a3555e751385408..e0fafe7711896c00b48835f36b92a767493c6520 100644 (file)
@@ -60,7 +60,6 @@ static fr_dict_attr_t const *attr_user_password;
 
 extern fr_dict_attr_autoload_t process_radius_dict_attr[];
 fr_dict_attr_autoload_t process_radius_dict_attr[] = {
-
        { .out = &attr_auth_type, .name = "Auth-Type", .type = FR_TYPE_UINT32, .dict = &dict_freeradius },
        { .out = &attr_module_failure_message, .name = "Module-Failure-Message", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
        { .out = &attr_module_success_message, .name = "Module-Success-Message", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
@@ -79,6 +78,16 @@ fr_dict_attr_autoload_t process_radius_dict_attr[] = {
        { NULL }
 };
 
+static fr_value_box_t const    *enum_auth_type_accept;
+static fr_value_box_t const    *enum_auth_type_reject;
+
+extern fr_dict_enum_autoload_t process_radius_dict_enum[];
+fr_dict_enum_autoload_t process_radius_dict_enum[] = {
+       { .out = &enum_auth_type_accept, .name = "Accept", .attr = &attr_auth_type },
+       { .out = &enum_auth_type_accept, .name = "Reject", .attr = &attr_auth_type },
+       { NULL }
+};
+
 /*
  *     RADIUS state machine configuration
  */
@@ -346,6 +355,19 @@ RESUME(access_request)
        dv = fr_dict_enum_by_value(vp->da, &vp->data);
        if (!dv) goto send_reply;
 
+       /*
+        *      The magic Auth-Type accept value
+        *      which means skip the authenticate
+        *      section...
+        */
+       if (fr_value_box_cmp(enum_auth_type_accept, dv->value) == 0) {
+               request->reply->code = FR_RADIUS_CODE_ACCESS_ACCEPT;
+               goto send_reply;
+       } else if (fr_value_box_cmp(enum_auth_type_reject, dv->value) == 0) {
+               request->reply->code = FR_RADIUS_CODE_ACCESS_REJECT;
+               goto send_reply;
+       }
+
        cs = cf_section_find(inst->server_cs, "authenticate", dv->name);
        if (!cs) {
                RDEBUG2("No 'authenticate %s { ... }' section found - skipping...", dv->name);