Merging with tip.

Sat, 14 Feb 2009 19:13:14 +0100

author
Tobias Markmann <tm@ayena.de>
date
Sat, 14 Feb 2009 19:13:14 +0100
changeset 800
5e12bca2a4f8
parent 799
b7ea802f3527 (diff)
parent 798
2a92b58144a9 (current diff)
child 801
d29febc977fc

Merging with tip.

--- a/plugins/mod_saslauth.lua	Sat Feb 14 15:38:37 2009 +0000
+++ b/plugins/mod_saslauth.lua	Sat Feb 14 19:13:14 2009 +0100
@@ -106,6 +106,7 @@
 				-- 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();
 				features:up();
 			else
 				features:tag("bind", bind_attr):tag("required"):up():up();
--- a/util/sasl.lua	Sat Feb 14 15:38:37 2009 +0000
+++ b/util/sasl.lua	Sat Feb 14 19:13:14 2009 +0100
@@ -1,4 +1,4 @@
--- sasl.lua v0.2
+-- sasl.lua v0.3
 -- Copyright (C) 2008-2009 Tobias Markmann
 -- 
 --    All rights reserved.
@@ -235,10 +235,21 @@
 	return object
 end
 
+local function new_anonymous(realm, password_handler)
+	local object = { mechanism = "ANONYMOUS", realm = realm, password_handler = password_handler}
+		function object.feed(self, message)
+			return "success"
+		end
+	object["username"] = generate_uuid()
+	return object
+end
+
+
 function new(mechanism, realm, password_handler)
 	local object
 	if mechanism == "PLAIN" then object = new_plain(realm, password_handler)
 	elseif mechanism == "DIGEST-MD5" then object = new_digest_md5(realm, password_handler)
+	elseif mechanism == "ANONYMOUS" then object = new_anonymous(realm, password_handler)
 	else
 		log("debug", "Unsupported SASL mechanism: "..tostring(mechanism));
 		return nil

mercurial