plugins/mod_auth_internal_hashed.lua

changeset 3193
d686abb6b069
parent 3191
a475fbce1990
child 3204
7a15cbf23c5b
child 3205
2dcd826bbbc6
--- a/plugins/mod_auth_internal_hashed.lua	Mon Jun 07 02:40:14 2010 +0500
+++ b/plugins/mod_auth_internal_hashed.lua	Mon Jun 07 03:07:58 2010 +0500
@@ -117,6 +117,16 @@
 					return "", nil;
 				end
 				return usermanager.test_password(prepped_username, password, realm), true;
+			end,
+			scram_sha_1 = function(username, realm)
+				local credentials = datamanager.load(username, host, "accounts") or {};
+				if credentials.password then
+					usermanager.set_password(username, credentials.password);
+					credentials = datamanager.load(username, host, "accounts") or {};
+				end
+				local salted_password, iteration_count, salt = credentials.hashpass, credentials.iteration_count, credentials.salt;
+				salted_password = salted_password and salted_password:gsub("..", function(x) return string.char(tonumber(x, 16)); end);
+				return salted_password, iteration_count, salt, true;
 			end
 		};
 		return new_sasl(realm, testpass_authentication_profile);

mercurial