util/sasl_cyrus.lua
changeset 2895 ea5fe15a82f5
parent 2881 4e6c6b1ddce7
child 2901 5f3ccf7dd3f1
--- a/util/sasl_cyrus.lua	Wed Mar 17 15:29:14 2010 -0700
+++ b/util/sasl_cyrus.lua	Wed Mar 17 15:29:14 2010 -0700
@@ -53,6 +53,16 @@
 	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;