Skip to content

Commit

Permalink
Merge pull request #2564 from jpereira/v4/rlm_lua-update
Browse files Browse the repository at this point in the history
rlm_lua: Update the sample src/modules/rlm_lua/example.lua
  • Loading branch information
alandekok committed Mar 10, 2019
2 parents cd59940 + 2b0323c commit dd4248d
Showing 1 changed file with 36 additions and 19 deletions.
55 changes: 36 additions & 19 deletions src/modules/rlm_lua/example.lua
@@ -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

0 comments on commit dd4248d

Please sign in to comment.