Diff

util/sasl.lua @ 6777:5de6b93d0190

util.*: Remove use of module() function, make all module functions local and return them in a table at the end
author Kim Alvefur <zash@zash.se>
date Sat, 21 Feb 2015 10:36:37 +0100
parent 6036:f9e108f7db21
child 8382:e5d00bf4a4d5
line wrap: on
line diff
--- a/util/sasl.lua	Mon Aug 10 22:16:05 2015 +0200
+++ b/util/sasl.lua	Sat Feb 21 10:36:37 2015 +0100
@@ -19,7 +19,7 @@
 local assert = assert;
 local require = require;
 
-module "sasl"
+local _ENV = nil;
 
 --[[
 Authentication Backend Prototypes:
@@ -47,7 +47,7 @@
 local mechanism_channelbindings = {};
 
 -- register a new SASL mechanims
-function registerMechanism(name, backends, f, cb_backends)
+local function registerMechanism(name, backends, f, cb_backends)
 	assert(type(name) == "string", "Parameter name MUST be a string.");
 	assert(type(backends) == "string" or type(backends) == "table", "Parameter backends MUST be either a string or a table.");
 	assert(type(f) == "function", "Parameter f MUST be a function.");
@@ -66,7 +66,7 @@
 end
 
 -- create a new SASL object which can be used to authenticate clients
-function new(realm, profile)
+local function new(realm, profile)
 	local mechanisms = profile.mechanisms;
 	if not mechanisms then
 		mechanisms = {};
@@ -138,4 +138,7 @@
 require "util.sasl.scram"     .init(registerMechanism);
 require "util.sasl.external"  .init(registerMechanism);
 
-return _M;
+return {
+	registerMechanism = registerMechanism;
+	new = new;
+};