aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorPaul Aurich <paul@darkrain42.org>2010-03-17 15:29:14 -0700
committerPaul Aurich <paul@darkrain42.org>2010-03-17 15:29:14 -0700
commit11b625e4ebc9bc396bb7fbf84fb058dc1e271897 (patch)
tree95d3558257cb374a99d89cea8111e9b5e7218ae0 /util
parentfe0f1c99368aa0009ab3ba85236f334ef2d256af (diff)
downloadprosody-11b625e4ebc9bc396bb7fbf84fb058dc1e271897.tar.gz
prosody-11b625e4ebc9bc396bb7fbf84fb058dc1e271897.zip
util.sasl_cyrus: If available, use a c14n callback for interoperability with bad clients.
Specifically, clients that specify an authzid 'user@domain.com' and authcid 'user'.
Diffstat (limited to 'util')
-rw-r--r--util/sasl_cyrus.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/util/sasl_cyrus.lua b/util/sasl_cyrus.lua
index 132da533..d011e08b 100644
--- a/util/sasl_cyrus.lua
+++ b/util/sasl_cyrus.lua
@@ -53,6 +53,16 @@ function new(realm, service_name)
sasl_i.realm = realm;
sasl_i.service_name = service_name;
sasl_i.cyrus = cyrussasl.server_new(service_name, nil, realm, nil, nil)
+
+ if cyrussasl.set_canon_cb then
+ local c14n_cb = function (user)
+ local node = s_match(user, "^([^@]+)");
+ log("debug", "Canonicalizing username %s to %s", user, node)
+ return node
+ end
+ cyrussasl.set_canon_cb(sasl_i.cyrus, c14n_cb);
+ end
+
if sasl_i.cyrus == 0 then
log("error", "got NULL return value from server_new")
return nil;