changeset 2798:e9ca7fd4ad06

mod_auth_dovecot: Support new luasocket unix domain socket API (fixes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=852250 in Debian Stretch)
author Waqas Hussain <waqas20@gmail.com>
date Sat, 14 Oct 2017 23:04:02 -0400
parents 44e5adbb6ac0
children db0f654b9b3f
files mod_auth_dovecot/auth_dovecot/sasl_dovecot.lib.lua
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;