From: Arran Cudbard-Bell Date: Wed, 25 Apr 2018 11:26:25 +0000 (+1200) Subject: Move Auth-Type registration to bootstrap in rlm_mschap X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e741a51edcc876e09dfeecd1022f747dae71d0b;p=thirdparty%2Ffreeradius-server.git Move Auth-Type registration to bootstrap in rlm_mschap --- diff --git a/src/modules/rlm_mschap/rlm_mschap.c b/src/modules/rlm_mschap/rlm_mschap.c index b5cbf1fafbd..1a07852c429 100644 --- a/src/modules/rlm_mschap/rlm_mschap.c +++ b/src/modules/rlm_mschap/rlm_mschap.c @@ -2071,30 +2071,6 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authenticate(void *instance, UNUSED void #undef inst } -static int mod_bootstrap(void *instance, CONF_SECTION *conf) -{ - char const *name; - rlm_mschap_t *inst = instance; - - /* - * Create the dynamic translation. - */ - name = cf_section_name2(conf); - if (!name) name = cf_section_name1(conf); - inst->name = name; - - if (fr_dict_enum_add_alias_next(attr_auth_type, inst->name) < 0) { - PERROR("Failed adding %s alias", attr_auth_type->name); - return -1; - } - inst->auth_type = fr_dict_enum_by_alias(attr_auth_type, inst->name); - rad_assert(inst->auth_type); - - xlat_register(inst, inst->name, mschap_xlat, NULL, NULL, 0, XLAT_DEFAULT_BUF_LEN, true); - - return 0; -} - /* * Create instance for our module. Allocate space for * instance structure and read configuration parameters @@ -2162,6 +2138,30 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf) return 0; } +static int mod_bootstrap(void *instance, CONF_SECTION *conf) +{ + char const *name; + rlm_mschap_t *inst = instance; + + /* + * Create the dynamic translation. + */ + name = cf_section_name2(conf); + if (!name) name = cf_section_name1(conf); + inst->name = name; + + if (fr_dict_enum_add_alias_next(attr_auth_type, inst->name) < 0) { + PERROR("Failed adding %s alias", attr_auth_type->name); + return -1; + } + inst->auth_type = fr_dict_enum_by_alias(attr_auth_type, inst->name); + rad_assert(inst->auth_type); + + xlat_register(inst, inst->name, mschap_xlat, NULL, NULL, 0, XLAT_DEFAULT_BUF_LEN, true); + + return 0; +} + /* * Tidy up instance */