struct ssl_iostream *ssl_iostream;
enum server_connection_state state;
+ unsigned int rcpt_idx;
char *file_path;
struct istream *dot_input;
static struct connection_list *server_conn_list;
static unsigned int server_index;
struct ssl_iostream_context *server_ssl_ctx = NULL;
+enum smtp_protocol test_server_protocol = SMTP_PROTOCOL_SMTP;
bool test_server_ssl = FALSE;
static void (*test_server_input)(struct server_connection *conn);
static int
static int
test_unexpected_reply_input_line(struct server_connection *conn,
- const char *line ATTR_UNUSED)
+ const char *line)
{
switch (conn->state) {
case SERVER_CONNECTION_STATE_EHLO:
server_connection_deinit(&conn);
return -1;
}
- break;
+ if (str_begins_with(line, "RCPT "))
+ break;
+ conn->state = SERVER_CONNECTION_STATE_DATA;
+ /* Fall through */
case SERVER_CONNECTION_STATE_DATA:
if (server_index == 1) {
o_stream_nsend_str(
server_connection_deinit(&conn);
return -1;
}
- break;
+ if (str_begins_with(line, "RCPT "))
+ break;
+ conn->state = SERVER_CONNECTION_STATE_DATA;
+ /* Fall through */
case SERVER_CONNECTION_STATE_DATA:
if (server_index == 1) {
o_stream_nsend_str(
/* server */
static int
-test_early_data_reply_input_line(struct server_connection *conn ATTR_UNUSED,
+test_early_data_reply_input_line(struct server_connection *conn,
const char *line)
{
if (debug)
i_debug("[%u] GOT LINE: %s", server_index, line);
switch (conn->state) {
+ case SERVER_CONNECTION_STATE_RCPT_TO:
+ if (str_begins_with(line, "RCPT "))
+ return 0;
+ conn->state = SERVER_CONNECTION_STATE_DATA;
+ /* Fall through */
case SERVER_CONNECTION_STATE_DATA:
break;
default:
static int
test_transaction_timeout_input_line(struct server_connection *conn,
- const char *line ATTR_UNUSED)
+ const char *line)
{
switch (conn->state) {
case SERVER_CONNECTION_STATE_EHLO:
i_sleep_intr_secs(20);
break;
case SERVER_CONNECTION_STATE_RCPT_TO:
- if (server_index == 1)
- i_sleep_intr_secs(20);
- break;
+ if (str_begins_with(line, "RCPT ")) {
+ if (server_index == 1)
+ i_sleep_intr_secs(20);
+ break;
+ }
+ conn->state = SERVER_CONNECTION_STATE_DATA;
+ /* Fall through */
case SERVER_CONNECTION_STATE_DATA:
if (server_index == 2)
i_sleep_intr_secs(20);
return;
}
- o_stream_nsend_str(
- conn->conn.output,
- "250 2.0.0 Ok: queued as 73BDE342129\r\n");
+ unsigned int i, replies = 1;
+
+ if (test_server_protocol == SMTP_PROTOCOL_LMTP)
+ replies = conn->rcpt_idx;
+
+ for (i = 0; i < replies; i++) {
+ o_stream_nsend_str(
+ conn->conn.output,
+ "250 2.0.0 Ok: "
+ "queued as 73BDE342129\r\n");
+ }
conn->state = SERVER_CONNECTION_STATE_MAIL_FROM;
continue;
}
conn->state = SERVER_CONNECTION_STATE_RCPT_TO;
continue;
case SERVER_CONNECTION_STATE_RCPT_TO:
- o_stream_nsend_str(conn->conn.output,
- "250 2.1.5 Ok\r\n");
+ if (str_begins_with(line, "RCPT ")) {
+ conn->rcpt_idx++;
+ o_stream_nsend_str(conn->conn.output,
+ "250 2.1.5 Ok\r\n");
+ continue;
+ }
conn->state = SERVER_CONNECTION_STATE_DATA;
- continue;
+ /* Fall through */
case SERVER_CONNECTION_STATE_DATA:
o_stream_nsend_str(
conn->conn.output,