X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=citadel%2Fmodules%2Fsmtp%2Fsmtp_clienthandlers.c;fp=citadel%2Fmodules%2Fsmtp%2Fsmtp_clienthandlers.c;h=198649e1f2c00522b2f738b7ee04cbf15e1840ef;hp=bbdbc4684f95131d5e3fa992828ef35da34722ef;hb=b26e3e79fcb15dc1b46f4c7710a6bafdc6472950;hpb=128563fad091fb8cb0a01bb5300ae7842c76f253 diff --git a/citadel/modules/smtp/smtp_clienthandlers.c b/citadel/modules/smtp/smtp_clienthandlers.c index bbdbc4684..198649e1f 100644 --- a/citadel/modules/smtp/smtp_clienthandlers.c +++ b/citadel/modules/smtp/smtp_clienthandlers.c @@ -234,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); @@ -289,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, @@ -330,6 +338,11 @@ eNextState SMTPC_send_authplain_2(SmtpOutMsg *Msg) strlen(Msg->pCurrRelay->Pass), 0); + if (encoded[encodedlen - 1] == '\n') { + encodedlen --; + encoded[encodedlen] = '\0'; + } + StrBufPlain(Msg->IO.SendBuf.Buf, encoded, encodedlen);