# HG changeset patch # User Waqas Hussain # Date 1280757256 -18000 # Node ID 8a12ae696687e59ab6d0b4c0a7fd155ff13782dc # Parent 046a8cf304ddaabb6b6c6797aa34e7d8f0a3b2b2 util.sasl_cyrus: Cleanup. diff -r 046a8cf304dd -r 8a12ae696687 util/sasl_cyrus.lua --- a/util/sasl_cyrus.lua Mon Aug 02 18:47:33 2010 +0500 +++ b/util/sasl_cyrus.lua Mon Aug 02 18:54:16 2010 +0500 @@ -87,21 +87,17 @@ -- 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 @@ 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