regex.c \
request.c \
request_data.c \
+ section.c \
snmp.c \
state.c \
stats.c \
*
*/
struct module_method_binding_s {
- fr_dict_t const **proto; //!< Only allow this method to be called in this namespace.
-
section_name_t const *section; //!< Identifier for a section.
module_method_t method; //!< Module method to call
- call_env_method_t const * const method_env; //!< Call specific conf parsing.
+ call_env_method_t const *method_env; //!< Method specific call_env.
+
+ fr_dlist_head_t name2_list; //!< List of bindings with the same name1. Only initialised
+ ///< for the the first name1 binding.
+ ///< DO NOT INITIALISE IN THE MODULE.
+ fr_dlist_t name2_entry; //!< Linked list of bindings with the same name1.
+ ///< Allows us to more quickly iterate over all
+ ///< name2 entries after finding a matching name1.
+ ///< This is also temporarily used to verify the ordering
+ ///< of name bindings.
+ ///< DO NOT INITIALISE IN THE MODULE.
};
/** Struct exported by a rlm_* module
* @copyright 2000 Alan DeKok (aland@freeradius.org)
* @copyright 2000 Alan Curry (pacman@world.std.com)
*/
-
RCSID("$Id$")
#include <freeradius-devel/server/cf_file.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/server/pair.h>
#include <freeradius-devel/server/virtual_servers.h>
+
#include <freeradius-devel/util/atexit.h>
+#include <freeradius-devel/util/debug.h>
+#include <freeradius-devel/util/dlist.h>
#include <freeradius-devel/unlang/compile.h>
#include <freeradius-devel/unlang/xlat_func.h>
return modules_instantiate(rlm_modules_static);
}
+/** Compare the section names of two module_method_binding_t structures
+ */
+static int8_t binding_name_cmp(void const *one, void const *two)
+{
+ module_method_binding_t const *a = one;
+ module_method_binding_t const *b = two;
+
+ return section_name_cmp(a->section, b->section);
+}
+
+static int module_method_validate(module_instance_t *mi)
+{
+ module_method_binding_t *p, *srt_p;
+ module_rlm_t const *mrlm;
+ fr_dlist_head_t bindings;
+ bool in_order = true;
+
+ mrlm = module_rlm_from_module(mi->exported);
+
+ fr_dlist_init(&bindings, module_method_binding_t, name2_entry);
+
+ /*
+ * Not all modules export module method bindings
+ */
+ if (!mrlm->bindings) return 0;
+
+ for (p = mrlm->bindings; p->section; p++) {
+ if (!fr_cond_assert_msg(p->section->name1,
+ "%s: First section identifier can't be NULL", mi->name)) return -1;
+ if (!fr_cond_assert_msg(p->section->name1 || p->section->name2,
+ "%s: Section identifiers can't both be null", mi->name)) return -1;
+
+ /*
+ * All the bindings go in a list so we can sort them
+ * and produce the list in the correct order.
+ */
+ fr_dlist_insert_tail(&bindings, p);
+ }
+
+ fr_dlist_sort(&bindings, binding_name_cmp);
+
+ /*
+ * Iterate over the sorted list of bindings,
+ * and the original list, to ensure they're
+ * in the correct order.
+ */
+ for (srt_p = fr_dlist_head(&bindings), p = mrlm->bindings;
+ srt_p;
+ srt_p = fr_dlist_next(&bindings, srt_p), p++) {
+ if (p != srt_p) {
+ in_order = false;
+ break;
+ }
+#if 0
+ {
+ module_method_binding_t const *pp;
+ /*
+ * Print the correct order of bindings
+ */
+ FR_FAULT_LOG("%s: Module method bindings are not in the correct order, the correct order is:", mi->name);
+ FR_FAULT_LOG(".bindings = (module_method_binding_t[]){");
+ for (pp = fr_dlist_head(&bindings);
+ pp;
+ pp = fr_dlist_next(&bindings, pp)) {
+ char const *name1_quote = (pp->section->name1 && (pp->section->name1 != CF_IDENT_ANY)) ? "\"" : "";
+ char const *name2_quote = (pp->section->name2 && (pp->section->name2 != CF_IDENT_ANY)) ? "\"" : "";
+ char const *name1 = pp->section->name1;
+ char const *name2 = pp->section->name2;
+
+ if (name1 == CF_IDENT_ANY) {
+ name1 = "CF_IDENT_ANY";
+ } else if (!name1) {
+ name1 = "NULL";
+ }
+ if (name2 == CF_IDENT_ANY) {
+ name2 = "CF_IDENT_ANY";
+ } else if (!name2) {
+ name2 = "NULL";
+ }
+
+ FR_FAULT_LOG("\t.section = SECTION_NAME(%s%s%s, %s%s%s)",
+ name1_quote, name1, name1_quote,
+ name2_quote, name2, name2_quote);
+ }
+ FR_FAULT_LOG("}");
+ }
+#endif
+ }
+
+ /*
+ * Rebuild the binding list in the correct order.
+ */
+ if (!in_order) {
+ module_method_binding_t *ordered;
+
+ MEM(ordered = talloc_array(NULL, module_method_binding_t, fr_dlist_num_elements(&bindings)));
+ for (srt_p = fr_dlist_head(&bindings), p = ordered;
+ srt_p;
+ srt_p = fr_dlist_next(&bindings, srt_p), p++) {
+ *p = *srt_p;
+ }
+ memcpy(mrlm->bindings, ordered, fr_dlist_num_elements(&bindings) * sizeof(*ordered));
+ talloc_free(ordered);
+ }
+
+ /*
+ * Build the "skip" list of name1 entries
+ */
+ {
+ module_method_binding_t *last_binding = NULL;
+
+ for (p = mrlm->bindings; p->section; p++) {
+ if (!last_binding ||
+ (
+ (last_binding->section->name1 != p->section->name1) &&
+ (
+ (last_binding->section->name1 == CF_IDENT_ANY) ||
+ (p->section->name1 == CF_IDENT_ANY) ||
+ (strcmp(last_binding->section->name1, p->section->name1) != 0)
+ )
+ )
+ ) {
+ fr_dlist_init(&p->name2_list, module_method_binding_t, name2_entry);
+ last_binding = p;
+ }
+ fr_dlist_insert_tail(&last_binding->name2_list, p);
+ }
+ }
+
+ return 0;
+}
+
static int module_conf_parse(module_list_t *ml, CONF_SECTION *mod_conf)
{
char const *name;
if (unlikely(mi == NULL)) {
cf_log_perr(mod_conf, "Failed loading module");
return -1;
+ }
+ /*
+ * First time we've loaded the dl module, so we need to
+ * check the module methods to make sure they're ordered
+ * correctly, and to add the "skip list" style name2
+ * entries.
+ */
+ if ((mi->module->refs == 1) && (module_method_validate(mi) < 0)) {
+ talloc_free(mi);
+ return -1;
}
if (module_instance_conf_parse(mi, mod_conf) < 0) {
typedef struct {
module_t common; //!< Common fields presented by all modules.
- module_method_binding_t const *bindings; //!< named methods
+ module_method_binding_t *bindings; //!< named methods
} module_rlm_t;
/** Cast a module_t to a module_rlm_t
--- /dev/null
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+/**
+ * $Id$
+ *
+ * @file lib/server/section.c
+ * @brief Comparison functions for sections
+ *
+ * @copyright 2024 Arran Cudbard-Bell (a.cudbardb@freeradius.org)
+ */
+RCSID("$Id$")
+
+#include <freeradius-devel/server/section.h>
+#include <freeradius-devel/server/cf_util.h>
+
+#define IDENT_ANY_CMP(_a, _b) \
+ (((_a) == CF_IDENT_ANY) < ((_b) == CF_IDENT_ANY)) - (((_a) == CF_IDENT_ANY) > ((_b) == CF_IDENT_ANY))
+
+#define NULL_CMP(_a, _b) \
+ (((_a) == NULL) < ((_b) == NULL)) - (((_a) == NULL) > ((_b) == NULL))
+
+/** Compare two sections
+ *
+ * - Sections are sorted by name1, then name2.
+ * - NULLs sort before non-NULLs.
+ * - CF_IDENT_ANY sort after non-CF_IDENT_ANY.
+ * - Any other comparisons are lexicographic.
+ *
+ * @param[in] one First section name.
+ * @param[in] two Second section name.
+ *
+ * @return < 0 if one < two, 0 if one == two, > 0 if one > two.
+ */
+int8_t section_name_cmp(void const *one, void const *two)
+{
+ section_name_t const *a = one;
+ section_name_t const *b = two;
+ int ret;
+
+ /*
+ * name1 isn't allowed to be NULL, for wildcard matches
+ * we use CF_IDENT_ANY.
+ */
+ fr_assert(a->name1 && b->name1);
+
+ /*
+ * Straight comparison between sections.
+ */
+ ret = CMP(a, b);
+ if (ret == 0) return 0;
+
+ /*
+ * Fastpath for static strings and CF_IDENT_ANY
+ */
+ if (a->name1 == b->name1) goto name2;
+
+ /*
+ * If either identifier is CF_IDENT_ANY, we can't strcmp.
+ */
+ if ((a->name1 == CF_IDENT_ANY) || (b->name1 == CF_IDENT_ANY)) {
+ ret = IDENT_ANY_CMP(b->name1, a->name1);
+ if (ret != 0) return ret;
+ } else {
+ ret = strcmp(a->name1, b->name1);
+ if (ret != 0) return CMP(ret, 0);
+ }
+
+name2:
+ /*
+ * Second identifier can be NULL.
+ *
+ * NULL name2s sort first.
+ */
+ ret = NULL_CMP(a->name2, b->name2);
+ if (ret != 0) return ret;
+
+ if (a->name2 == b->name2) return 0;
+
+ if ((a->name2 == CF_IDENT_ANY) || (b->name2 == CF_IDENT_ANY)) {
+ return IDENT_ANY_CMP(b->name2, a->name2); /* Can't strcmp */
+ }
+
+ return CMP(strcmp(a->name2, b->name2), 0);
+}
+
+/* Compare two section names
+ *
+ * Respects CF_IDENT_ANY values
+ *
+ * @param[in] a First section name.
+ * @param[in] b Second section name.
+ *
+ * @return true if the section names match, false otherwise.
+ */
+bool section_name_match(section_name_t const *a, section_name_t const *b)
+{
+ if ((a->name1 == CF_IDENT_ANY) || (b->name2 == CF_IDENT_ANY)) goto name2;
+
+ if (strcmp(a->name1, b->name1) != 0) return false;
+
+name2:
+ if ((a->name2 == CF_IDENT_ANY) || (b->name2 == CF_IDENT_ANY)) return true;
+
+ return (strcmp(a->name2, b->name2) == 0);
+}
*/
RCSIDH(section_h, "$Id$")
+#include <stdbool.h>
+
#ifdef __cplusplus
extern "C" {
#endif
char const *name2; //!< Second section name. Usually a packet type like 'access-request', 'access-accept', etc...
} section_name_t;
+int8_t section_name_cmp(void const *one, void const *two);
+
+bool section_name_match(section_name_t const *a, section_name_t const *b);
+
#ifdef __cplusplus
}
#endif
/*
* Hack to support old configurations
*/
+ { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
{ .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize },
{ .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct },
{ .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
- { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
+
{ .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth },
MODULE_BINDING_TERMINATOR
}
.detach = mod_detach
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("status", CF_IDENT_ANY), .method = mod_method_status, .method_env = &cache_method_env },
+ { .section = SECTION_NAME("clear", CF_IDENT_ANY), .method = mod_method_clear, .method_env = &cache_method_env },
{ .section = SECTION_NAME("load", CF_IDENT_ANY), .method = mod_method_load, .method_env = &cache_method_env },
- { .section = SECTION_NAME("update", CF_IDENT_ANY), .method = mod_method_update, .method_env = &cache_method_env },
+ { .section = SECTION_NAME("status", CF_IDENT_ANY), .method = mod_method_status, .method_env = &cache_method_env },
{ .section = SECTION_NAME("store", CF_IDENT_ANY), .method = mod_method_store, .method_env = &cache_method_env },
- { .section = SECTION_NAME("clear", CF_IDENT_ANY), .method = mod_method_clear, .method_env = &cache_method_env },
- { .section = SECTION_NAME("ttl", CF_IDENT_ANY), .method = mod_method_ttl, .method_env = &cache_method_env },
+ { .section = SECTION_NAME("ttl", CF_IDENT_ANY), .method = mod_method_ttl, .method_env = &cache_method_env },
+ { .section = SECTION_NAME("update", CF_IDENT_ANY), .method = mod_method_update, .method_env = &cache_method_env },
{ .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_cache_it, .method_env = &cache_method_env },
MODULE_BINDING_TERMINATOR
}
.instantiate = mod_instantiate
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize,
- .method_env = &chap_autz_method_env },
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate,
- .method_env = &chap_auth_method_env },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &chap_auth_method_env },
+ { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize, .method_env = &chap_autz_method_env },
MODULE_BINDING_TERMINATOR
}
};
.detach = mod_detach
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
{ .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
+ { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
MODULE_BINDING_TERMINATOR
}
};
.instantiate = mod_instantiate
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_accounting,
- .method_env = &method_env },
- { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize,
- .method_env = &method_env },
- { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting,
- .method_env = &method_env },
- { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth,
- .method_env = &method_env },
+ { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, .method_env = &method_env },
+ { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_accounting, .method_env = &method_env },
+ { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &method_env },
+ { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth, .method_env = &method_env },
MODULE_BINDING_TERMINATOR
}
};
.instantiate = mod_instantiate,
},
.bindings = (module_method_binding_t[]){
- { .proto = &dict_radius, .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize },
- { .proto = &dict_radius, .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
+ { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize },
MODULE_BINDING_TERMINATOR
},
};
.instantiate = mod_instantiate,
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize },
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
- { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
+ { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize },
+ { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth },
MODULE_BINDING_TERMINATOR
}
};
.instantiate = mob_instantiate
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_exec_dispatch_oneshot,
- .method_env = &exec_method_env },
+ { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_exec_dispatch_oneshot, .method_env = &exec_method_env },
MODULE_BINDING_TERMINATOR
}
};
.config = module_config,
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_files,
- .method_env = &method_env },
+ { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_files, .method_env = &method_env },
MODULE_BINDING_TERMINATOR
}
.thread_detach = mod_thread_detach,
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
MODULE_BINDING_TERMINATOR
}
};
.instantiate = mod_instantiate
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
- { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth },
+ { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
+ { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth },
MODULE_BINDING_TERMINATOR
}
};
/*
* Hack to support old configurations
*/
- { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize,
- .method_env = &authorize_method_env },
-
- { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize,
- .method_env = &authorize_method_env },
- { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting,
- .method_env = &usermod_method_env },
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate,
- .method_env = &authenticate_method_env },
- { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth,
- .method_env = &usermod_method_env },
+ { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, .method_env = &usermod_method_env },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &authenticate_method_env },
+ { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env },
+
+ { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env },
+ { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth, .method_env = &usermod_method_env },
MODULE_BINDING_TERMINATOR
}
};
/*
* Hack to support old configurations
*/
- { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize },
+ { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
+ { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize },
- { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct },
- { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
- { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
- { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth },
+ { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct },
+ { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
+ { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth },
MODULE_BINDING_TERMINATOR
}
};
/*
* Hack to support old configurations
*/
- { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize },
+ { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
+ { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize },
- { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct },
- { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
- { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
- { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth },
+ { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct },
+ { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
+
+ { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth },
MODULE_BINDING_TERMINATOR
}
};
.detach = mod_detach
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize,
- .method_env = &mschap_autz_method_env },
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate,
- .method_env = &mschap_auth_method_env },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &mschap_auth_method_env },
+ { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &mschap_autz_method_env },
MODULE_BINDING_TERMINATOR
}
};
.instantiate = mod_instantiate
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
+ { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
MODULE_BINDING_TERMINATOR
}
};
.instantiate = mod_instantiate
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
MODULE_BINDING_TERMINATOR
}
};
/*
* Hack to support old configurations
*/
- { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize,
- .method_env = &pap_method_env },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &pap_method_env },
+ { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &pap_method_env },
+ { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize, .method_env = &pap_method_env },
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate,
- .method_env = &pap_method_env },
- { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize,
- .method_env = &pap_method_env },
MODULE_BINDING_TERMINATOR
}
};
.detach = mod_detach
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_passwd_map },
+ { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_passwd_map },
MODULE_BINDING_TERMINATOR
}
};
/*
* Hack to support old configurations
*/
- { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize },
+ { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
+ { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize },
- { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct },
- { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
- { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
- { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth },
+ { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct },
+ { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
+
+ { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth },
MODULE_BINDING_TERMINATOR
}
};
/*
* Hack to support old configurations
*/
- { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize },
+ { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
+ { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize },
- { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct },
- { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
- { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
- { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth },
+ { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct },
+ { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
+
+ { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth },
MODULE_BINDING_TERMINATOR
}
};
.detach = mod_detach
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting,
- .method_env = &method_env },
+ { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting, .method_env = &method_env },
MODULE_BINDING_TERMINATOR
}
};
.instantiate = mod_instantiate
},
.bindings = (module_method_binding_t[]){
- /*
- * RADIUS specific
- */
- { .section = SECTION_NAME("recv", "access-request"), .method = mod_alloc,
- .method_env = &redis_ippool_alloc_method_env },
- { .section = SECTION_NAME("accounting", "start"), .method = mod_update,
- .method_env = &redis_ippool_update_method_env },
- { .section = SECTION_NAME("accounting", "interim-update"), .method = mod_update,
- .method_env = &redis_ippool_update_method_env },
- { .section = SECTION_NAME("accounting", "stop"), .method = mod_release,
- .method_env = &redis_ippool_release_method_env },
- { .section = SECTION_NAME("accounting", "accounting-on"), .method = mod_bulk_release,
- .method_env = &redis_ippool_bulk_release_method_env },
- { .section = SECTION_NAME("accounting", "accounting-off"), .method = mod_bulk_release,
- .method_env = &redis_ippool_bulk_release_method_env },
-
- /*
- * DHCPv4
- */
- { .section = SECTION_NAME("recv", "discover"), .method = mod_alloc,
- .method_env = &redis_ippool_alloc_method_env },
- { .section = SECTION_NAME("recv", "release"), .method = mod_release,
- .method_env = &redis_ippool_release_method_env },
- { .section = SECTION_NAME("send", "ack"), .method = mod_update,
- .method_env = &redis_ippool_update_method_env },
-
- /*
- * DHCPv6
- */
- { .section = SECTION_NAME("recv", "solicit"), .method = mod_alloc,
- .method_env = &redis_ippool_alloc_method_env },
-
- /*
- * Generic
- */
- { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_update,
- .method_env = &redis_ippool_update_method_env },
- { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_alloc,
- .method_env = &redis_ippool_alloc_method_env },
-
- /*
- * Named methods matching module operations
- */
- { .section = SECTION_NAME("allocate", CF_IDENT_ANY), .method = mod_alloc,
- .method_env = &redis_ippool_alloc_method_env },
- { .section = SECTION_NAME("update", CF_IDENT_ANY), .method = mod_update,
- .method_env = &redis_ippool_update_method_env },
- { .section = SECTION_NAME("renew", CF_IDENT_ANY), .method = mod_update,
- .method_env = &redis_ippool_update_method_env },
- { .section = SECTION_NAME("release", CF_IDENT_ANY), .method = mod_release,
- .method_env = &redis_ippool_release_method_env },
- { .section = SECTION_NAME("bulk-release", CF_IDENT_ANY), .method = mod_bulk_release,
- .method_env = &redis_ippool_bulk_release_method_env },
+ { .section = SECTION_NAME("recv", "Access-Request"), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* radius */
+ { .section = SECTION_NAME("accounting", "Start"), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* radius */
+ { .section = SECTION_NAME("accounting", "Interim-Update"), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* radius */
+ { .section = SECTION_NAME("accounting", "Stop"), .method = mod_release, .method_env = &redis_ippool_release_method_env }, /* radius */
+ { .section = SECTION_NAME("accounting", "Accounting-On"), .method = mod_bulk_release, .method_env = &redis_ippool_bulk_release_method_env }, /* radius */
+ { .section = SECTION_NAME("accounting", "Accounting-Off"), .method = mod_bulk_release, .method_env = &redis_ippool_bulk_release_method_env }, /* radius */
+
+ { .section = SECTION_NAME("recv", "Discover"), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* dhcpv4 */
+ { .section = SECTION_NAME("recv", "Release"), .method = mod_release, .method_env = &redis_ippool_release_method_env }, /* dhcpv4 */
+ { .section = SECTION_NAME("send", "Ack"), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* dhcpv4 */
+
+ { .section = SECTION_NAME("recv", "Solicit"), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* dhcpv6 */
+
+ { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* generic */
+ { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* generic */
+
+ { .section = SECTION_NAME("allocate", NULL), .method = mod_alloc, .method_env = &redis_ippool_alloc_method_env }, /* verb */
+ { .section = SECTION_NAME("update", NULL), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* verb */
+ { .section = SECTION_NAME("renew", NULL), .method = mod_update, .method_env = &redis_ippool_update_method_env }, /* verb */
+ { .section = SECTION_NAME("release", NULL), .method = mod_release, .method_env = &redis_ippool_release_method_env }, /* verb */
+ { .section = SECTION_NAME("bulk-release", NULL), .method = mod_bulk_release, .method_env = &redis_ippool_bulk_release_method_env }, /* verb */
MODULE_BINDING_TERMINATOR
}
};
.instantiate = mod_instantiate
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
+ { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
MODULE_BINDING_TERMINATOR
}
};
.detach = mod_detach
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
MODULE_BINDING_TERMINATOR
}
};
.thread_detach = mod_thread_detach
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize },
+ { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize },
MODULE_BINDING_TERMINATOR
}
};
.thread_detach = mod_thread_detach,
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("mail", CF_IDENT_ANY), .method = mod_mail,
- .method_env = &method_env },
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate,
- .method_env = &auth_env },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &auth_env },
+ { .section = SECTION_NAME("mail", CF_IDENT_ANY), .method = mod_mail, .method_env = &method_env },
+
MODULE_BINDING_TERMINATOR
}
};
.instantiate = mod_instantiate
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_sometimes_reply },
- { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_sometimes_packet },
+ { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_sometimes_reply },
+ { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_sometimes_packet },
MODULE_BINDING_TERMINATOR
}
};
/*
* Hack to support old configurations
*/
- { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize,
- .method_env = &authorize_method_env },
-
- { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize,
- .method_env = &authorize_method_env },
- { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_sql_redundant,
- .method_env = &accounting_method_env },
- { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_sql_redundant,
- .method_env = &send_method_env },
+ { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_sql_redundant, .method_env = &accounting_method_env },
+ { .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env },
+
+ { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &authorize_method_env },
+ { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_sql_redundant, .method_env = &send_method_env },
MODULE_BINDING_TERMINATOR
}
};
.instantiate = mod_instantiate,
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize,
- .method_env = &sqlcounter_call_env },
+ { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_authorize, .method_env = &sqlcounter_call_env },
MODULE_BINDING_TERMINATOR
}
};
/*
* RADIUS specific
*/
- { .section = SECTION_NAME("recv", "access-request"), .method = mod_alloc,
- .method_env = &sqlippool_alloc_method_env },
- { .section = SECTION_NAME("accounting", "start"), .method = mod_common,
- .method_env = &sqlippool_update_method_env },
- { .section = SECTION_NAME("accounting", "alive"), .method = mod_common,
- .method_env = &sqlippool_update_method_env },
- { .section = SECTION_NAME("accounting", "stop"), .method = mod_common,
- .method_env = &sqlippool_release_method_env },
- { .section = SECTION_NAME("accounting", "accounting-on"), .method = mod_common,
- .method_env = &sqlippool_bulk_release_method_env },
- { .section = SECTION_NAME("accounting", "accounting-off"), .method = mod_common,
- .method_env = &sqlippool_bulk_release_method_env },
+ { .section = SECTION_NAME("recv", "access-request"), .method = mod_alloc, .method_env = &sqlippool_alloc_method_env },
+ { .section = SECTION_NAME("accounting", "start"), .method = mod_common, .method_env = &sqlippool_update_method_env },
+ { .section = SECTION_NAME("accounting", "alive"), .method = mod_common, .method_env = &sqlippool_update_method_env },
+ { .section = SECTION_NAME("accounting", "stop"), .method = mod_common, .method_env = &sqlippool_release_method_env },
+ { .section = SECTION_NAME("accounting", "accounting-on"), .method = mod_common, .method_env = &sqlippool_bulk_release_method_env },
+ { .section = SECTION_NAME("accounting", "accounting-off"), .method = mod_common, .method_env = &sqlippool_bulk_release_method_env },
/*
* DHCPv4
*/
- { .section = SECTION_NAME("recv", "Discover"), .method = mod_alloc,
- .method_env = &sqlippool_alloc_method_env },
- { .section = SECTION_NAME("recv", "Request"), .method = mod_common,
- .method_env = &sqlippool_update_method_env },
- { .section = SECTION_NAME("recv", "Confirm"), .method = mod_common,
- .method_env = &sqlippool_update_method_env },
- { .section = SECTION_NAME("recv", "Rebind"), .method = mod_common,
- .method_env = &sqlippool_update_method_env },
- { .section = SECTION_NAME("recv", "Renew"), .method = mod_common,
- .method_env = &sqlippool_update_method_env },
- { .section = SECTION_NAME("recv", "Release"), .method = mod_common,
- .method_env = &sqlippool_release_method_env },
- { .section = SECTION_NAME("recv", "Decline"), .method = mod_common,
- .method_env = &sqlippool_mark_method_env },
+ { .section = SECTION_NAME("recv", "Discover"), .method = mod_alloc, .method_env = &sqlippool_alloc_method_env },
+ { .section = SECTION_NAME("recv", "Request"), .method = mod_common, .method_env = &sqlippool_update_method_env },
+ { .section = SECTION_NAME("recv", "Confirm"), .method = mod_common, .method_env = &sqlippool_update_method_env },
+ { .section = SECTION_NAME("recv", "Rebind"), .method = mod_common, .method_env = &sqlippool_update_method_env },
+ { .section = SECTION_NAME("recv", "Renew"), .method = mod_common, .method_env = &sqlippool_update_method_env },
+ { .section = SECTION_NAME("recv", "Release"), .method = mod_common, .method_env = &sqlippool_release_method_env },
+ { .section = SECTION_NAME("recv", "Decline"), .method = mod_common, .method_env = &sqlippool_mark_method_env },
/*
* Generic
*/
- { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_common,
- .method_env = &sqlippool_update_method_env },
- { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_alloc,
- .method_env = &sqlippool_alloc_method_env },
+ { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_common, .method_env = &sqlippool_update_method_env },
+ { .section = SECTION_NAME("send", CF_IDENT_ANY),.method = mod_alloc, .method_env = &sqlippool_alloc_method_env },
/*
* Named methods matching module operations
*/
- { .section = SECTION_NAME("allocate", CF_IDENT_ANY), .method = mod_alloc,
- .method_env = &sqlippool_alloc_method_env },
- { .section = SECTION_NAME("update", CF_IDENT_ANY), .method = mod_common,
- .method_env = &sqlippool_update_method_env },
- { .section = SECTION_NAME("renew", CF_IDENT_ANY), .method = mod_common,
- .method_env = &sqlippool_update_method_env },
- { .section = SECTION_NAME("release", CF_IDENT_ANY), .method = mod_common,
- .method_env = &sqlippool_release_method_env },
- { .section = SECTION_NAME("bulk-release", CF_IDENT_ANY), .method = mod_common,
- .method_env = &sqlippool_bulk_release_method_env },
- { .section = SECTION_NAME("mark", CF_IDENT_ANY), .method = mod_common,
- .method_env = &sqlippool_mark_method_env },
+ { .section = SECTION_NAME("allocate", NULL), .method = mod_alloc, .method_env = &sqlippool_alloc_method_env },
+ { .section = SECTION_NAME("update", NULL), .method = mod_common, .method_env = &sqlippool_update_method_env },
+ { .section = SECTION_NAME("renew", NULL), .method = mod_common, .method_env = &sqlippool_update_method_env },
+ { .section = SECTION_NAME("release", NULL), .method = mod_common, .method_env = &sqlippool_release_method_env },
+ { .section = SECTION_NAME("bulk-release", NULL), .method = mod_common, .method_env = &sqlippool_bulk_release_method_env },
+ { .section = SECTION_NAME("mark", NULL),.method = mod_common,.method_env = &sqlippool_mark_method_env },
MODULE_BINDING_TERMINATOR
}
.thread_detach = mod_thread_detach
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_stats },
+ { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_stats },
MODULE_BINDING_TERMINATOR
}
};
.instantiate = mod_instantiate,
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_process },
+ { .section = SECTION_NAME(CF_IDENT_ANY, CF_IDENT_ANY), .method = mod_process },
MODULE_BINDING_TERMINATOR
},
};
.thread_detach = mod_thread_detach
},
.bindings = (module_method_binding_t[]){
+ { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
{ .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_authorize },
+ { .section = SECTION_NAME("name1_null", NULL), .method = mod_return },
+
+ { .section = SECTION_NAME("recv", "access-challenge"), .method = mod_return },
{ .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct },
{ .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
- { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
- { .section = SECTION_NAME("recv", "access-challenge"), .method = mod_return },
- { .section = SECTION_NAME("name1_null", NULL), .method = mod_return },
- { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_return },
{ .section = SECTION_NAME("retry", NULL), .method = mod_retry },
+ { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_return },
MODULE_BINDING_TERMINATOR
}
.instantiate = mod_instantiate
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &method_env },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &method_env },
MODULE_BINDING_TERMINATOR
}
};
.bootstrap = mod_bootstrap
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize },
- { .section = SECTION_NAME("send", "accounting-response"), .method = mod_accounting }, /* Backwards compatibility */
- { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
+ { .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_accounting },
+ { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize },
+ { .section = SECTION_NAME("send", "accounting-response"), .method = mod_accounting }, /* Backwards compatibility */
MODULE_BINDING_TERMINATOR
}
};
.config = module_config,
},
.bindings = (module_method_binding_t[]){
- { .proto = &dict_radius, .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct },
- { .proto = &dict_radius, .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
- { .proto = &dict_radius, .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth },
+ { .section = SECTION_NAME("recv", "accounting-request"), .method = mod_preacct },
+ { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize },
+ { .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_post_auth },
MODULE_BINDING_TERMINATOR
}
};
.detach = mod_detach
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize,
- .method_env = &winbind_autz_method_env },
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate,
- .method_env = &winbind_auth_method_env },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate, .method_env = &winbind_auth_method_env },
+ { .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_authorize, .method_env = &winbind_autz_method_env },
MODULE_BINDING_TERMINATOR
}
};
#endif
},
.bindings = (module_method_binding_t[]){
- { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize },
- { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
+ { .section = SECTION_NAME("authenticate", CF_IDENT_ANY), .method = mod_authenticate },
+ { .section = SECTION_NAME("recv", "access-request"), .method = mod_authorize },
MODULE_BINDING_TERMINATOR
}
};