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