Mercurial > prosody-modules
changeset 272:6b35c23664db
mod_auth_dovecot: Use sequential (instead of fixed) id for messages
author | Javier Torres <javitonino@gmail.com> |
---|---|
date | Sat, 30 Oct 2010 23:39:40 +0200 |
parents | 05ea4abb664d |
children | 8d283ae7f29d |
files | mod_auth_dovecot/mod_auth_dovecot.lua |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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