mod_auth_cyrus: Print some diagnostic log messages about the available mechanisms.
authorWaqas Hussain <waqas20@gmail.com>
Tue, 22 Feb 2011 20:22:04 +0000 (01:22 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Tue, 22 Feb 2011 20:22:04 +0000 (01:22 +0500)
plugins/mod_auth_cyrus.lua

index ed3d5408f573895e33d3ed2ad47c7ce4d46ef60f..2a52c8b536bd7f11a89a9c5ab63dc18d587911e2 100644 (file)
@@ -27,6 +27,19 @@ local new_sasl = function(realm)
        );
 end
 
+do -- diagnostic
+       local realm = module:get_option("sasl_realm") or module.host;
+       local list;
+       for mechanism in pairs(new_sasl(realm):mechanisms()) do
+               list = (not(list) and mechanism) or (list..", "..mechanism);
+       end
+       if not list then
+               module:log("error", "No Cyrus SASL mechanisms available");
+       else
+               module:log("debug", "Available Cyrus SASL mechanisms: %s", list);
+       end
+end
+
 function new_default_provider(host)
        local provider = { name = "cyrus" };
        log("debug", "initializing default authentication provider for host '%s'", host);