Comparison

util/sasl_cyrus.lua @ 2895:ea5fe15a82f5

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'.
author Paul Aurich <paul@darkrain42.org>
date Wed, 17 Mar 2010 15:29:14 -0700
parent 2881:4e6c6b1ddce7
child 2901:5f3ccf7dd3f1
comparison
equal deleted inserted replaced
2894:066c199135d5 2895:ea5fe15a82f5
51 init(service_name); 51 init(service_name);
52 52
53 sasl_i.realm = realm; 53 sasl_i.realm = realm;
54 sasl_i.service_name = service_name; 54 sasl_i.service_name = service_name;
55 sasl_i.cyrus = cyrussasl.server_new(service_name, nil, realm, nil, nil) 55 sasl_i.cyrus = cyrussasl.server_new(service_name, nil, realm, nil, nil)
56
57 if cyrussasl.set_canon_cb then
58 local c14n_cb = function (user)
59 local node = s_match(user, "^([^@]+)");
60 log("debug", "Canonicalizing username %s to %s", user, node)
61 return node
62 end
63 cyrussasl.set_canon_cb(sasl_i.cyrus, c14n_cb);
64 end
65
56 if sasl_i.cyrus == 0 then 66 if sasl_i.cyrus == 0 then
57 log("error", "got NULL return value from server_new") 67 log("error", "got NULL return value from server_new")
58 return nil; 68 return nil;
59 end 69 end
60 cyrussasl.setssf(sasl_i.cyrus, 0, 0xffffffff) 70 cyrussasl.setssf(sasl_i.cyrus, 0, 0xffffffff)