]> granicus.if.org Git - neomutt/commitdiff
Fix imap auth plain
authorRichard Russon <rich@flatcap.org>
Fri, 6 Jul 2018 09:33:25 +0000 (10:33 +0100)
committerRichard Russon <rich@flatcap.org>
Fri, 6 Jul 2018 22:10:31 +0000 (23:10 +0100)
Send the password and `\r\n` as one message.

Fixes #1286

imap/auth_plain.c

index 6b63c39442bc60d5bc2bd33bcdbea4f0068639be..7967d90ef2449c39f4230dc3396a87cf73d81759 100644 (file)
@@ -48,7 +48,7 @@ enum ImapAuthRes imap_auth_plain(struct ImapData *idata, const char *method)
   int rc = IMAP_CMD_CONTINUE;
   enum ImapAuthRes res = IMAP_AUTH_SUCCESS;
   static const char auth_plain_cmd[] = "AUTHENTICATE PLAIN";
-  char buf[STRING];
+  char buf[STRING] = { 0 };
 
   if (mutt_account_getuser(&idata->conn->account) < 0)
     return IMAP_AUTH_FAILURE;
@@ -77,8 +77,8 @@ enum ImapAuthRes imap_auth_plain(struct ImapData *idata, const char *method)
     }
     if (rc == IMAP_CMD_RESPOND)
     {
+      mutt_str_strcat(buf + sizeof(auth_plain_cmd), sizeof(buf) - sizeof(auth_plain_cmd), "\r\n");
       mutt_socket_send(idata->conn, buf + sizeof(auth_plain_cmd));
-      mutt_socket_send(idata->conn, "\r\n");
     }
   }