Skip to content

Commit

Permalink
master: test-auth-client - Add handshake disconnect test.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanbosch committed Mar 8, 2019
1 parent 1c04f94 commit b52e1dc
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/master/test-auth-client.c
Expand Up @@ -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));

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b52e1dc

Please sign in to comment.