aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_saslauth.lua
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2011-01-17 16:50:21 +0100
committerTobias Markmann <tm@ayena.de>2011-01-17 16:50:21 +0100
commitd07446041f3c2c72077de003db171bd2b5ecd0c6 (patch)
treeaa987e547cb05bc578d53c720841e74201a5129c /plugins/mod_saslauth.lua
parentbd085514c5801265370efd4d044cb8f992e67170 (diff)
downloadprosody-d07446041f3c2c72077de003db171bd2b5ecd0c6.tar.gz
prosody-d07446041f3c2c72077de003db171bd2b5ecd0c6.zip
mod_saslauth: Check whether LuaSec supports getpeerfinished() binding.
Diffstat (limited to 'plugins/mod_saslauth.lua')
-rw-r--r--plugins/mod_saslauth.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua
index 822be62b..422bc187 100644
--- a/plugins/mod_saslauth.lua
+++ b/plugins/mod_saslauth.lua
@@ -247,10 +247,14 @@ module:hook("stream-features", function(event)
end
origin.sasl_handler = usermanager_get_sasl_handler(module.host);
if origin.secure then
- origin.sasl_handler:add_cb_handler("tls-unique", function(self)
- return self.userdata:getpeerfinished();
- end);
- origin.sasl_handler["userdata"] = origin.conn:socket();
+ -- check wether LuaSec has the nifty binding to the function needed for tls-unique
+ -- FIXME: would be nice to have this check only once and not for every socket
+ if origin.conn:socket().getpeerfinished then
+ origin.sasl_handler:add_cb_handler("tls-unique", function(self)
+ return self.userdata:getpeerfinished();
+ end);
+ origin.sasl_handler["userdata"] = origin.conn:socket();
+ end
end
features:tag("mechanisms", mechanisms_attr);
for mechanism in pairs(origin.sasl_handler:mechanisms()) do