Diff

plugins/mod_auth_cyrus.lua @ 5119:d868ce990838

Merge 0.9->trunk
author Waqas Hussain <waqas20@gmail.com>
date Wed, 12 Sep 2012 22:03:57 +0500
parent 5117:2c7e1ce8f482
child 8054:0ba461b7d9af
line wrap: on
line diff
--- a/plugins/mod_auth_cyrus.lua	Mon Sep 10 23:17:06 2012 +0100
+++ b/plugins/mod_auth_cyrus.lua	Wed Sep 12 22:03:57 2012 +0500
@@ -41,45 +41,44 @@
 	end
 end
 
-function new_default_provider(host)
-	local provider = { name = "cyrus" };
-	log("debug", "initializing default authentication provider for host '%s'", host);
-
-	function provider.test_password(username, password)
-		return nil, "Legacy auth not supported with Cyrus SASL.";
-	end
+local host = module.host;
 
-	function provider.get_password(username)
-		return nil, "Passwords unavailable for Cyrus SASL.";
-	end
-	
-	function provider.set_password(username, password)
-		return nil, "Passwords unavailable for Cyrus SASL.";
-	end
+-- define auth provider
+local provider = {};
+log("debug", "initializing default authentication provider for host '%s'", host);
 
-	function provider.user_exists(username)
-		if require_provisioning then
-			return usermanager_user_exists(username, module.host);
-		end
-		return true;
-	end
-
-	function provider.create_user(username, password)
-		return nil, "Account creation/modification not available with Cyrus SASL.";
-	end
+function provider.test_password(username, password)
+	return nil, "Legacy auth not supported with Cyrus SASL.";
+end
 
-	function provider.get_sasl_handler()
-		local handler = new_sasl(module.host);
-		if require_provisioning then
-			function handler.require_provisioning(username)
-				return usermanager_user_exists(username, module.host);
-			end
-		end
-		return handler;
-	end
+function provider.get_password(username)
+	return nil, "Passwords unavailable for Cyrus SASL.";
+end
 
-	return provider;
+function provider.set_password(username, password)
+	return nil, "Passwords unavailable for Cyrus SASL.";
 end
 
-module:add_item("auth-provider", new_default_provider(module.host));
+function provider.user_exists(username)
+	if require_provisioning then
+		return usermanager_user_exists(username, host);
+	end
+	return true;
+end
+
+function provider.create_user(username, password)
+	return nil, "Account creation/modification not available with Cyrus SASL.";
+end
 
+function provider.get_sasl_handler()
+	local handler = new_sasl(host);
+	if require_provisioning then
+		function handler.require_provisioning(username)
+			return usermanager_user_exists(username, host);
+		end
+	end
+	return handler;
+end
+
+module:provides("auth", provider);
+