+ if (Msg->SendLogin)
+ {
+ if (!SMTP_IS_STATE('3'))
+ SMTP_VERROR(5);
+ }
+ else
+ {
+ if (!SMTP_IS_STATE('2')) {
+ if (SMTP_IS_STATE('4'))
+ SMTP_VERROR(4);
+ else
+ SMTP_VERROR(5);
+ }
+ READ_NEXT_STATE(eFROM);
+ }
+ return eSendReply;
+}
+
+
+eNextState SMTPC_send_authplain_1(SmtpOutMsg *Msg)
+{
+ AsyncIO *IO = &Msg->IO;
+ char buf[SIZ];
+ char encoded[1024];
+ long encodedlen;
+
+ sprintf(buf, "%s",
+ Msg->pCurrRelay->User);
+
+ encodedlen = CtdlEncodeBase64(
+ encoded,
+ Msg->pCurrRelay->User,
+ strlen(Msg->pCurrRelay->User),
+ 0);
+
+ StrBufPlain(Msg->IO.SendBuf.Buf,
+ encoded,
+ encodedlen);
+
+ StrBufAppendBufPlain(Msg->IO.SendBuf.Buf,
+ HKEY("\r\n"), 0);
+
+ SMTP_DBG_SEND();
+
+ return eReadMessage;
+}
+eNextState SMTPC_read_auth_plain_reply_1(SmtpOutMsg *Msg)
+{
+ AsyncIO *IO = &Msg->IO;
+ /* Do an AUTH command if necessary */
+
+ SMTP_DBG_READ();
+
+ if (!SMTP_IS_STATE('3'))
+ SMTP_VERROR(5);
+ return eSendReply;
+}
+
+
+eNextState SMTPC_send_authplain_2(SmtpOutMsg *Msg)
+{
+ AsyncIO *IO = &Msg->IO;
+ char buf[SIZ];
+ char encoded[1024];
+ long encodedlen;
+
+ sprintf(buf, "%s",
+ Msg->pCurrRelay->Pass);
+
+ encodedlen = CtdlEncodeBase64(
+ encoded,
+ Msg->pCurrRelay->User,
+ strlen(Msg->pCurrRelay->User),
+ 0);
+
+ StrBufPlain(Msg->IO.SendBuf.Buf,
+ encoded,
+ encodedlen);
+
+ StrBufAppendBufPlain(Msg->IO.SendBuf.Buf,
+ HKEY("\r\n"), 0);
+
+ SMTP_DBG_SEND();
+
+ return eReadMessage;
+}
+eNextState SMTPC_read_auth_plain_reply_2(SmtpOutMsg *Msg)
+{
+ AsyncIO *IO = &Msg->IO;
+ /* Do an AUTH command if necessary */
+
+ SMTP_DBG_READ();
+