# HG changeset patch # User Waqas Hussain # Date 1263218708 -18000 # Node ID 03bb0e6d87d50171975936febbcfd95d346c8746 # Parent 678ca4e9a479a85940bc6f52b714e5aae650ca61 mod_saslauth: Made some variables local to avoid unnecessary global access. diff -r 678ca4e9a479 -r 03bb0e6d87d5 plugins/mod_saslauth.lua --- a/plugins/mod_saslauth.lua Mon Jan 11 18:59:06 2010 +0500 +++ b/plugins/mod_saslauth.lua Mon Jan 11 19:05:08 2010 +0500 @@ -36,7 +36,7 @@ local new_sasl if sasl_backend == "cyrus" then - cyrus_new = require "util.sasl_cyrus".new; + local cyrus_new = require "util.sasl_cyrus".new; new_sasl = function(realm) return cyrus_new(realm, module:get_option("cyrus_service_name") or "xmpp") end @@ -45,26 +45,26 @@ new_sasl = require "util.sasl".new; end -default_authentication_profile = { +local default_authentication_profile = { plain = function(username, realm) - local prepped_username = nodeprep(username); - if not prepped_username then - log("debug", "NODEprep failed on username: %s", username); - return "", nil; - end - local password = usermanager_get_password(prepped_username, realm); - if not password then - return "", nil; - end - return password, true; + local prepped_username = nodeprep(username); + if not prepped_username then + log("debug", "NODEprep failed on username: %s", username); + return "", nil; end + local password = usermanager_get_password(prepped_username, realm); + if not password then + return "", nil; + end + return password, true; + end }; -anonymous_authentication_profile = { +local anonymous_authentication_profile = { anonymous = function(username, realm) - return true; -- for normal usage you should always return true here - end -} + return true; -- for normal usage you should always return true here + end +}; local function build_reply(status, ret, err_msg) local reply = st.stanza(status, {xmlns = xmlns_sasl});