Merge
[prosody.git] / plugins / mod_saslauth.lua
index ed19a150810a187ab0434e5c5f49e2b1c49fac74..d3f32be3d5d1357b776cd735a4fd218275a7495e 100644 (file)
@@ -1,4 +1,4 @@
--- Prosody IM v0.3
+-- Prosody IM v0.4
 -- Copyright (C) 2008-2009 Matthew Wild
 -- Copyright (C) 2008-2009 Waqas Hussain
 -- 
@@ -17,6 +17,7 @@ local t_concat, t_insert = table.concat, table.insert;
 local tostring = tostring;
 local jid_split = require "util.jid".split
 local md5 = require "util.hashes".md5;
+local config = require "core.configmanager";
 
 local log = require "util.logger".init("mod_saslauth");
 
@@ -106,7 +107,9 @@ module:add_event_hook("stream-features",
                                -- TODO: Provide PLAIN only if TLS is active, this is a SHOULD from the introduction of RFC 4616. This behavior could be overridden via configuration but will issuing a warning or so.
                                        features:tag("mechanism"):text("PLAIN"):up();
                                        features:tag("mechanism"):text("DIGEST-MD5"):up();
-                                       features:tag("mechanism"):text("ANONYMOUS"):up();
+                                       if config.get(session.host or "*", "core", "sasl_anonymous") then
+                                               features:tag("mechanism"):text("ANONYMOUS"):up();
+                                       end
                                features:up();
                        else
                                features:tag("bind", bind_attr):tag("required"):up():up();