# HG changeset patch # User Javier Torres # Date 1288474780 -7200 # Node ID 6b35c23664db6b27e47486737271a0df0cf34a73 # Parent 05ea4abb664d09e590f4e14984240124bf437ad4 mod_auth_dovecot: Use sequential (instead of fixed) id for messages diff -r 05ea4abb664d -r 6b35c23664db mod_auth_dovecot/mod_auth_dovecot.lua --- a/mod_auth_dovecot/mod_auth_dovecot.lua Sat Oct 30 23:39:22 2010 +0200 +++ b/mod_auth_dovecot/mod_auth_dovecot.lua Sat Oct 30 23:39:40 2010 +0200 @@ -17,7 +17,7 @@ local socket_path = module:get_option_string("dovecot_auth_socket", "/var/run/dovecot/auth-login"); function new_default_provider(host) - local provider = { name = "dovecot", c = nil }; + local provider = { name = "dovecot", c = nil, request_id = 0 }; log("debug", "initializing dovecot authentication provider for host '%s'", host); -- Closes the socket @@ -128,11 +128,12 @@ -- Send auth data username = username .. "@" .. module.host; -- FIXME: this is actually a hack for my server local b64 = base64.encode(username .. "\0" .. username .. "\0" .. password); - local id = "54321"; -- FIXME: probably can just be a fixed value if making one request per connection - if (not provider:send("AUTH\t" .. id .. "\tPLAIN\tservice=XMPP\tresp=" .. b64 .. "\n")) then + provider.request_id = provider.request_id + 1 + if (not provider:send("AUTH\t" .. provider.request_id .. "\tPLAIN\tservice=XMPP\tresp=" .. b64 .. "\n")) then return nil, "Auth failed. Dovecot communications error"; end + -- Get response local l = provider:receive(); if (not l) then