# HG changeset patch # User andrewhotlab # Date 1576783106 -3600 # Node ID f384669a935990b8e69e35275e610eb7da080510 # Parent 74d7e59b351100f274c7fe0e131f6e7601c6fad0 mod_auth_imap: send CRLF instead LF, in order to be compliant with RFC3501 diff -r 74d7e59b3511 -r f384669a9359 mod_auth_imap/auth_imap/sasl_imap.lib.lua --- 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