# HG changeset patch # User Kim Alvefur # Date 1297636145 -3600 # Node ID 6560fd0b77f5f6951b2badb81f71069e6e23b5d8 # Parent beb5073b866aac301912f6054a5d20cff6906cee mod_auth_dovecot: One mechanism per MECH command. diff -r beb5073b866a -r 6560fd0b77f5 mod_auth_dovecot/mod_auth_dovecot.lua --- a/mod_auth_dovecot/mod_auth_dovecot.lua Wed Feb 09 21:08:31 2011 +0500 +++ b/mod_auth_dovecot/mod_auth_dovecot.lua Sun Feb 13 23:29:05 2011 +0100 @@ -78,19 +78,15 @@ return false; end elseif first == "MECH" then - -- Mechanisms should include PLAIN - local ok = false; - for part in parts do - if part == "PLAIN" then - ok = true; - end - end - if not ok then - log("warn", "server doesn't support PLAIN mechanism. It supports '%s'", line); + local mech = parts(); + supported_mechs[mech] = true; + elseif first == "DONE" then + -- We need PLAIN + if not supported_mechs.PLAIN then + log("warn", "server doesn't support PLAIN mechanism."); provider:close(); return false; end - elseif first == "DONE" then done = true; end end