X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fsmtp%2Fsmtp_clienthandlers.c;h=198649e1f2c00522b2f738b7ee04cbf15e1840ef;hb=b26e3e79fcb15dc1b46f4c7710a6bafdc6472950;hp=70373a89623d7a51ed115d600a2196c06e9a4743;hpb=32529f8b8c0e1d3044d28f6694a99e30a214db5d;p=citadel.git diff --git a/citadel/modules/smtp/smtp_clienthandlers.c b/citadel/modules/smtp/smtp_clienthandlers.c index 70373a896..198649e1f 100644 --- a/citadel/modules/smtp/smtp_clienthandlers.c +++ b/citadel/modules/smtp/smtp_clienthandlers.c @@ -166,6 +166,11 @@ eNextState SMTPC_read_EHLO_reply(SmtpOutMsg *Msg) { if (strstr(ChrPtr(Msg->IO.IOBuf), "LOGIN") != NULL) Msg->SendLogin = 1; + else if ((Msg->MultiLineBuf != NULL) && + strstr(ChrPtr(Msg->MultiLineBuf), "LOGIN") != NULL) + { + Msg->SendLogin = 1; + } } } /* else we fall back to 'helo' */ @@ -229,10 +234,14 @@ eNextState SMTPC_send_auth(SmtpOutMsg *Msg) Msg->pCurrRelay->User, '\0', Msg->pCurrRelay->Pass); - CtdlEncodeBase64(encoded, buf, - strlen(Msg->pCurrRelay->User) * 2 + - strlen(Msg->pCurrRelay->Pass) + 2, 0); - + size_t len = CtdlEncodeBase64(encoded, buf, + strlen(Msg->pCurrRelay->User) * 2 + + strlen(Msg->pCurrRelay->Pass) + 2, 0); + + if (buf[len - 1] == '\n') { + buf[len - 1] = '\0'; + } + StrBufPrintf(Msg->IO.SendBuf.Buf, "AUTH PLAIN %s\r\n", encoded); @@ -284,6 +293,10 @@ eNextState SMTPC_send_authplain_1(SmtpOutMsg *Msg) Msg->pCurrRelay->User, strlen(Msg->pCurrRelay->User), 0); + if (encoded[encodedlen - 1] == '\n') { + encodedlen --; + encoded[encodedlen] = '\0'; + } StrBufPlain(Msg->IO.SendBuf.Buf, encoded, @@ -321,10 +334,15 @@ eNextState SMTPC_send_authplain_2(SmtpOutMsg *Msg) encodedlen = CtdlEncodeBase64( encoded, - Msg->pCurrRelay->User, - strlen(Msg->pCurrRelay->User), + Msg->pCurrRelay->Pass, + strlen(Msg->pCurrRelay->Pass), 0); + if (encoded[encodedlen - 1] == '\n') { + encodedlen --; + encoded[encodedlen] = '\0'; + } + StrBufPlain(Msg->IO.SendBuf.Buf, encoded, encodedlen);