Mercurial > prosody-modules
comparison mod_auth_dovecot/mod_auth_dovecot.lua @ 267:76f3310ec113
mod_auth_dovecot: Use PID in handshake
author | Javier Torres <javitonino@gmail.com> |
---|---|
date | Sat, 30 Oct 2010 23:38:19 +0200 |
parents | 0f46fb2dbc79 |
children | cfcd4efb0fa4 |
comparison
equal
deleted
inserted
replaced
265:8cd2fab3135a | 267:76f3310ec113 |
---|---|
9 local datamanager = require "util.datamanager"; | 9 local datamanager = require "util.datamanager"; |
10 local log = require "util.logger".init("auth_internal_plain"); | 10 local log = require "util.logger".init("auth_internal_plain"); |
11 local new_sasl = require "util.sasl".new; | 11 local new_sasl = require "util.sasl".new; |
12 local nodeprep = require "util.encodings".stringprep.nodeprep; | 12 local nodeprep = require "util.encodings".stringprep.nodeprep; |
13 local base64 = require "util.encodings".base64; | 13 local base64 = require "util.encodings".base64; |
14 local pposix = require "util.pposix"; | |
14 | 15 |
15 local prosody = _G.prosody; | 16 local prosody = _G.prosody; |
16 | 17 |
17 function new_default_provider(host) | 18 function new_default_provider(host) |
18 local provider = { name = "dovecot" }; | 19 local provider = { name = "dovecot" }; |
22 log("debug", "test password '%s' for user %s at host %s", password, username, module.host); | 23 log("debug", "test password '%s' for user %s at host %s", password, username, module.host); |
23 | 24 |
24 c = assert(socket.unix()); | 25 c = assert(socket.unix()); |
25 assert(c:connect("/var/run/dovecot/auth-login")); -- FIXME: Hardcoded is bad | 26 assert(c:connect("/var/run/dovecot/auth-login")); -- FIXME: Hardcoded is bad |
26 | 27 |
27 local pid = "12345"; -- FIXME: this should be an unique number between processes, recommendation is PID | 28 local pid = pposix.getpid(); |
28 | 29 |
29 -- Send our handshake | 30 -- Send our handshake |
30 -- FIXME: Oh no! There are asserts everywhere | 31 -- FIXME: Oh no! There are asserts everywhere |
31 assert(c:send("VERSION\t1\t1\n")); | 32 assert(c:send("VERSION\t1\t1\n")); |
32 assert(c:send("CPID\t" .. pid .. "\n")); | 33 assert(c:send("CPID\t" .. pid .. "\n")); |