aboutsummaryrefslogtreecommitdiffstats
path: root/util/sasl/scram.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2015-08-20 13:05:22 +0200
committerKim Alvefur <zash@zash.se>2015-08-20 13:05:22 +0200
commit80c7d5155e9c468d86f3b268e90303decd7d1827 (patch)
tree103fd7d9396b60b9f76071a009c54d3ca9d35744 /util/sasl/scram.lua
parentf1313996a2db339fe76f269353cc911c68316f30 (diff)
parentc5e4af96d8bd9de7a96d3dc1eff5b8d1eecbfdaf (diff)
downloadprosody-80c7d5155e9c468d86f3b268e90303decd7d1827.tar.gz
prosody-80c7d5155e9c468d86f3b268e90303decd7d1827.zip
Merge 0.10->trunk
Diffstat (limited to 'util/sasl/scram.lua')
-rw-r--r--util/sasl/scram.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/util/sasl/scram.lua b/util/sasl/scram.lua
index 0d2852bf..a1b5117a 100644
--- a/util/sasl/scram.lua
+++ b/util/sasl/scram.lua
@@ -25,7 +25,7 @@ local t_concat = table.concat;
local char = string.char;
local byte = string.byte;
-module "sasl.scram"
+local _ENV = nil;
--=========================
--SASL SCRAM-SHA-1 according to RFC 5802
@@ -87,7 +87,7 @@ local function hashprep(hashname)
return hashname:lower():gsub("-", "_");
end
-function getAuthenticationDatabaseSHA1(password, salt, iteration_count)
+local function getAuthenticationDatabaseSHA1(password, salt, iteration_count)
if type(password) ~= "string" or type(salt) ~= "string" or type(iteration_count) ~= "number" then
return false, "inappropriate argument types"
end
@@ -235,7 +235,7 @@ local function scram_gen(hash_name, H_f, HMAC_f)
return scram_hash;
end
-function init(registerMechanism)
+local function init(registerMechanism)
local function registerSCRAMMechanism(hash_name, hash, hmac_hash)
registerMechanism("SCRAM-"..hash_name, {"plain", "scram_"..(hashprep(hash_name))}, scram_gen(hash_name:lower(), hash, hmac_hash));
@@ -246,4 +246,7 @@ function init(registerMechanism)
registerSCRAMMechanism("SHA-1", sha1, hmac_sha1);
end
-return _M;
+return {
+ getAuthenticationDatabaseSHA1 = getAuthenticationDatabaseSHA1;
+ init = init;
+}