Changeset

3763:f384669a9359

mod_auth_imap: send CRLF instead LF, in order to be compliant with RFC3501
author andrewhotlab <andrew.hotlab@hotmail.com>
date Thu, 19 Dec 2019 20:18:26 +0100
parents 3762:74d7e59b3511
children 3764:07a1faa24261
files mod_auth_imap/auth_imap/sasl_imap.lib.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_auth_imap/auth_imap/sasl_imap.lib.lua	Fri Dec 13 12:46:44 2019 +0000
+++ b/mod_auth_imap/auth_imap/sasl_imap.lib.lua	Thu Dec 19 20:18:26 2019 +0100
@@ -85,7 +85,7 @@
 	log("debug", "imap greeting: '%s'", line);
 	local caps = line:match("^%*%s+OK%s+(%b[])");
 	if not caps or not caps:match("^%[CAPABILITY ") then
-		conn:send("A CAPABILITY\n");
+		conn:send("A CAPABILITY\r\n");
 		line = conn:receive("*l");
 		log("debug", "imap capabilities response: '%s'", line);
 		caps = line:match("^%*%s+CAPABILITY%s+(.*)$");
@@ -158,7 +158,7 @@
 		self.selected = mechanism;
 		local selectmsg = t_concat({ self.tag, "AUTHENTICATE", mechanism }, " ");
 		log("debug", "Sending %d bytes: %q", #selectmsg, selectmsg);
-		local ok, err = self.conn:send(selectmsg.."\n");
+		local ok, err = self.conn:send(selectmsg.."\r\n");
 		if not ok then
 			log("error", "Could not write to socket: %s", err);
 			return "failure", "internal-server-error", err
@@ -181,7 +181,7 @@
 		message = message:gsub("^([^%z]*%z[^%z]+)(%z[^%z]+)$", "%1@"..self.realm.."%2");
 	end
 	log("debug", "method:process(%d bytes): %q", #message, message:gsub("%z", "."));
-	local ok, err = self.conn:send(b64(message).."\n");
+	local ok, err = self.conn:send(b64(message).."\r\n");
 	if not ok then
 		log("error", "Could not write to socket: %s", err);
 		return "failure", "internal-server-error", err