* creates the listener, and adds it to the scheduler.
*/
typedef struct {
- module_instance_t const *mi; //!< our parent mi
+ module_instance_t *mi; //!< our parent mi
module_list_t *clients; //!< Holds client modules created to represent
///< sockets created as clients connect to the
///< listener.
return 0;
}
+/** Set the uctx pointer for a module instance
+ *
+ * @param[in] mi to set the uctx for.
+ * @param[in] uctx to set.
+ */
+void module_instance_uctx_set(module_instance_t *mi, void *uctx)
+{
+ mi->uctx = uctx;
+}
/** Allocate a new module and add it to a module list for later bootstrap/instantiation
*
char const *name; //!< Instance name e.g. user_database.
module_instance_t const *parent; //!< Parent module's instance (if any).
+
+ void *uctx; //!< Extra data passed to module_instance_alloc.
/** @} */
};
module_instance_state_t init_state)
CC_HINT(nonnull(1)) CC_HINT(warn_unused_result);
+void module_instance_uctx_set(module_instance_t *mi, void *uctx);
+
/** @name Module list variants
*
* These are passed to the module_list_alloc function to allocate lists of different types
*
* @{
*/
-extern module_list_type_t const module_list_type_global; //!< Initialise a global module, with thread-specific data.
+extern module_list_type_t const module_list_type_global; //!< Initialise a global module, with thread-specific data.
extern module_list_type_t const module_list_type_thread_local; //!< Initialise a thread-local module, which is only used in a single thread.
/** @} */
/** Temporary structure to hold arguments for instantiation calls
*/
typedef struct {
- module_instance_t const *mi; //!< Instance of the module being instantiated.
+ module_instance_t *mi; //!< Instance of the module being instantiated.
} module_inst_ctx_t;
/** Temporary structure to hold arguments for detach calls
*/
typedef struct {
- module_instance_t const *mi; //!< Module instance to detach.
+ module_instance_t *mi; //!< Module instance to detach.
} module_detach_ctx_t;
/** Temporary structure to hold arguments for thread_instantiation calls
return 0;
}
+/** Allocate a rlm module instance
+ *
+ * These have extra space allocated to hold the dlist of associated xlats.
+ *
+ * @param[in] ml Module list to allocate from.
+ * @param[in] parent Parent module instance.
+ * @param[in] type Type of module instance.
+ * @param[in] mod_name Name of the module.
+ * @param[in] inst_name Name of the instance.
+ * @param[in] init_state Initial state of the module instance.
+ * @return
+ * - The allocated module instance on success.
+ * - NULL on failure.
+ */
+static inline CC_HINT(always_inline)
+module_instance_t *module_rlm_instance_alloc(module_list_t *ml,
+ module_instance_t const *parent,
+ dl_module_type_t type, char const *mod_name, char const *inst_name,
+ module_instance_state_t init_state)
+{
+ module_instance_t *mi;
+ module_rlm_instance_t *mri;
+
+ mi = module_instance_alloc(ml, parent, type, mod_name, inst_name, init_state);
+ if (unlikely(mi == NULL)) return NULL;
+
+ MEM(mri = talloc(mi, module_rlm_instance_t));
+ module_instance_uctx_set(mi, mri);
+ fr_rb_inline_init(&mri->xlats, module_rlm_xlat_t, node, xlat_func_cmp, NULL);
+
+ return mi;
+}
+
static int module_conf_parse(module_list_t *ml, CONF_SECTION *mod_conf)
{
char const *name;
if (module_instance_name_from_conf(&inst_name, mod_conf) < 0) goto invalid_name;
- mi = module_instance_alloc(ml, NULL, DL_MODULE_TYPE_MODULE, name, inst_name, 0);
+ mi = module_rlm_instance_alloc(ml, NULL, DL_MODULE_TYPE_MODULE, name, inst_name, 0);
if (unlikely(mi == NULL)) {
cf_log_perr(mod_conf, "Failed loading module");
return -1;
extern "C" {
#endif
+typedef struct module_rlm_s module_rlm_t;
+typedef struct module_rlm_instance_s module_rlm_instance_t;
+
#include <freeradius-devel/server/module.h>
#include <freeradius-devel/server/virtual_servers.h>
-typedef struct {
+struct module_rlm_s {
module_t common; //!< Common fields presented by all modules.
module_method_binding_t *bindings; //!< named methods
-} module_rlm_t;
+};
+
+struct module_rlm_instance_s {
+ fr_rb_tree_t xlats; //!< xlats registered to this module instance.
+ ///< This is used by the redundant/loadbalance
+ ///< xlats to register versions of the xlats
+ ///< exported by the module instances.
+};
+
+/** An xlat function registered to a module
+ */
+typedef struct {
+ xlat_t const *xlat; //!< The xlat function.
+ fr_rb_node_t node; //!< Entry in an rbtree of registered xlats.
+} module_rlm_xlat_t;
+
+/** The output of module_rlm_by_name_and_method
+ *
+ * Everything needed to call a module method.
+ */
+typedef struct {
+ module_instance_t *mi; //!< The process modules also push module calls
+ ///< onto the stack for execution. So we need
+ ///< to use the common type here.
+ module_rlm_t const *rlm; //!< Cached module_rlm_t.
+ module_method_binding_t mmb; //!< Method we're calling.
+ tmpl_t *key; //!< Dynamic key, only set for dynamic modules.
+} module_method_call_t;
/** Cast a module_t to a module_rlm_t
*
*
* @{
*/
+xlat_t *module_rlm_xlat_register(TALLOC_CTX *ctx, module_inst_ctx_t const *mctx,
+ char const *name, xlat_func_t func, fr_type_t return_type)
+ CC_HINT(nonnull(2,4));
+
fr_pool_t *module_rlm_connection_pool_init(CONF_SECTION *module,
void *opaque,
fr_pool_connection_create_t c,
char const **name1, char const **name2,
virtual_server_t const *vs, char const *asked_name);
-module_instance_t *module_rlm_static_by_name(module_instance_t const *parent, char const *asked_name);
+module_instance_t *module_rlm_dynamic_by_name(module_instance_t const *parent, char const *name);
CONF_SECTION *module_rlm_by_name_virtual(char const *asked_name);
+module_instance_t *module_rlm_static_by_name(module_instance_t const *parent, char const *name);
+CONF_SECTION *module_rlm_virtual_by_name(char const *name);
/** @} */
/** @name Support functions
*/
typedef struct {
unlang_t self; //!< Common fields in all #unlang_t tree nodes.
- module_instance_t *mi; //!< Global instance of the module we're calling.
- module_method_t method; //!< The entry point into the module.
call_env_t const *call_env; //!< The per call parsed call environment.
+ module_method_call_t mmc; //!< Everything needed to call a module method.
} unlang_module_t;
/** A module stack entry
static fr_rb_tree_t *xlat_root = NULL;
-/*
- * Compare two xlat_t structs, based ONLY on the module name.
+/** Compare two xlat_t by the registered name
+ *
+ * @param[in] one First xlat_t to compare.
+ * @param[in] two Second xlat_t to compare.
+ * @return
+ * - -1 if one < two
+ * - 0 if one == two
+ * - 1 if one > two
*/
-static int8_t xlat_cmp(void const *one, void const *two)
+static int8_t xlat_name_cmp(void const *one, void const *two)
{
xlat_t const *a = one, *b = two;
size_t a_len, b_len;
return CMP(ret, 0);
}
+/** Compare two xlat_t by the underlying function
+ *
+ * @param[in] one First xlat_t to compare.
+ * @param[in] two Second xlat_t to compare.
+ * @return
+ * - -1 if one < two
+ * - 0 if one == two
+ * - 1 if one > two
+ */
+int8_t xlat_func_cmp(void const *one, void const *two)
+{
+ xlat_t const *a = one, *b = two;
+
+ return CMP((uintptr_t)a->func, (uintptr_t)b->func);
+}
+
/*
* find the appropriate registered xlat function.
*/
return c;
}
-/** Register an xlat function for a module
+/** Associate a module calling ctx with the xlat
*
- * @param[in] ctx Used to automate deregistration of the xlat function.
- * @param[in] mctx Instantiation context from the module.
- * Will be duplicated and passed to future xlat calls.
- * @param[in] name of the xlat. Must be NULL, for "self-named" xlats.
- * e.g. `cache`, `sql`, `delay`, etc.
- * @param[in] func to register.
- * @param[in] return_type what type of output the xlat function will produce.
- * @return
- * - A handle for the newly registered xlat function on success.
- * - NULL on failure.
+ * @note Intended to be called from the module_rlm
+ *
+ * @param[in] x to set the mctx for.
+ * @param[in] mctx Is duplicated and about to the lifetime of the xlat.
*/
-xlat_t *xlat_func_register_module(TALLOC_CTX *ctx, module_inst_ctx_t const *mctx,
- char const *name, xlat_func_t func, fr_type_t return_type)
+void xlat_mctx_set(xlat_t *x, module_inst_ctx_t const *mctx)
{
module_inst_ctx_t *our_mctx = NULL;
- xlat_t *c;
- char inst_name[256];
- fr_assert_msg(name != mctx->mi->name, "`name` must not be the same as the module "
- "instance name. Pass a NULL `name` arg if this is required");
-
- if (!name) {
- name = mctx->mi->name;
- } else {
- if ((size_t)snprintf(inst_name, sizeof(inst_name), "%s.%s", mctx->mi->name, name) >= sizeof(inst_name)) {
- ERROR("%s: Instance name too long", __FUNCTION__);
- return NULL;
- }
- name = inst_name;
- }
-
- c = xlat_func_register(ctx, name, func, return_type);
- if (!c) return NULL;
-
- MEM(our_mctx = talloc_zero(c, module_inst_ctx_t)); /* Original won't stick around */
+ TALLOC_FREE(x->mctx);
+ MEM(our_mctx = talloc_zero(x, module_inst_ctx_t)); /* Original won't stick around */
memcpy(our_mctx, mctx, sizeof(*our_mctx));
- c->mctx = our_mctx;
-
- return c;
+ x->mctx = our_mctx;
}
/** Verify xlat arg specifications are valid
/*
* Create the function tree
*/
- xlat_root = fr_rb_inline_talloc_alloc(NULL, xlat_t, node, xlat_cmp, _xlat_func_tree_free);
+ xlat_root = fr_rb_inline_talloc_alloc(NULL, xlat_t, func_node, xlat_name_cmp, _xlat_func_tree_free);
if (!xlat_root) {
ERROR("%s: Failed to create tree", __FUNCTION__);
return -1;
*/
typedef int (*xlat_purify_t)(xlat_exp_t *xlat, void *inst, request_t *request);
+int8_t xlat_func_cmp(void const *one, void const *two);
+
xlat_t *xlat_func_find_module(module_inst_ctx_t const *mctx, char const *name);
-xlat_t *xlat_func_register_module(TALLOC_CTX *ctx, module_inst_ctx_t const *mctx,
- char const *name, xlat_func_t func, fr_type_t return_type) CC_HINT(nonnull(2,4));
xlat_t *xlat_func_register(TALLOC_CTX *ctx, char const *name, xlat_func_t func, fr_type_t return_type) CC_HINT(nonnull(2));
+void xlat_mctx_set(xlat_t *x, module_inst_ctx_t const *mctx);
+
int xlat_func_args_set(xlat_t *xlat, xlat_arg_parser_t const args[]) CC_HINT(nonnull);
void xlat_func_call_env_set(xlat_t *x, call_env_method_t const *env) CC_HINT(nonnull);
#include <freeradius-devel/unlang/xlat_ctx.h>
#include <freeradius-devel/unlang/xlat.h>
#include <freeradius-devel/unlang/xlat_func.h>
+#include <freeradius-devel/server/module_ctx.h>
#include <freeradius-devel/io/pair.h>
#include <freeradius-devel/util/talloc.h>
#include <freeradius-devel/build.h>
#endif
typedef struct xlat_s {
- fr_rb_node_t node; //!< Entry in the xlat function tree.
+ fr_rb_node_t func_node; //!< Entry in the xlat function tree.
+ fr_dlist_t mi_entry; //!< Entry in the list of functions
+ ///< registered to a module instance.
+
char const *name; //!< Name of xlat function.
xlat_func_t func; //!< async xlat function (async unsafe).
bool internal; //!< If true, cannot be redefined.
fr_token_t token; //!< for expressions
- module_inst_ctx_t const *mctx; //!< Original module instantiation ctx if this
+ module_inst_ctx_t *mctx; //!< Original module instantiation ctx if this
///< xlat was registered by a module.
xlat_instantiate_t instantiate; //!< Instantiation function.
{
xlat_t *xlat;
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, NULL, always_xlat, FR_TYPE_STRING);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, NULL, always_xlat, FR_TYPE_STRING);
xlat_func_args_set(xlat, always_xlat_args);
return 0;
{
xlat_t *xlat;
- if (unlikely((xlat = xlat_func_register_module(mctx->mi->boot, mctx, "compress", brotli_xlat_compress,
+ if (unlikely((xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "compress", brotli_xlat_compress,
FR_TYPE_OCTETS)) == NULL)) return -1;
xlat_func_args_set(xlat, brotli_xlat_compress_args);
- if (unlikely((xlat = xlat_func_register_module(mctx->mi->boot, mctx, "decompress", brotli_xlat_decompress,
+ if (unlikely((xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "decompress", brotli_xlat_decompress,
FR_TYPE_OCTETS)) == NULL)) return -1;
xlat_func_args_set(xlat, brotli_xlat_decompress_args);
/*
* Register the cache xlat function
*/
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, NULL, cache_xlat, FR_TYPE_VOID);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, NULL, cache_xlat, FR_TYPE_VOID);
xlat_func_args_set(xlat, cache_xlat_args);
xlat_func_call_env_set(xlat, &cache_method_env);
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, "ttl.get", cache_ttl_get_xlat, FR_TYPE_VOID);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "ttl.get", cache_ttl_get_xlat, FR_TYPE_VOID);
xlat_func_call_env_set(xlat, &cache_method_env);
return 0;
{
xlat_t *xlat;
- if (unlikely((xlat = xlat_func_register_module(mctx->mi->boot, mctx, "password", xlat_func_chap_password,
+ if (unlikely((xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "password", xlat_func_chap_password,
FR_TYPE_OCTETS)) == NULL)) return -1;
xlat_func_args_set(xlat, xlat_func_chap_password_args);
xlat_func_call_env_set(xlat, &chap_xlat_method_env);
/*
* Register decrypt xlat
*/
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, "decrypt", cipher_rsa_decrypt_xlat, FR_TYPE_STRING);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "decrypt", cipher_rsa_decrypt_xlat, FR_TYPE_STRING);
xlat_func_args_set(xlat, cipher_rsa_decrypt_xlat_arg);
/*
* Verify sign xlat
*/
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, "verify", cipher_rsa_verify_xlat, FR_TYPE_BOOL);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "verify", cipher_rsa_verify_xlat, FR_TYPE_BOOL);
xlat_func_args_set(xlat, cipher_rsa_verify_xlat_arg);
}
/*
* Register encrypt xlat
*/
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, "encrypt", cipher_rsa_encrypt_xlat, FR_TYPE_OCTETS);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "encrypt", cipher_rsa_encrypt_xlat, FR_TYPE_OCTETS);
xlat_func_args_set(xlat, cipher_rsa_encrypt_xlat_arg);
/*
* Register sign xlat
*/
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, "sign", cipher_rsa_sign_xlat, FR_TYPE_OCTETS);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "sign", cipher_rsa_sign_xlat, FR_TYPE_OCTETS);
xlat_func_args_set(xlat, cipher_rsa_sign_xlat_arg);
/*
* FIXME: These should probably be split into separate xlats
* so we can optimise for return types.
*/
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, "certificate", cipher_certificate_xlat, FR_TYPE_VOID);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "certificate", cipher_certificate_xlat, FR_TYPE_VOID);
xlat_func_args_set(xlat, cipher_certificate_xlat_args);
}
break;
{
xlat_t *xlat;
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, NULL, xlat_date_convert, FR_TYPE_VOID);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, NULL, xlat_date_convert, FR_TYPE_VOID);
xlat_func_args_set(xlat, xlat_date_convert_args);
return 0;
{
xlat_t *xlat;
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, NULL, xlat_delay, FR_TYPE_TIME_DELTA);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, NULL, xlat_delay, FR_TYPE_TIME_DELTA);
xlat_func_args_set(xlat, xlat_delay_args);
return 0;
}
{
xlat_t *xlat;
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, "escape", escape_xlat, FR_TYPE_STRING);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "escape", escape_xlat, FR_TYPE_STRING);
xlat_func_args_set(xlat, escape_xlat_arg);
xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_PURE);
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, "unescape", unescape_xlat, FR_TYPE_STRING);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "unescape", unescape_xlat, FR_TYPE_STRING);
xlat_func_args_set(xlat, unescape_xlat_arg);
xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_PURE);
{
xlat_t *xlat;
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, NULL, exec_xlat_oneshot, FR_TYPE_STRING);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, NULL, exec_xlat_oneshot, FR_TYPE_STRING);
xlat_func_args_set(xlat, exec_xlat_args);
return 0;
{
xlat_t *xlat;
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, NULL, xlat_icmp, FR_TYPE_BOOL);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, NULL, xlat_icmp, FR_TYPE_BOOL);
xlat_func_args_set(xlat, xlat_icmp_args);
return 0;
{
xlat_t *xlat;
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, NULL, xlat_idna, FR_TYPE_STRING);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, NULL, xlat_idna, FR_TYPE_STRING);
xlat_func_args_set(xlat, xlat_idna_arg);
xlat_func_flags_set(xlat, XLAT_FUNC_FLAG_PURE);
rlm_json_t const *inst = talloc_get_type_abort(mctx->mi->data, rlm_json_t);
xlat_t *xlat;
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, "encode", json_encode_xlat, FR_TYPE_STRING);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "encode", json_encode_xlat, FR_TYPE_STRING);
xlat_func_args_set(xlat, json_encode_xlat_arg);
if (map_proc_register(mctx->mi->boot, inst, "json", mod_map_proc,
boot->cache_da = boot->group_da; /* Default to the group_da */
}
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, NULL, ldap_xlat, FR_TYPE_STRING);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, NULL, ldap_xlat, FR_TYPE_STRING);
xlat_func_args_set(xlat, ldap_xlat_arg);
- if (unlikely(!(xlat = xlat_func_register_module(mctx->mi->boot, mctx, "memberof", ldap_memberof_xlat,
+ if (unlikely(!(xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "memberof", ldap_memberof_xlat,
FR_TYPE_BOOL)))) return -1;
xlat_func_args_set(xlat, ldap_memberof_xlat_arg);
xlat_func_call_env_set(xlat, &xlat_memberof_method_env);
- if (unlikely(!(xlat = xlat_func_register_module(mctx->mi->boot, mctx, "profile", ldap_profile_xlat,
+ if (unlikely(!(xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "profile", ldap_profile_xlat,
FR_TYPE_BOOL)))) return -1;
xlat_func_args_set(xlat, ldap_xlat_arg);
xlat_func_call_env_set(xlat, &xlat_profile_method_env);
XLAT_ARG_PARSER_TERMINATOR
};
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, NULL, linelog_xlat, FR_TYPE_SIZE);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, NULL, linelog_xlat, FR_TYPE_SIZE);
xlat_func_args_set(xlat, linelog_xlat_args);
xlat_func_call_env_set(xlat, &linelog_xlat_method_env );
{
xlat_t *xlat;
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, NULL, mschap_xlat, FR_TYPE_VOID);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, NULL, mschap_xlat, FR_TYPE_VOID);
xlat_func_args_set(xlat, mschap_xlat_args);
xlat_func_call_env_set(xlat, &mschap_xlat_method_env);
{
xlat_t *xlat;
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, NULL, perl_xlat, FR_TYPE_VOID);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, NULL, perl_xlat, FR_TYPE_VOID);
xlat_func_args_set(xlat, perl_xlat_args);
return 0;
rlm_redis_t const *inst = talloc_get_type_abort(mctx->mi->data, rlm_redis_t);
xlat_t *xlat;
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, NULL, redis_xlat, FR_TYPE_VOID);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, NULL, redis_xlat, FR_TYPE_VOID);
xlat_func_args_set(xlat, redis_args);
/*
* %redis.node(<key>[, idx])
*/
- if (unlikely((xlat = xlat_func_register_module(mctx->mi->boot, mctx, "node", redis_node_xlat, FR_TYPE_STRING)) == NULL)) return -1;
+ if (unlikely((xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "node", redis_node_xlat, FR_TYPE_STRING)) == NULL)) return -1;
xlat_func_args_set(xlat, redis_node_xlat_args);
- if (unlikely((xlat = xlat_func_register_module(mctx->mi->boot, mctx, "remap", redis_remap_xlat, FR_TYPE_STRING)) == NULL)) return -1;
+ if (unlikely((xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "remap", redis_remap_xlat, FR_TYPE_STRING)) == NULL)) return -1;
xlat_func_args_set(xlat, redis_remap_xlat_args);
/*
* that'll call that function specifically.
*/
talloc_foreach(inst->lua.funcs, func) {
- if (unlikely((xlat = xlat_func_register_module(mctx->mi->boot, mctx, func->name, redis_lua_func_xlat, FR_TYPE_VOID)) == NULL)) return -1;
+ if (unlikely((xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, func->name, redis_lua_func_xlat, FR_TYPE_VOID)) == NULL)) return -1;
xlat_func_args_set(xlat, redis_lua_func_args);
xlat_func_instantiate_set(xlat, redis_lua_func_instantiate, redis_lua_func_inst_t, NULL, func);
}
{
xlat_t *xlat;
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, NULL, rest_xlat, FR_TYPE_STRING);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, NULL, rest_xlat, FR_TYPE_STRING);
xlat_func_args_set(xlat, rest_xlat_args);
xlat_func_call_env_set(xlat, &rest_call_env_xlat);
* register function automatically adds the
* module instance name as a prefix.
*/
- xlat = xlat_func_register_module(boot, mctx, "group", sql_group_xlat, FR_TYPE_BOOL);
+ xlat = module_rlm_xlat_register(boot, mctx, "group", sql_group_xlat, FR_TYPE_BOOL);
if (!xlat) {
cf_log_perr(conf, "Failed registering %s expansion", group_attribute);
return -1;
/*
* Register the SQL xlat function
*/
- xlat = xlat_func_register_module(boot, mctx, NULL, sql_xlat, FR_TYPE_VOID); /* Returns an integer sometimes */
+ xlat = module_rlm_xlat_register(boot, mctx, NULL, sql_xlat, FR_TYPE_VOID); /* Returns an integer sometimes */
if (!xlat) {
cf_log_perr(conf, "Failed registering %s expansion", mctx->mi->name);
return -1;
INFO("inst->tmpl_m is NULL");
}
- if (!(xlat = xlat_func_register_module(mctx->mi->boot, mctx, "passthrough", test_xlat_passthrough, FR_TYPE_VOID))) return -1;
+ if (!(xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "passthrough", test_xlat_passthrough, FR_TYPE_VOID))) return -1;
xlat_func_args_set(xlat, test_xlat_passthrough_args);
- if (!(xlat = xlat_func_register_module(mctx->mi->boot, mctx, "fail", test_xlat_fail, FR_TYPE_VOID))) return -1;
+ if (!(xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "fail", test_xlat_fail, FR_TYPE_VOID))) return -1;
xlat_func_args_set(xlat, test_xlat_fail_args);
return 0;
return -1;
}
- if(!(xlat = xlat_func_register_module(mctx->mi->boot, mctx, NULL, xlat_unbound, FR_TYPE_VOID))) return -1;
+ if(!(xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, NULL, xlat_unbound, FR_TYPE_VOID))) return -1;
xlat_func_args_set(xlat, xlat_unbound_args);
return 0;
* function automatically adds the module instance name
* as a prefix.
*/
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, "group", unix_group_xlat, FR_TYPE_BOOL);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "group", unix_group_xlat, FR_TYPE_BOOL);
if (!xlat) {
PERROR("Failed registering group expansion");
return -1;
* function automatically adds the module instance name
* as a prefix.
*/
- xlat = xlat_func_register_module(mctx->mi->boot, mctx, "group", winbind_group_xlat, FR_TYPE_BOOL);
+ xlat = module_rlm_xlat_register(mctx->mi->boot, mctx, "group", winbind_group_xlat, FR_TYPE_BOOL);
if (!xlat) {
cf_log_err(conf, "Failed registering group expansion");
return -1;