mod_auth_dovecot/auth_dovecot/sasl_dovecot.lib.lua
changeset 1324 853a382c9bd6
parent 838 c9e2beec4ef6
child 1325 b21236b6b8d8
equal deleted inserted replaced
1323:c84ff82658cb 1324:853a382c9bd6
    60 	else
    60 	else
    61 		err = "luasocket was not compiled with UNIX sockets support";
    61 		err = "luasocket was not compiled with UNIX sockets support";
    62 	end
    62 	end
    63 
    63 
    64 	if not ok then
    64 	if not ok then
    65 		return false, "error connecting to dovecot "..tostring(socket_type).." socket at '"
    65 		log("error", "error connecting to dovecot %s socket at '%s'. error was '%s'", socket_type, socket_path or socket_info, err);
    66 			..tostring(socket_path or socket_info).."'. error was '"..tostring(err).."'";
    66 		return false;
    67 	end
    67 	end
    68 
    68 
    69 	-- Send our handshake
    69 	-- Send our handshake
    70 	pid = tonumber(tostring(conn):match("0x%x*$"));
    70 	pid = tonumber(tostring(conn):match("0x%x*$"));
    71 	log("debug", "sending handshake to dovecot. version 1.1, cpid '%d'", pid);
    71 	log("debug", "sending handshake to dovecot. version 1.1, cpid '%d'", pid);
    93 		if first == "VERSION" then
    93 		if first == "VERSION" then
    94 			-- Version should be 1.1
    94 			-- Version should be 1.1
    95 			local major_version = parts();
    95 			local major_version = parts();
    96 
    96 
    97 			if major_version ~= "1" then
    97 			if major_version ~= "1" then
       
    98 				log("error", "dovecot server version is not 1.x. it is %s.x", major_version);
    98 				conn:close();
    99 				conn:close();
    99 				return false, "dovecot server version is not 1.x. it is "..tostring(major_version)..".x";
   100 				return false, "dovecot server version is not 1.x. it is "..tostring(major_version)..".x";
   100 			end
   101 			end
   101 		elseif first == "MECH" then
   102 		elseif first == "MECH" then
   102 			local mech = parts();
   103 			local mech = parts();