util.sasl.scram: Adding documentation on SCRAM authentication backend.
[prosody.git] / util / sasl_cyrus.lua
index 7e0cbc299882a4e2683ee1815d789ea196bcc9de..b5f505ebbc2f5cd99ab85cdb34bae24ba1ec07d2 100644 (file)
@@ -45,10 +45,10 @@ local function init(service_name)
 end
 
 -- create a new SASL object which can be used to authenticate clients
-function new(realm, service_name)
+function new(realm, service_name, app_name)
        local sasl_i = {};
 
-       init(service_name);
+       init(app_name or service_name);
 
        sasl_i.realm = realm;
        sasl_i.service_name = service_name;
@@ -123,16 +123,12 @@ function method:process(message)
           return "challenge", data
        elseif (err == -4) then -- SASL_NOMECH
           log("debug", "SASL mechanism not available from remote end")
-          return "failure", 
-            "undefined-condition",
-            "SASL mechanism not available"
+          return "failure", "invalid-mechanism", "SASL mechanism not available"
        elseif (err == -13) then -- SASL_BADAUTH
           return "failure", "not-authorized", cyrussasl.get_message( self.cyrus )
        else
           log("debug", "Got SASL error condition %d", err)
-          return "failure", 
-            "undefined-condition",
-            cyrussasl.get_message( self.cyrus )
+          return "failure", "undefined-condition", cyrussasl.get_message( self.cyrus )
        end
 end