-pmod2
+# This module is cext_compat and should work
+pmod4_cextcompat
if (!ok) {
test_fail
} else {
+# Call the second configured module firstly should work
pmod2
if (!ok) {
test_fail
test_pass
}
+# Call the first configured module secondly
pmod1
if (!noop) {
test_fail
+# The first call on pmod1 should store var "tls" in a thread local storage and return noop
pmod1
if (!noop) {
test_fail
test_pass
}
+# Simply call another second module
pmod2
if (!ok) {
test_fail
test_pass
}
+# The second call on pmod1 should return OK because "tls" is set
pmod1
if (!ok) {
test_fail
test_pass
}
+# Calling another python module configured with mod1.py should be in it's own context and return NOOP on first call
pmod3_withmod1
if (!noop) {
test_fail
test_pass
}
-pmod3_withmod1
-if (!ok) {
- test_fail
-} else {
- test_pass
-}
-
-pmod3_withmod1
-if (!ok) {
- test_fail
-} else {
- test_pass
-}
-
+# Should return "OK" on subsequent calls
pmod3_withmod1
if (!ok) {
test_fail
+import radiusd
import threading
local = threading.local()
def authorize(p):
global local
if hasattr(local, 'tls'):
- return 2
+ return radiusd.RLM_MODULE_OK
else:
local.tls = True
- return 7
\ No newline at end of file
+ return radiusd.RLM_MODULE_NOOP
\ No newline at end of file
+import radiusd
+
def authorize(p):
- return 2
\ No newline at end of file
+ return radiusd.RLM_MODULE_OK
\ No newline at end of file