smtp-server-cmd-rcpt.c revision 4dd460cf19f1df3b51090427fea87e9c4b73c6d4
/* Copyright (c) 2013-2017 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "array.h"
#include "smtp-parser.h"
#include "smtp-address.h"
#include "smtp-reply.h"
#include "smtp-syntax.h"
#include "smtp-server-private.h"
/* RCPT command */
static bool
{
}
503, "5.5.0", "MAIL needed first");
return FALSE;
}
451, "4.5.3", "Too many recipients");
return FALSE;
}
return TRUE;
}
{
struct smtp_server_cmd_rcpt *data =
struct smtp_server_recipient *rcpt;
return;
/* success */
}
}
{
/* failure; substitute our own error if predictable */
(void)cmd_rcpt_check_state(cmd);
return;
}
}
{
/* all preceeding commands have finished and now the transaction state
is clear. This provides the opportunity to re-check the transaction
state and abort the pending proxied mail command if it is bound to
fail */
if (!cmd_rcpt_check_state(cmd))
return;
/* Advance state */
}
const char *params)
{
struct smtp_server_cmd_rcpt *rcpt_data;
struct smtp_address *path;
const char *error;
int ret;
/* rcpt = "RCPT TO:" ( "<Postmaster@" Domain ">" /
"<Postmaster>" / Forward-path ) [SP Rcpt-parameters] CRLF
Forward-path = Path
*/
/* check transaction state as far as possible */
if (!cmd_rcpt_check_state(cmd))
return;
/* ( "<Postmaster@" Domain ">" / "<Postmaster>" / Forward-path ) */
501, "5.5.4", "Invalid parameters");
return;
}
return;
}
if (*params == ' ')
params++;
else if (*params != '\0') {
"Invalid TO: Invalid character in path");
return;
}
501, "5.5.4", "Invalid TO: Missing domain");
return;
}
/* [SP Rcpt-parameters] */
switch (pperror) {
break;
break;
default:
i_unreached();
}
return;
}
/* command is waiting for external event or it failed */
return;
}
if (!smtp_server_command_is_replied(command)) {
/* set generic RCPT success reply if none is provided */
250, "2.1.5", "OK");
}
}