Diff

core/usermanager.lua @ 449:c0a4a1e63d70

Completely switched to new hashes library from the old md5 library
author Waqas Hussain <waqas20@gmail.com>
date Fri, 28 Nov 2008 01:16:26 +0500
parent 228:875842235836
child 519:cccd610a0ef9
line wrap: on
line diff
--- a/core/usermanager.lua	Fri Nov 28 01:13:34 2008 +0500
+++ b/core/usermanager.lua	Fri Nov 28 01:16:26 2008 +0500
@@ -19,15 +19,12 @@
 		end
 	end
 	-- must do md5
-	if not hashes.md5 then
-		return nil, "Server misconfiguration, the md5 library is not available.";
-	end
 	-- make credentials md5
 	local pwd = credentials.password;
-	if not pwd then pwd = credentials.md5; else pwd = hashes.md5(pwd); end
+	if not pwd then pwd = credentials.md5; else pwd = hashes.md5(pwd, true); end
 	-- make password md5
 	if method == "PLAIN" then
-		password = hashes.md5(password or "");
+		password = hashes.md5(password or "", true);
 	elseif method ~= "DIGEST-MD5" then
 		return nil, "Unsupported auth method";
 	end
@@ -49,9 +46,7 @@
 
 function get_supported_methods(host)
 	local methods = {["PLAIN"] = true}; -- TODO this should be taken from the config
-	if hashes.md5 then
-		methods["DIGEST-MD5"] = true;
-	end
+	methods["DIGEST-MD5"] = true;
 	return methods;
 end