/* Copyright (c) 2009-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "ioloop.h"
#include "net.h"
#include "istream.h"
#include "ostream.h"
#include "str.h"
#include "dns-lookup.h"
#include "smtp-common.h"
#include "smtp-address.h"
#include "smtp-params.h"
#include "smtp-client-private.h"
#include "smtp-client-command.h"
#include "smtp-client-transaction.h"
#include <ctype.h>
const char *const smtp_client_transaction_state_names[] = {
"new",
"mail_from",
"rcpt_to",
"data",
"finished",
"aborted"
};
static void
static void
/*
* Recipient
*/
static struct smtp_client_transaction_rcpt *
struct smtp_client_transaction *trans,
const struct smtp_address *rcpt_to,
const struct smtp_params_rcpt *rcpt_params)
{
return rcpt;
}
static void
struct smtp_client_transaction_rcpt **_rcpt)
{
/* recipient failed */
}
static void
struct smtp_client_transaction_rcpt *prcpt)
{
unsigned int count;
if (trans->rcpts_next_send_idx > 0)
}
static void
struct smtp_client_transaction_rcpt **_prcpt)
{
/* move to transaction pool */
/* recipient is approved */
/* not pending anymore */
}
static void
struct smtp_client_transaction_rcpt **_prcpt)
{
/* not pending anymore */
}
/*
* Transaction
*/
const char *format, ...)
{
i_debug("%s-client: conn %s: transaction: %s",
}
}
/*
*
*/
struct smtp_client_transaction *
const struct smtp_address *mail_from,
const struct smtp_params_mail *mail_params,
unsigned int flags ATTR_UNUSED,
{
return trans;
}
static void
{
return;
if (!trans->submitted_data)
}
{
unsigned int i, count;
/* clean up */
/* abort any pending commands */
for (i = 0; i < count; i++) {
}
}
/* abort if not finished */
}
}
{
}
{
return;
}
{
}
}
const struct smtp_reply *reply)
{
unsigned int i, count;
/* hold a reference to prevent early destruction in a callback */
}
}
}
for (i = 0; i < count; i++) {
continue;
} else {
}
}
}
if (!trans->data_provided) {
/* smtp_client_transaction_send() was not called yet
*/
/* the DATA command is still pending; handle the failure by
failing the DATA command. */
} else {
/* the DATA command was not sent yet; call all DATA callbacks
for the recipients that were previously accepted. */
}
}
}
if (trans->data_provided) {
/* abort the transaction only if smtp_client_transaction_send()
was called (and if it is not aborted already) */
}
/* drop reference held earlier in this function */
}
{
}
static void
{
"Remote server not answering "
"(transaction timed out while %s)",
}
unsigned int timeout_msecs)
{
/* adjust timeout if it is already started */
}
}
static void
struct smtp_client_transaction *trans)
{
/* plug command line pipeline if no RCPT commands are yet issued */
}
return;
}
if (!success)
}
static void smtp_client_transaction_connection_ready(
struct smtp_client_transaction *trans)
{
return;
"Connecton is ready for transaction");
}
struct smtp_client_transaction *trans,
{
}
static void
struct smtp_client_transaction_rcpt *rcpt)
{
/* plug command line pipeline if DATA command is not yet issued */
}
if (success)
else
/* abort DATA command if all recipients failed */
}
}
}
static void
{
unsigned int count;
return;
}
return;
}
return;
unsigned int i;
}
trans->rcpts_next_send_idx = i;
}
}
}
struct smtp_client_transaction *trans,
const struct smtp_address *rcpt_to,
const struct smtp_params_rcpt *rcpt_params,
{
}
}
static void
struct smtp_client_transaction *trans)
{
unsigned int i, count;
break;
}
return;
}
/* finished */
}
static void
{
} else {
}
/* Submitted our last command; the next transaction can submit
its commands now. */
}
if (finished)
}
{
}
if (trans->finish_timeout_msecs > 0) {
}
}
struct smtp_client_transaction *trans,
const struct smtp_reply *reply)
{
if (!smtp_reply_is_success(reply)) {
} else {
}
return;
}
}
const struct smtp_client_transaction_times *
{
}
{
}
const char *
{
}
const char *
struct smtp_client_transaction *trans)
{
break;
switch (conn_state) {
return "waiting for connection";
default:
break;
}
break;
return "waiting for reply to MAIL FROM";
return "waiting for reply to RCPT TO";
return "waiting for reply to DATA";
return "finished";
return "aborted";
}
i_unreached();
}
struct smtp_client_transaction *trans)
{
}