equal
deleted
inserted
replaced
58 [-27] = "passphrase is too weak for security policy"; |
58 [-27] = "passphrase is too weak for security policy"; |
59 [-28] = "user supplied passwords not permitted"; |
59 [-28] = "user supplied passwords not permitted"; |
60 }; |
60 }; |
61 setmetatable(sasl_errstring, { __index = function() return "undefined error!" end }); |
61 setmetatable(sasl_errstring, { __index = function() return "undefined error!" end }); |
62 |
62 |
63 module "sasl_cyrus" |
63 local _ENV = nil; |
64 |
64 |
65 local method = {}; |
65 local method = {}; |
66 method.__index = method; |
66 method.__index = method; |
67 local initialized = false; |
67 local initialized = false; |
68 |
68 |
80 -- create a new SASL object which can be used to authenticate clients |
80 -- create a new SASL object which can be used to authenticate clients |
81 -- host_fqdn may be nil in which case gethostname() gives the value. |
81 -- host_fqdn may be nil in which case gethostname() gives the value. |
82 -- For GSSAPI, this determines the hostname in the service ticket (after |
82 -- For GSSAPI, this determines the hostname in the service ticket (after |
83 -- reverse DNS canonicalization, only if [libdefaults] rdns = true which |
83 -- reverse DNS canonicalization, only if [libdefaults] rdns = true which |
84 -- is the default). |
84 -- is the default). |
85 function new(realm, service_name, app_name, host_fqdn) |
85 local function new(realm, service_name, app_name, host_fqdn) |
86 |
86 |
87 init(app_name or service_name); |
87 init(app_name or service_name); |
88 |
88 |
89 local st, ret = pcall(cyrussasl.server_new, service_name, host_fqdn, realm, nil, nil) |
89 local st, ret = pcall(cyrussasl.server_new, service_name, host_fqdn, realm, nil, nil) |
90 if not st then |
90 if not st then |
161 log("debug", "Got SASL error condition %d: %s", err, sasl_errstring[err]); |
161 log("debug", "Got SASL error condition %d: %s", err, sasl_errstring[err]); |
162 return "failure", "undefined-condition", sasl_errstring[err]; |
162 return "failure", "undefined-condition", sasl_errstring[err]; |
163 end |
163 end |
164 end |
164 end |
165 |
165 |
166 return _M; |
166 return { |
|
167 new = new; |
|
168 }; |