diff plugins/mod_auth_internal_hashed.lua @ 4797:e239668aa6d2

Merge 0.9->trunk
author Matthew Wild <mwild1@gmail.com>
date Sun, 29 Apr 2012 02:10:55 +0100
parents 0df5b2d5dff3
children 5f9066db1b4d
line wrap: on
line diff
--- a/plugins/mod_auth_internal_hashed.lua	Sun Apr 29 02:09:12 2012 +0100
+++ b/plugins/mod_auth_internal_hashed.lua	Sun Apr 29 02:10:55 2012 +0100
@@ -9,22 +9,11 @@
 
 local datamanager = require "util.datamanager";
 local log = require "util.logger".init("auth_internal_hashed");
-local type = type;
-local error = error;
-local ipairs = ipairs;
-local hashes = require "util.hashes";
-local jid_bare = require "util.jid".bare;
 local getAuthenticationDatabaseSHA1 = require "util.sasl.scram".getAuthenticationDatabaseSHA1;
-local config = require "core.configmanager";
 local usermanager = require "core.usermanager";
 local generate_uuid = require "util.uuid".generate;
 local new_sasl = require "util.sasl".new;
 local nodeprep = require "util.encodings".stringprep.nodeprep;
-local hosts = hosts;
-
--- COMPAT w/old trunk: remove these two lines before 0.8 release
-local hmac_sha1 = require "util.hmac".sha1;
-local sha1 = require "util.hashes".sha1;
 
 local to_hex;
 do
@@ -47,14 +36,12 @@
 end
 
 
-local prosody = _G.prosody;
-
 -- Default; can be set per-user
 local iteration_count = 4096;
 
 function new_hashpass_provider(host)
 	local provider = { name = "internal_hashed" };
-	log("debug", "initializing hashpass authentication provider for host '%s'", host);
+	log("debug", "initializing internal_hashed authentication provider for host '%s'", host);
 
 	function provider.test_password(username, password)
 		local credentials = datamanager.load(username, host, "accounts") or {};
@@ -75,16 +62,6 @@
 			return nil, "Auth failed. Stored salt and iteration count information is not complete.";
 		end
 		
-		-- convert hexpass to stored_key and server_key
-		-- COMPAT w/old trunk: remove before 0.8 release
-		if credentials.hashpass then
-			local salted_password = from_hex(credentials.hashpass);
-			credentials.stored_key = sha1(hmac_sha1(salted_password, "Client Key"), true);
-			credentials.server_key = to_hex(hmac_sha1(salted_password, "Server Key"));
-			credentials.hashpass = nil
-			datamanager.store(username, host, "accounts", credentials);
-		end
-		
 		local valid, stored_key, server_key = getAuthenticationDatabaseSHA1(password, credentials.salt, credentials.iteration_count);
 		
 		local stored_key_hex = to_hex(stored_key);
@@ -158,16 +135,6 @@
 					if not credentials then return; end
 				end
 				
-				-- convert hexpass to stored_key and server_key
-				-- COMPAT w/old trunk: remove before 0.8 release
-				if credentials.hashpass then
-					local salted_password = from_hex(credentials.hashpass);
-					credentials.stored_key = sha1(hmac_sha1(salted_password, "Client Key"), true);
-					credentials.server_key = to_hex(hmac_sha1(salted_password, "Server Key"));
-					credentials.hashpass = nil
-					datamanager.store(username, host, "accounts", credentials);
-				end
-			
 				local stored_key, server_key, iteration_count, salt = credentials.stored_key, credentials.server_key, credentials.iteration_count, credentials.salt;
 				stored_key = stored_key and from_hex(stored_key);
 				server_key = server_key and from_hex(server_key);