/* * Do any per-module initialization that is separate to each * configured instance of the module. e.g. set up connections * to external databases, read configuration files, set up * dictionary entries, etc. * * If configuration information is given in the config section * that must be referenced in later calls, store a handle to it * in *instance otherwise put a null pointer there. */ static int mod_instantiate(CONF_SECTION *conf, void *instance) { rlm_expr_t *inst = instance; inst->xlat_name = cf_section_name2(conf); if (!inst->xlat_name) { inst->xlat_name = cf_section_name1(conf); } xlat_register(inst->xlat_name, expr_xlat, NULL, inst); /* * FIXME: unregister these, too */ xlat_register("rand", rand_xlat, NULL, inst); xlat_register("randstr", randstr_xlat, NULL, inst); xlat_register("urlquote", urlquote_xlat, NULL, inst); xlat_register("escape", escape_xlat, NULL, inst); xlat_register("tolower", lc_xlat, NULL, inst); xlat_register("toupper", uc_xlat, NULL, inst); xlat_register("md5", md5_xlat, NULL, inst); xlat_register("sha1", sha1_xlat, NULL, inst); #ifdef HAVE_OPENSSL_EVP_H xlat_register("sha256", sha256_xlat, NULL, inst); xlat_register("sha512", sha512_xlat, NULL, inst); #endif xlat_register("base64", base64_xlat, NULL, inst); xlat_register("base64tohex", base64_to_hex_xlat, NULL, inst); /* * Initialize various paircompare functions */ pair_builtincompare_add(instance); return 0; }
/* * Do any per-module initialization that is separate to each * configured instance of the module. e.g. set up connections * to external databases, read configuration files, set up * dictionary entries, etc. * * If configuration information is given in the config section * that must be referenced in later calls, store a handle to it * in *instance otherwise put a null pointer there. */ static int mod_instantiate(CONF_SECTION *conf, void *instance) { rlm_expr_t *inst = instance; inst->xlat_name = cf_section_name2(conf); if (!inst->xlat_name) { inst->xlat_name = cf_section_name1(conf); } xlat_register(inst->xlat_name, expr_xlat, inst); xlat_register("rand", rand_xlat, inst); xlat_register("randstr", randstr_xlat, inst); xlat_register("urlquote", urlquote_xlat, inst); xlat_register("escape", escape_xlat, inst); xlat_register("tolower", lc_xlat, inst); xlat_register("toupper", uc_xlat, inst); xlat_register("md5", md5_xlat, inst); xlat_register("tobase64", base64_xlat, inst); xlat_register("base64tohex", base64_to_hex_xlat, inst); /* * Initialize various paircompare functions */ pair_builtincompare_add(); return 0; }