Merge with 0.6
[prosody.git] / util / sasl_cyrus.lua
index 610257ca124f8252b6955f0e815b699764ec166f..57c6ba3cbb3b68c3ad6d1ef9f1b75e123ad94011 100644 (file)
@@ -35,8 +35,11 @@ local initialized = false;
 
 local function init(service_name)
        if not initialized then
-               if pcall(cyrussasl.server_init, service_name) then
+               local st, errmsg = pcall(cyrussasl.server_init, service_name);
+               if st then
                        initialized = true;
+               else
+                       log("error", "Failed to initialize CyrusSASL: %s", errmsg);
                end
        end
 end
@@ -110,7 +113,7 @@ function method:process(message)
             "undefined-condition",
             "SASL mechanism not available"
        elseif (err == -13) then -- SASL_BADAUTH
-          return "failure", "not-authorized"
+          return "failure", "not-authorized", cyrussasl.get_message( self.cyrus )
        else
           log("debug", "Got SASL error condition %d", err)
           return "failure",