aboutsummaryrefslogtreecommitdiffstats
path: root/util/sasl_cyrus.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-08-02 18:54:16 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-08-02 18:54:16 +0500
commit185399af4d2605d20e82fa204e54af7bcdcff670 (patch)
tree3afce8918f75dd80620d0f303a970e4f34fed329 /util/sasl_cyrus.lua
parentf502e55ef5b4d44ea5ca8c6f8d6d483a67cdfbcb (diff)
downloadprosody-185399af4d2605d20e82fa204e54af7bcdcff670.tar.gz
prosody-185399af4d2605d20e82fa204e54af7bcdcff670.zip
util.sasl_cyrus: Cleanup.
Diffstat (limited to 'util/sasl_cyrus.lua')
-rw-r--r--util/sasl_cyrus.lua13
1 files changed, 4 insertions, 9 deletions
diff --git a/util/sasl_cyrus.lua b/util/sasl_cyrus.lua
index 834dbf5c..72876bbc 100644
--- a/util/sasl_cyrus.lua
+++ b/util/sasl_cyrus.lua
@@ -87,21 +87,17 @@ end
-- create a new SASL object which can be used to authenticate clients
function new(realm, service_name, app_name)
- local sasl_i = {};
init(app_name or service_name);
- sasl_i.realm = realm;
- sasl_i.service_name = service_name;
-
local st, ret = pcall(cyrussasl.server_new, service_name, nil, realm, nil, nil)
- if st then
- sasl_i.cyrus = ret;
- else
+ if not st then
log("error", "Creating SASL server connection failed: %s", ret);
return nil;
end
+ local sasl_i = { realm = realm, service_name = service_name, cyrus = ret };
+
if cyrussasl.set_canon_cb then
local c14n_cb = function (user)
local node = s_match(user, "^([^@]+)");
@@ -112,8 +108,7 @@ function new(realm, service_name, app_name)
end
cyrussasl.setssf(sasl_i.cyrus, 0, 0xffffffff)
- local s = setmetatable(sasl_i, method);
- return s;
+ return setmetatable(sasl_i, method);
end
-- get a fresh clone with the same realm and service name