]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move EAP-TLS to common API
authorAlan T. DeKok <aland@freeradius.org>
Thu, 9 Jan 2020 22:32:19 +0000 (17:32 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 9 Jan 2020 22:32:19 +0000 (17:32 -0500)
src/modules/rlm_eap/types/rlm_eap_tls/rlm_eap_tls.c

index 8e8a3d76d593cbce4383056775f9dff1cdd4075c..bf9dd0f844142cee87e3d63c60c9a2cfaabae6bf 100644 (file)
@@ -317,27 +317,37 @@ static int mod_instantiate(void *instance, CONF_SECTION *cs)
        return 0;
 }
 
-#define EAP_SECTION_COMPILE(_out, _field, _verb, _name) \
-do { \
-       CONF_SECTION *_tmp; \
-       _tmp = cf_section_find(server_cs, _verb, _name); \
-       if (_tmp) { \
-               if (unlang_compile(_tmp, MOD_AUTHORIZE, NULL, NULL) < 0) return -1; \
-               found = true; \
-       } \
-       if (_out) _out->_field = _tmp; \
-} while (0)
+#undef EAP_SECTION_DEFINE
+#define EAP_SECTION_DEFINE(_field, _verb, _name) \
+       { \
+               .name = _verb, \
+               .name2 = _name, \
+               .component = MOD_AUTHORIZE, \
+               .offset = offsetof(eap_tls_actions_t, _field), \
+       }
+
+static virtual_server_compile_t compile_list[] = {
+       EAP_SECTION_DEFINE(recv_access_request, "recv", "Access-Request"),
+
+       COMPILE_TERMINATOR
+};
+
 
 /** Compile virtual server sections
  *
  */
 static int mod_section_compile(eap_tls_actions_t *actions, CONF_SECTION *server_cs)
 {
-       bool found = false;
+       int found;
+       vp_tmpl_rules_t parse_rules;
 
        if (!fr_cond_assert(server_cs)) return -1;
 
-       EAP_SECTION_COMPILE(actions, recv_access_request, "recv", "Access-Request");
+       memset(&parse_rules, 0, sizeof(parse_rules));
+       parse_rules.dict_def = dict_freeradius;
+
+       found = virtual_server_compile_sections(server_cs, compile_list, &parse_rules, actions);
+       if (found < 0) return -1;
 
        /*
         *      Warn if we couldn't find any actions.