Translates requests between the server an a perl interpreter.
More...
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/unlang/xlat_func.h>
#include <freeradius-devel/unlang/xlat.h>
#include <freeradius-devel/radius/radius.h>
#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>
#include <dlfcn.h>
#include <semaphore.h>
Go to the source code of this file.
|
EXTERN_C void | boot_DynaLoader (pTHX_ CV *cv) |
|
| DIAG_OFF (compound-token-split-by-macro) typedef struct |
|
static unlang_action_t | do_perl (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request, PerlInterpreter *interp, char const *function_name) |
|
static int | get_hv_content (TALLOC_CTX *ctx, request_t *request, HV *my_hv, fr_pair_list_t *vps, const char *hash_name, const char *list_name) |
|
static int | mod_bootstrap (module_inst_ctx_t const *mctx) |
|
static int | mod_detach (module_detach_ctx_t const *mctx) |
|
static int | mod_instantiate (module_inst_ctx_t const *mctx) |
|
static int | mod_load (void) |
|
static int | mod_thread_detach (module_thread_inst_ctx_t const *mctx) |
|
static int | mod_thread_instantiate (module_thread_inst_ctx_t const *mctx) |
|
static void | mod_unload (void) |
|
static int | pairadd_sv (TALLOC_CTX *ctx, request_t *request, fr_pair_list_t *vps, char *key, SV *sv, const char *hash_name, const char *list_name) |
|
static void | perl_parse_config (CONF_SECTION *cs, int lvl, HV *rad_hv) |
|
static void | perl_store_vps (UNUSED TALLOC_CTX *ctx, request_t *request, fr_pair_list_t *vps, HV *rad_hv, const char *hash_name, const char *list_name) |
|
static int | perl_sv_to_vblist (TALLOC_CTX *ctx, fr_value_box_list_t *list, request_t *request, SV *sv) |
| Parse a Perl SV and create value boxes, appending to a list. More...
|
|
static int | perl_vblist_to_av (AV *av, fr_value_box_list_t *head) |
| Convert a list of value boxes to a Perl array for passing to subroutines. More...
|
|
static void | perl_vp_to_svpvn_element (request_t *request, AV *av, fr_pair_t const *vp, int *i, const char *hash_name, const char *list_name) |
|
static xlat_action_t | perl_xlat (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in) |
| Call perl code using an xlat. More...
|
|
static void | rlm_perl_clear_handles (pTHX) |
|
static void | rlm_perl_close_handles (void **handles) |
|
static void ** | rlm_perl_get_handles (pTHX) |
|
static void | rlm_perl_interp_free (PerlInterpreter *perl) |
|
static | XS (XS_radiusd_log) |
|
static | XS (XS_radiusd_xlat) |
|
static void | xs_init (pTHX) |
|
Translates requests between the server an a perl interpreter.
- Id
- 64b2292bf1634f7f9edc4fdacd1f3cd649184b36
- Copyright
- 2002,2006 The FreeRADIUS server project
-
2002 Boian Jordanov (bjord.nosp@m.anov.nosp@m.@orbi.nosp@m.tel..nosp@m.bg)
Definition in file rlm_perl.c.
◆ rlm_perl_thread_t
Definition at line 82 of file rlm_perl.c.
Data Fields |
PerlInterpreter * |
perl |
Thread specific perl interpreter. |
◆ dl_librefs
#define dl_librefs "DynaLoader::dl_librefs" |
◆ dl_modules
#define dl_modules "DynaLoader::dl_modules" |
◆ LOAD_INFO
◆ LOAD_WARN
#define LOAD_WARN |
( |
|
_fmt, |
|
|
|
... |
|
) |
| |
Value:
.first_prefix = "rlm_perl - ", \
.subsq_prefix = "rlm_perl - ", \
}, \
_fmt, ## __VA_ARGS__)
void fr_log_perror(fr_log_t const *log, fr_log_type_t type, char const *file, int line, fr_log_perror_format_t const *rules, char const *fmt,...)
Drain any outstanding messages from the fr_strerror buffers.
◆ LOG_PREFIX
◆ RLM_PERL_CONF
Value:
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition at line 91 of file rlm_perl.c.
◆ RLM_PERL_FUNC
Value:
{ \
rlm_perl_t *
inst = talloc_get_type_abort(mctx->inst->data,
rlm_perl_t); \
return
do_perl(p_result, mctx, request, \
}
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
Temporary structure to hold arguments for module calls.
rlm_rcode_t
Return codes indicating the result of the module call.
static unlang_action_t do_perl(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request, PerlInterpreter *interp, char const *function_name)
eap_aka_sim_process_conf_t * inst
Definition at line 902 of file rlm_perl.c.
◆ boot_DynaLoader()
EXTERN_C void boot_DynaLoader |
( |
pTHX_ CV * |
cv | ) |
|
◆ DIAG_OFF()
DIAG_OFF |
( |
compound-token-split-by- |
macro | ) |
|
< holds "config" items (perl RAD_PERLCONF hash).
Definition at line 37 of file rlm_perl.c.
◆ do_perl()
◆ get_hv_content()
static int get_hv_content |
( |
TALLOC_CTX * |
ctx, |
|
|
request_t * |
request, |
|
|
HV * |
my_hv, |
|
|
fr_pair_list_t * |
vps, |
|
|
const char * |
hash_name, |
|
|
const char * |
list_name |
|
) |
| |
|
static |
◆ mod_bootstrap()
◆ mod_detach()
◆ mod_instantiate()
◆ mod_load()
static int mod_load |
( |
void |
| ) |
|
|
static |
◆ mod_thread_detach()
◆ mod_thread_instantiate()
◆ mod_unload()
static void mod_unload |
( |
void |
| ) |
|
|
static |
◆ pairadd_sv()
static int pairadd_sv |
( |
TALLOC_CTX * |
ctx, |
|
|
request_t * |
request, |
|
|
fr_pair_list_t * |
vps, |
|
|
char * |
key, |
|
|
SV * |
sv, |
|
|
const char * |
hash_name, |
|
|
const char * |
list_name |
|
) |
| |
|
static |
◆ perl_parse_config()
static void perl_parse_config |
( |
CONF_SECTION * |
cs, |
|
|
int |
lvl, |
|
|
HV * |
rad_hv |
|
) |
| |
|
static |
◆ perl_store_vps()
static void perl_store_vps |
( |
UNUSED TALLOC_CTX * |
ctx, |
|
|
request_t * |
request, |
|
|
fr_pair_list_t * |
vps, |
|
|
HV * |
rad_hv, |
|
|
const char * |
hash_name, |
|
|
const char * |
list_name |
|
) |
| |
|
static |
◆ perl_sv_to_vblist()
static int perl_sv_to_vblist |
( |
TALLOC_CTX * |
ctx, |
|
|
fr_value_box_list_t * |
list, |
|
|
request_t * |
request, |
|
|
SV * |
sv |
|
) |
| |
|
static |
Parse a Perl SV and create value boxes, appending to a list.
For parsing values passed back from a Perl subroutine
When hashes are returned, first the key is added as a value box then the value
- Parameters
-
[in] | ctx | to allocate boxes in. |
[out] | list | to append value boxes to. |
[in] | request | being handled - only used for debug messages |
[in] | sv | to parse |
- Returns
- 0 on success
- -1 on failure
Definition at line 310 of file rlm_perl.c.
◆ perl_vblist_to_av()
static int perl_vblist_to_av |
( |
AV * |
av, |
|
|
fr_value_box_list_t * |
head |
|
) |
| |
|
static |
Convert a list of value boxes to a Perl array for passing to subroutines.
The Perl array object should be created before calling this to populate it.
- Parameters
-
[in,out] | av | Perl array object to append values to. |
[in] | head | of VB list. |
- Returns
- 0 on success
- -1 on failure
Definition at line 256 of file rlm_perl.c.
◆ perl_vp_to_svpvn_element()
static void perl_vp_to_svpvn_element |
( |
request_t * |
request, |
|
|
AV * |
av, |
|
|
fr_pair_t const * |
vp, |
|
|
int * |
i, |
|
|
const char * |
hash_name, |
|
|
const char * |
list_name |
|
) |
| |
|
static |
◆ rlm_perl_clear_handles()
static void rlm_perl_clear_handles |
( |
pTHX |
| ) |
|
|
static |
◆ rlm_perl_close_handles()
static void rlm_perl_close_handles |
( |
void ** |
handles | ) |
|
|
static |
◆ rlm_perl_get_handles()
static void** rlm_perl_get_handles |
( |
pTHX |
| ) |
|
|
static |
◆ rlm_perl_interp_free()
static void rlm_perl_interp_free |
( |
PerlInterpreter * |
perl | ) |
|
|
static |
◆ XS() [1/2]
static XS |
( |
XS_radiusd_log |
| ) |
|
|
static |
◆ XS() [2/2]
static XS |
( |
XS_radiusd_xlat |
| ) |
|
|
static |
◆ xs_init()
static void xs_init |
( |
pTHX |
| ) |
|
|
static |
◆ module_config
Initial value:= {
}
#define CONF_PARSER_TERMINATOR
#define FR_CONF_OFFSET_FLAGS(_name, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
@ CONF_FLAG_FILE_INPUT
File matching value must exist, and must be readable.
#define RLM_PERL_CONF(_x)
Definition at line 94 of file rlm_perl.c.
◆ perl_dlhandle
To allow us to load perl's symbols into the global symbol table.
Definition at line 86 of file rlm_perl.c.
◆ perl_xlat_args
Initial value:= {
}
@ FR_TYPE_STRING
String of printable characters.
@ XLAT_ARG_VARIADIC_EMPTY_KEEP
Empty argument groups are left alone, and either passed through as empty groups or null boxes.
#define XLAT_ARG_PARSER_TERMINATOR
Definition at line 417 of file rlm_perl.c.
◆ rlm_perl
Initial value:= {
.common = {
.name = "perl",
},
{ .name1 =
"recv", .name2 =
"accounting-request", .method =
mod_preacct },
}
}
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Specifies a module method identifier.
static const conf_parser_t config[]
static unlang_action_t mod_authenticate(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
static unlang_action_t mod_authorize(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
static unlang_action_t mod_accounting(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Write accounting data to Couchbase documents.
static unlang_action_t mod_post_auth(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
static int mod_detach(module_detach_ctx_t const *mctx)
static int mod_load(void)
static int mod_bootstrap(module_inst_ctx_t const *mctx)
static void mod_unload(void)
static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx)
static const conf_parser_t module_config[]
static int mod_thread_detach(module_thread_inst_ctx_t const *mctx)
static int mod_instantiate(module_inst_ctx_t const *mctx)
static int instantiate(module_inst_ctx_t const *mctx)
static unlang_action_t mod_preacct(rlm_rcode_t *p_result, module_ctx_t const *mctx, UNUSED request_t *request)
@ MODULE_TYPE_THREAD_SAFE
Module is threadsafe.
#define MODULE_NAME_TERMINATOR
Definition at line 1169 of file rlm_perl.c.
◆ rlm_perl_request
◆ rlm_perl_t