Changeset

902:490cb9161c81

mod_auth_{external,internal_yubikey,ldap,ldap2,sql}: No need to nodeprep in SASL handler.
author Waqas Hussain <waqas20@gmail.com>
date Sat, 26 Jan 2013 04:34:05 +0500
parents 901:e3ad5f3aa6d4
children 903:8a1beff848c1
files mod_auth_external/mod_auth_external.lua mod_auth_internal_yubikey/mod_auth_internal_yubikey.lua mod_auth_ldap/mod_auth_ldap.lua mod_auth_ldap2/mod_auth_ldap2.lua mod_auth_sql/mod_auth_sql.lua
diffstat 5 files changed, 4 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/mod_auth_external/mod_auth_external.lua	Sat Jan 26 00:15:24 2013 +0100
+++ b/mod_auth_external/mod_auth_external.lua	Sat Jan 26 04:34:05 2013 +0500
@@ -10,7 +10,6 @@
 --
 
 
-local nodeprep = require "util.encodings".stringprep.nodeprep;
 --local process = require "process";
 local lpc; pcall(function() lpc = require "lpc"; end);
 
@@ -81,8 +80,6 @@
 
 function do_query(kind, username, password)
 	if not username then return nil, "not-acceptable"; end
-	username = nodeprep(username);
-	if not username then return nil, "jid-malformed"; end
 	
 	local query = (password and "%s:%s:%s:%s" or "%s:%s:%s"):format(kind, username, host, password);
 	local len = #query
@@ -132,12 +129,7 @@
 function provider.get_sasl_handler()
 	local testpass_authentication_profile = {
 		plain_test = function(sasl, username, password, realm)
-			local prepped_username = nodeprep(username);
-			if not prepped_username then
-				log("debug", "NODEprep failed on username: %s", username);
-				return "", nil;
-			end
-			return usermanager.test_password(prepped_username, realm, password), true;
+			return usermanager.test_password(username, realm, password), true;
 		end,
 	};
 	return new_sasl(host, testpass_authentication_profile);
--- a/mod_auth_internal_yubikey/mod_auth_internal_yubikey.lua	Sat Jan 26 00:15:24 2013 +0100
+++ b/mod_auth_internal_yubikey/mod_auth_internal_yubikey.lua	Sat Jan 26 04:34:05 2013 +0500
@@ -18,7 +18,6 @@
 local config = require "core.configmanager";
 local usermanager = require "core.usermanager";
 local new_sasl = require "util.sasl".new;
-local nodeprep = require "util.encodings".stringprep.nodeprep;
 local hosts = hosts;
 
 local prosody = _G.prosody;
@@ -106,12 +105,6 @@
 	local realm = module:get_option("sasl_realm") or module.host;
 	local getpass_authentication_profile = {
 		plain_test = function(sasl, username, password, realm)
-			local prepped_username = nodeprep(username);
-			if not prepped_username then
-				log("debug", "NODEprep failed on username: %s", username);
-				return false, nil;
-			end
-			
 			return usermanager.test_password(username, realm, password), true;
 		end
 	};
--- a/mod_auth_ldap/mod_auth_ldap.lua	Sat Jan 26 00:15:24 2013 +0100
+++ b/mod_auth_ldap/mod_auth_ldap.lua	Sat Jan 26 04:34:05 2013 +0500
@@ -1,6 +1,5 @@
 
 local new_sasl = require "util.sasl".new;
-local nodeprep = require "util.encodings".stringprep.nodeprep;
 local log = require "util.logger".init("auth_ldap");
 
 local ldap_server = module:get_option("ldap_server") or "localhost";
@@ -42,12 +41,7 @@
 function provider.get_sasl_handler()
 	local testpass_authentication_profile = {
 		plain_test = function(sasl, username, password, realm)
-			local prepped_username = nodeprep(username);
-			if not prepped_username then
-				log("debug", "NODEprep failed on username: %s", username);
-				return "", nil;
-			end
-			return provider.test_password(prepped_username, password), true;
+			return provider.test_password(username, password), true;
 		end
 	};
 	return new_sasl(module.host, testpass_authentication_profile);
--- a/mod_auth_ldap2/mod_auth_ldap2.lua	Sat Jan 26 00:15:24 2013 +0100
+++ b/mod_auth_ldap2/mod_auth_ldap2.lua	Sat Jan 26 04:34:05 2013 +0500
@@ -13,7 +13,6 @@
 
 local ldap     = module:require 'ldap';
 local new_sasl = require 'util.sasl'.new;
-local nodeprep = require 'util.encodings'.stringprep.nodeprep;
 local jsplit   = require 'util.jid'.split;
 
 if not ldap then
@@ -52,12 +51,7 @@
 function provider.get_sasl_handler()
     local testpass_authentication_profile = {
         plain_test = function(sasl, username, password, realm)
-            local prepped_username = nodeprep(username);
-            if not prepped_username then
-                module:log("debug", "NODEprep failed on username: %s", username);
-                return "", nil;
-            end
-            return provider.test_password(prepped_username, password), true;
+            return provider.test_password(username, password), true;
         end,
         mechanisms = { PLAIN = true },
     };
--- a/mod_auth_sql/mod_auth_sql.lua	Sat Jan 26 00:15:24 2013 +0100
+++ b/mod_auth_sql/mod_auth_sql.lua	Sat Jan 26 04:34:05 2013 +0500
@@ -5,7 +5,6 @@
 
 local log = require "util.logger".init("auth_sql");
 local new_sasl = require "util.sasl".new;
-local nodeprep = require "util.encodings".stringprep.nodeprep;
 local DBI = require "DBI"
 
 local connection;
@@ -101,12 +100,7 @@
 function provider.get_sasl_handler()
 	local profile = {
 		plain = function(sasl, username, realm)
-			local prepped_username = nodeprep(username);
-			if not prepped_username then
-				module:log("debug", "NODEprep failed on username: %s", username);
-				return "", nil;
-			end
-			local password = get_password(prepped_username);
+			local password = get_password(username);
 			if not password then return "", nil; end
 			return password, true;
 		end