*
* This function walks down the registration table, compiling each
* named section.
+ *
+ * @parma[in] server to search for sections in.
+ * @param[in] list of sections to compiler.
+ * @param[in] rules to apply for pass1.
+ * @param[in] instance module instance data. The offset value in
+ * the rules array will be added to this to
+ * determine where to write pointers to the
+ * various CONF_SECTIONs.
*/
-int virtual_server_compile_sections(CONF_SECTION *server, virtual_server_compile_t const *list, tmpl_rules_t const *rules, void *uctx)
+int virtual_server_compile_sections(CONF_SECTION *server, virtual_server_compile_t const *list, tmpl_rules_t const *rules, void *instance)
{
int i, found;
CONF_SECTION *subcs = NULL;
/*
* Initialise CONF_SECTION pointer for missing section
*/
- if ((uctx) && (list[i].offset > 0)) {
- *(CONF_SECTION **) (((uint8_t *) uctx) + list[i].offset) = NULL;
+ if ((instance) && !list[i].dont_cache) {
+ *(CONF_SECTION **) (((uint8_t *) instance) + list[i].offset) = NULL;
}
continue;
}
/*
* Cache the CONF_SECTION which was found.
*/
- if (uctx) {
- if (list[i].offset > 0) {
- *(CONF_SECTION **) (((uint8_t *) uctx) + list[i].offset) = subcs;
+ if (instance) {
+ if (!list[i].dont_cache) {
+ *(CONF_SECTION **) (((uint8_t *) instance) + list[i].offset) = subcs;
}
if (list[i].instruction > 0) {
- *(void **) (((uint8_t *) uctx) + list[i].instruction) = instruction;
+ *(void **) (((uint8_t *) instance) + list[i].instruction) = instruction;
}
}
char const *name2; //!< Second name, such as "Access-Request"
rlm_components_t component; //!< Sets the default list of actions for this section
size_t offset; //!< where the CONF_SECTION pointer is written
+ bool dont_cache; //!< If true, the CONF_SECTION pointer won't be written
+ ///< and the offset will be ignored.
size_t instruction; //!< where the instruction pointer is written
virtual_server_method_t const *methods; //!< list of module methods which are allowed in this section
} virtual_server_compile_t;
int virtual_server_section_register(virtual_server_compile_t const *entry) CC_HINT(nonnull);
int virtual_server_compile_sections(CONF_SECTION *server, virtual_server_compile_t const *list,
- tmpl_rules_t const *rules, void *uctx) CC_HINT(nonnull(1,2,3));
+ tmpl_rules_t const *rules, void *instance) CC_HINT(nonnull(1,2,3));
virtual_server_method_t const *virtual_server_section_methods(char const *name1, char const *name2) CC_HINT(nonnull(1));