From: Stephan Bosch Date: Mon, 25 May 2020 15:16:30 +0000 (+0200) Subject: lib-smtp: test-smtp-server-errors - Fix "many bad commands" test. X-Git-Tag: 2.3.13~651 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7fa64eb1660341e30d18879f955b68f37016d94d;p=thirdparty%2Fdovecot%2Fcore.git lib-smtp: test-smtp-server-errors - Fix "many bad commands" test. It didn't properly handle the two parallel connections. Removed a useless context struct definition. Modified debug message for easier debugging. --- diff --git a/src/lib-smtp/test-smtp-server-errors.c b/src/lib-smtp/test-smtp-server-errors.c index 86023381b0..ce4e34873c 100644 --- a/src/lib-smtp/test-smtp-server-errors.c +++ b/src/lib-smtp/test-smtp-server-errors.c @@ -582,7 +582,7 @@ test_many_bad_commands_client_input(struct client_connection *conn) while ((ret=smtp_reply_parse_next(ctx->parser, FALSE, &reply, &error)) > 0) { if (debug) - i_debug("REPLY: %s", smtp_reply_log(reply)); + i_debug("REPLY #%u: %s", ctx->reply, smtp_reply_log(reply)); switch (ctx->reply++) { /* greeting */ @@ -651,20 +651,20 @@ static void test_client_many_bad_commands(unsigned int index) /* server */ -struct _many_bad_commands { - struct istream *payload_input; - struct io *io; - - bool serviced:1; -}; - static void test_server_many_bad_commands_disconnect(void *context ATTR_UNUSED, - const char *reason) + const char *reason) { + struct server_connection *sconn = context; + if (debug) i_debug("Disconnect: %s", reason); - io_loop_stop(ioloop); + + sconn->context = POINTER_CAST(POINTER_CAST_TO(sconn->context, + unsigned int) + 1); + + if (POINTER_CAST_TO(sconn->context, unsigned int) == 2) + io_loop_stop(ioloop); } static int