Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2564 from jpereira/v4/rlm_lua-update
rlm_lua: Update the sample src/modules/rlm_lua/example.lua
- Loading branch information
Showing
1 changed file
with
36 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,59 @@ | ||
function tprint (tbl, indent) | ||
if not indent then indent = 0 end | ||
for k, v in pairs(tbl) do | ||
|
||
for k, v in tbl.pairs() do | ||
formatting = string.rep(" ", indent) .. k .. ": " | ||
if type(v) == "table" then | ||
print(formatting) | ||
tprint(v, indent+1) | ||
else | ||
print(formatting .. v) | ||
print(formatting .. '"' .. v .. '" (' .. type(v) .. ')') | ||
end | ||
end | ||
end | ||
|
||
function preacct() | ||
print("example.lua/preacct() Dummy") | ||
end | ||
|
||
function authenticate() | ||
function accounting() | ||
print("example.lua/accounting() Dummy") | ||
end | ||
|
||
function pre_proxy() | ||
print("example.lua/pre_proxy() Dummy") | ||
end | ||
|
||
function authorize() | ||
function post_proxy() | ||
print("example.lua/post_proxy() Dummy") | ||
end | ||
|
||
function post_auth() | ||
print("example.lua/post_auth() Dummy") | ||
end | ||
|
||
request['user-name'][2] = nil | ||
function recv_coa() | ||
print("example.lua/recv_coa() Dummy") | ||
end | ||
|
||
for i in request['user-name'].pairs() do | ||
print(i) | ||
end | ||
function send_coa() | ||
print("example.lua/send_coa() Dummy") | ||
end | ||
|
||
function detach() | ||
print("example.lua/detach() Dummy") | ||
end | ||
|
||
for k,v in request.pairs_list() do | ||
print(k,v) | ||
end | ||
function xlat() | ||
print("example.lua/xlat() Dummy") | ||
end | ||
|
||
function authenticate() | ||
print("example.lua/authenticate() Dummy") | ||
end | ||
|
||
--tprint(get_attribute("user-name")) | ||
--tprint(get_attribute("user-password")) | ||
--tprint(get_attribute("tunnel-type", "2")) | ||
--print(request['user-name'][0]) | ||
--print(request['user-name'].next_iter()) | ||
--print(request['user-name'].next_iter()) | ||
--tprint(request['user-name']) | ||
--tprint(request['user-name']) | ||
function authorize() | ||
print("example.lua/authorize(): <list_request>") | ||
tprint(request, 2) | ||
print("example.lua/authorize: </list_request>") | ||
end |