blob: ef35f1bf6ebb298c4a163547eb249fa3c4b06554 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
Python module for freeradius
Copyright 2002 Miguel A Paraz <mparaz@mparaz.com>
Copyright 2002 Imperium Technology, Inc.
PURPOSE:
To allow module writers to write modules in a high-level language,
for implementation or for prototyping.
REQUIRES:
Python - tested with 2.2
BUILDING:
./configure --with-experimental-modules
USAGE:
Make your module available to the Python interpreter by either putting it
in a standard location, or 'EXPORT PYTHONPATH=$location'.
BUGS:
1. Can't compile statically (./configure --enable-shared=no) - causes
SIGSEGV on the first malloc() in main().
Design:
1. Support for all module functions.
2. One module per function allowed, for example, from experimental.conf:
python {
mod_instantiate = radiusd_test
func_instantiate = instantiate
mod_authorize = radiusd_test
func_authorize = authorize
mod_accounting = radiusd_test
func_accounting = accounting
mod_preacct = radiusd_test
func_preacct = preacct
mod_detach = radiusd_test
func_detach = detach
}
3. Different functions are wrappers around the same core.
4. func_detach is passed no parameters, returns module return value.
5. If functions returns None (plain 'return' no return), default to RLM_OK
6. Python instantation function can return -1 to signal failure and abort
startup.
Available to module:
import radiusd
radiusd.rad_log(radiusd.L_XXX, message_string)
radiusd.RLM_XXX
TODO:
1. Do we need to support other pair operations beyond set (:=) ?
2. Should we pass the value pair info as a dict and not a tuple? Faster?
2. Give access to more radiusd variables like the dictionary.
3. Give access to other C functions.
Let the Python module deal with the structures directly, instead of
letting our C code do it afterwards.
What's a good way to represent this?
|