]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
we don't need RADIUS-specific things in Perl
authorAlan T. DeKok <aland@freeradius.org>
Wed, 22 Feb 2023 18:58:06 +0000 (13:58 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 22 Feb 2023 19:40:57 +0000 (14:40 -0500)
raddb/mods-available/perl
src/modules/rlm_perl/rlm_perl.c

index 9efba7500b15459ea9dfeb73afb1c95a19937201..3bb1a425dc0eea2688e06d74b3751fce3effd219 100644 (file)
@@ -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 { ... }::
        #
index 9ecd71e5e6c713e58c909c5ecc418edc95ec0647..01232009333a9926a7f2e24b434bc8a063ead5f0 100644 (file)
@@ -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)