Read multiline SMTP-Replies; we need to analyze all of them to detect the proper...
authorWilfried Goesgens <dothebart@citadel.org>
Sun, 20 Oct 2013 21:56:55 +0000 (23:56 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 20 Oct 2013 22:09:01 +0000 (00:09 +0200)
citadel/modules/smtp/serv_smtpeventclient.c
citadel/modules/smtp/smtp_clienthandlers.c
citadel/modules/smtp/smtp_clienthandlers.h

index 209c964b2aff885ef03ee8cd0ba6a61f9b37b024..be573d73a33ca23bbd7766a5cb008133a1cbe856 100644 (file)
@@ -127,6 +127,7 @@ void DeleteSmtpOutMsg(void *v)
                Msg->HostLookup.DNSReplyFree(Msg->HostLookup.VParsedDNSReply);
        FreeURL(&Msg->Relay);
        FreeStrBuf(&Msg->msgtext);
+       FreeStrBuf(&Msg->MultiLineBuf);
        FreeAsyncIOContents(&Msg->IO);
        memset (Msg, 0, sizeof(SmtpOutMsg)); /* just to be shure... */
        free(Msg);
@@ -863,7 +864,16 @@ eReadState SMTP_C_ReadServerStatus(AsyncIO *IO)
                        if (StrLength(IO->IOBuf) < 4)
                                continue;
                        if (ChrPtr(IO->IOBuf)[3] == '-')
+                       {
+                               SmtpOutMsg *Msg;
+                               Msg = (SmtpOutMsg *)IO->Data;
+                               if (Msg->MultiLineBuf == NULL)
+                                       Msg->MultiLineBuf = NewStrBuf ();
+                               else
+                                       StrBufAppendBufPlain(Msg->MultiLineBuf, HKEY("\n"), 0);
+                               StrBufAppendBuf(Msg->MultiLineBuf, IO->IOBuf, 0);
                                Finished = eBufferNotEmpty;
+                       }
                        else
                                return Finished;
                        break;
index 70373a89623d7a51ed115d600a2196c06e9a4743..9e5d6119319a362aa846761dd4e3f89815b671ce 100644 (file)
@@ -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' */
index dedab4ba49b5c8af79e9ed30bdf40b7e21f8e664..28ffac713863213d91c48049bef3a89220cefabc 100644 (file)
@@ -62,6 +62,7 @@ typedef struct _stmp_out_msg {
        ParsedURL *pCurrRelay;
        StrBuf *msgtext;
        StrBuf *QMsgData;
+       StrBuf *MultiLineBuf;
        const char *envelope_from;
 
        char user[1024];