Comparison

plugins/mod_saslauth.lua @ 1639:0914d128c55e

mod_saslauth: Fix coding style and layout, and use of arg[] for vararg
author Matthew Wild <mwild1@gmail.com>
date Wed, 05 Aug 2009 16:37:28 +0100
parent 1638:6fd0c2f46b21
child 1725:fb3137652ea6
child 2179:c985536d5452
comparison
equal deleted inserted replaced
1638:6fd0c2f46b21 1639:0914d128c55e
67 end 67 end
68 end 68 end
69 69
70 local function credentials_callback(mechanism, ...) 70 local function credentials_callback(mechanism, ...)
71 if mechanism == "PLAIN" then 71 if mechanism == "PLAIN" then
72 local username, hostname, password = arg[1], arg[2], arg[3]; 72 local username, hostname, password = ...;
73 local response = usermanager_validate_credentials(hostname, username, password, mechanism) 73 local response = usermanager_validate_credentials(hostname, username, password, mechanism);
74 if response == nil then return false 74 if response == nil then
75 else return response end 75 return false;
76 else
77 return response;
78 end
76 elseif mechanism == "DIGEST-MD5" then 79 elseif mechanism == "DIGEST-MD5" then
77 function func(x) return x; end 80 function func(x) return x; end
78 local node, domain, realm, decoder = arg[1], arg[2], arg[3], arg[4]; 81 local node, domain, realm, decoder = ...;
79 local password = usermanager_get_password(node, domain) 82 local password = usermanager_get_password(node, domain);
80 if password then 83 if password then
81 if decoder then node, realm, password = decoder(node), decoder(realm), decoder(password); end 84 if decoder then
85 node, realm, password = decoder(node), decoder(realm), decoder(password);
86 end
82 return func, md5(node..":"..realm..":"..password); 87 return func, md5(node..":"..realm..":"..password);
83 else 88 else
84 return func, nil; 89 return func, nil;
85 end 90 end
86 end 91 end