Skip to content

Instantly share code, notes, and snippets.

@zeen
Created March 16, 2010 01:19
Show Gist options
  • Save zeen/333530 to your computer and use it in GitHub Desktop.
Save zeen/333530 to your computer and use it in GitHub Desktop.
diff --git a/util/sasl_cyrus.lua b/util/sasl_cyrus.lua
--- a/util/sasl_cyrus.lua
+++ b/util/sasl_cyrus.lua
@@ -97,6 +97,9 @@
local data;
if self.mechanism then
+ if self.mechanism == "PLAIN" then
+ message = (message or ""):match("(%z.*)");
+ end
err, data = cyrussasl.server_start(self.cyrus, self.mechanism, message or "")
else
err, data = cyrussasl.server_step(self.cyrus, message or "")
@@ -105,6 +108,9 @@
self.username = cyrussasl.get_username(self.cyrus)
if (err == 0) then -- SASL_OK
+ if not self.username and self.mechanism == "PLAIN" then
+ self.username = message:match("%z(.*)%z");
+ end
return "success", data
elseif (err == 1) then -- SASL_CONTINUE
return "challenge", data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment