Mercurial > prosody-modules
comparison mod_auth_dovecot/auth_dovecot/sasl_dovecot.lib.lua @ 1372:a573d64968e9
mod_auth_dovecot: Add a dependency to util.pposix to send the _real_ pid
author | benjamin.podszun@gmail.com |
---|---|
date | Fri, 28 Mar 2014 19:08:00 +0100 |
parents | 7dbde05b48a9 |
children | e9ca7fd4ad06 |
comparison
equal
deleted
inserted
replaced
1371:945784087d27 | 1372:a573d64968e9 |
---|---|
30 local base64 = require "util.encodings".base64; | 30 local base64 = require "util.encodings".base64; |
31 local b64, unb64 = base64.encode, base64.decode; | 31 local b64, unb64 = base64.encode, base64.decode; |
32 local jid_escape = require "util.jid".escape; | 32 local jid_escape = require "util.jid".escape; |
33 local prepped_split = require "util.jid".prepped_split; | 33 local prepped_split = require "util.jid".prepped_split; |
34 local nodeprep = require "util.encodings".stringprep.nodeprep; | 34 local nodeprep = require "util.encodings".stringprep.nodeprep; |
35 local pposix = require "util.pposix"; | |
35 | 36 |
36 --module "sasl_dovecot" | 37 --module "sasl_dovecot" |
37 local _M = {}; | 38 local _M = {}; |
38 | 39 |
39 local request_id = 0; | 40 local request_id = 0; |
65 return false, "error connecting to dovecot "..tostring(socket_type).." socket at '" | 66 return false, "error connecting to dovecot "..tostring(socket_type).." socket at '" |
66 ..tostring(socket_path or socket_info).."'. error was '"..tostring(err).."'"; | 67 ..tostring(socket_path or socket_info).."'. error was '"..tostring(err).."'"; |
67 end | 68 end |
68 | 69 |
69 -- Send our handshake | 70 -- Send our handshake |
70 pid = tonumber(tostring(conn):match("0x%x*$")); | 71 pid = pposix.getpid(); |
71 log("debug", "sending handshake to dovecot. version 1.1, cpid '%d'", pid); | 72 log("debug", "sending handshake to dovecot. version 1.1, cpid '%d'", pid); |
72 local success,err = conn:send("VERSION\t1\t1\n"); | 73 local success,err = conn:send("VERSION\t1\t1\n"); |
73 if not success then | 74 if not success then |
74 return false, "Unable to send version data to socket: "..tostring(err); | 75 return false, "Unable to send version data to socket: "..tostring(err); |
75 end | 76 end |