From b52e1dc20b12373d30b899d50e3941f0a01299db Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Wed, 6 Mar 2019 23:34:56 +0100 Subject: [PATCH] master: test-auth-client - Add handshake disconnect test. --- src/master/test-auth-client.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/master/test-auth-client.c b/src/master/test-auth-client.c index c8ca71a4f0..940bf738c2 100644 --- a/src/master/test-auth-client.c +++ b/src/master/test-auth-client.c @@ -361,6 +361,8 @@ test_auth_handshake_auth_plain(struct server_connection *conn, unsigned int id, t_strdup_printf("OK\t%u\tuser=harrie\n", id)); return TRUE; } + if (strcmp(authenid, "hendrik") == 0) + return FALSE; o_stream_nsend_str(conn->conn.output, t_strdup_printf("FAIL\t%u\tuser=%s\n", id, authenid)); @@ -602,6 +604,20 @@ static void test_server_auth_handshake(void) /* client */ +static bool +test_client_auth_plain_disconnect(void) +{ + const char *error; + int ret; + + ret = test_client_auth_simple("PLAIN", "hendrik", "frop", FALSE, + &error); + test_out("run (ret < 0)", ret < 0); + test_assert(error != NULL && strstr(error, "Internal failure") != NULL); + + return FALSE; +} + static bool test_client_auth_plain_failure(void) { @@ -742,6 +758,12 @@ test_client_auth_login_parallel_success(void) static void test_auth_handshake(void) { + test_begin("auth PLAIN disconnect"); + test_expect_errors(1); + test_run_client_server(test_client_auth_plain_disconnect, + test_server_auth_handshake); + test_end(); + test_begin("auth PLAIN failure"); test_run_client_server(test_client_auth_plain_failure, test_server_auth_handshake);