mod_auth_dovecot/auth_dovecot/sasl_dovecot.lib.lua
changeset 1325 b21236b6b8d8
parent 1324 853a382c9bd6
child 1343 7dbde05b48a9
equal deleted inserted replaced
1324:853a382c9bd6 1325:b21236b6b8d8
    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 		log("error", "error connecting to dovecot %s socket at '%s'. error was '%s'", socket_type, socket_path or socket_info, err);
    65 		return false, "error connecting to dovecot "..tostring(socket_type).." socket at '"
    66 		return false;
    66 			..tostring(socket_path or socket_info).."'. error was '"..tostring(err).."'";
    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);
       
    99 				conn:close();
    98 				conn:close();
   100 				return false, "dovecot server version is not 1.x. it is "..tostring(major_version)..".x";
    99 				return false, "dovecot server version is not 1.x. it is "..tostring(major_version)..".x";
   101 			end
   100 			end
   102 		elseif first == "MECH" then
   101 		elseif first == "MECH" then
   103 			local mech = parts();
   102 			local mech = parts();