From: Alan T. DeKok Date: Wed, 22 Feb 2023 18:58:06 +0000 (-0500) Subject: we don't need RADIUS-specific things in Perl X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76033a205468c27027df437c886da1e49ae129c1;p=thirdparty%2Ffreeradius-server.git we don't need RADIUS-specific things in Perl --- diff --git a/raddb/mods-available/perl b/raddb/mods-available/perl index 9efba7500b1..3bb1a425dc0 100644 --- a/raddb/mods-available/perl +++ b/raddb/mods-available/perl @@ -90,17 +90,6 @@ perl { # func_post_auth = post_auth # func_detach = detach - # - # func_start_accounting:: - # func_stop_accounting:: - # - # Uncomment the following lines if you wish to use separate functions - # for `Start` and `Stop` accounting packets. - # In that case, the `func_accounting` function is not called. - # -# func_start_accounting = accounting_start -# func_stop_accounting = accounting_stop - # # config { ... }:: # diff --git a/src/modules/rlm_perl/rlm_perl.c b/src/modules/rlm_perl/rlm_perl.c index 9ecd71e5e6c..01232009333 100644 --- a/src/modules/rlm_perl/rlm_perl.c +++ b/src/modules/rlm_perl/rlm_perl.c @@ -67,8 +67,6 @@ typedef struct { char const *func_authorize; char const *func_authenticate; char const *func_accounting; - char const *func_start_accounting; - char const *func_stop_accounting; char const *func_preacct; char const *func_detach; char const *func_post_auth; @@ -103,34 +101,9 @@ static const CONF_PARSER module_config[] = { { FR_CONF_OFFSET("perl_flags", FR_TYPE_STRING, rlm_perl_t, perl_flags) }, - { FR_CONF_OFFSET("func_start_accounting", FR_TYPE_STRING, rlm_perl_t, func_start_accounting) }, - - { FR_CONF_OFFSET("func_stop_accounting", FR_TYPE_STRING, rlm_perl_t, func_stop_accounting) }, CONF_PARSER_TERMINATOR }; -static fr_dict_t const *dict_radius; - -extern fr_dict_autoload_t rlm_perl_dict[]; -fr_dict_autoload_t rlm_perl_dict[] = { - { .out = &dict_radius, .proto = "radius" }, - { NULL } -}; - -static fr_dict_attr_t const *attr_acct_status_type; -static fr_dict_attr_t const *attr_chap_password; -static fr_dict_attr_t const *attr_user_name; -static fr_dict_attr_t const *attr_user_password; - -extern fr_dict_attr_autoload_t rlm_perl_dict_attr[]; -fr_dict_attr_autoload_t rlm_perl_dict_attr[] = { - { .out = &attr_acct_status_type, .name = "Acct-Status-Type", .type = FR_TYPE_UINT32, .dict = &dict_radius }, - { .out = &attr_chap_password, .name = "CHAP-Password", .type = FR_TYPE_OCTETS, .dict = &dict_radius }, - { .out = &attr_user_name, .name = "User-Name", .type = FR_TYPE_STRING, .dict = &dict_radius }, - { .out = &attr_user_password, .name = "User-Password", .type = FR_TYPE_STRING, .dict = &dict_radius }, - { NULL } -}; - /* * man perlembed */ @@ -935,50 +908,7 @@ RLM_PERL_FUNC(authorize) RLM_PERL_FUNC(authenticate) RLM_PERL_FUNC(post_auth) RLM_PERL_FUNC(preacct) - -/* - * Write accounting information to this modules database. - */ -static unlang_action_t CC_HINT(nonnull) mod_accounting(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) -{ - rlm_perl_t *inst = talloc_get_type_abort(mctx->inst->data, rlm_perl_t); - fr_pair_t *pair; - int acct_status_type = 0; - char const *func; - - pair = fr_pair_find_by_da(&request->request_pairs, NULL, attr_acct_status_type); - if (pair != NULL) { - acct_status_type = pair->vp_uint32; - } else { - REDEBUG("Invalid Accounting Packet"); - RETURN_MODULE_INVALID; - } - - switch (acct_status_type) { - case FR_STATUS_START: - if (inst->func_start_accounting) { - func = inst->func_start_accounting; - } else { - func = inst->func_accounting; - } - break; - - case FR_STATUS_STOP: - if (inst->func_stop_accounting) { - func = inst->func_stop_accounting; - } else { - func = inst->func_accounting; - } - break; - - default: - func = inst->func_accounting; - break; - } - - return do_perl(p_result, mctx, request, - ((rlm_perl_thread_t *)talloc_get_type_abort(mctx->thread, rlm_perl_thread_t))->perl, func); -} +RLM_PERL_FUNC(accounting) DIAG_OFF(DIAG_UNKNOWN_PRAGMAS) DIAG_OFF(shadow)