mod_auth_dovecot: Support new luasocket unix domain socket API (fixes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=852250 in Debian Stretch)

Sat, 14 Oct 2017 23:04:02 -0400

author
Waqas Hussain <waqas20@gmail.com>
date
Sat, 14 Oct 2017 23:04:02 -0400
changeset 2798
e9ca7fd4ad06
parent 2797
44e5adbb6ac0
child 2799
db0f654b9b3f

mod_auth_dovecot: Support new luasocket unix domain socket API (fixes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=852250 in Debian Stretch)

mod_auth_dovecot/auth_dovecot/sasl_dovecot.lib.lua file | annotate | diff | comparison | revisions
--- a/mod_auth_dovecot/auth_dovecot/sasl_dovecot.lib.lua	Sat Oct 14 18:43:23 2017 +0200
+++ b/mod_auth_dovecot/auth_dovecot/sasl_dovecot.lib.lua	Sat Oct 14 23:04:02 2017 -0400
@@ -26,7 +26,13 @@
 local tostring, tonumber = tostring, tonumber;
 
 local socket = require "socket"
-pcall(require, "socket.unix");
+
+local unix_success, unix = pcall(require, "socket.unix");
+if unix_success and unix and not socket.unix then
+	-- COMPAT map new luasocket API to old
+	socket.unix = unix.stream or unix.tcp;
+end
+
 local base64 = require "util.encodings".base64;
 local b64, unb64 = base64.encode, base64.decode;
 local jid_escape = require "util.jid".escape;

mercurial