From: Aki Tuomi Date: Thu, 8 Jun 2017 09:18:30 +0000 (+0300) Subject: lib-auth: Require being connected before adding requests X-Git-Tag: 2.3.1~51 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5403eb2c169ef87d6cc6f7ecbf453f2a012fb900;p=thirdparty%2Fdovecot%2Fcore.git lib-auth: Require being connected before adding requests --- diff --git a/src/lib-auth/auth-server-connection.c b/src/lib-auth/auth-server-connection.c index 687ca01409..7eea061cad 100644 --- a/src/lib-auth/auth-server-connection.c +++ b/src/lib-auth/auth-server-connection.c @@ -472,6 +472,8 @@ auth_server_connection_add_request(struct auth_server_connection *conn, { unsigned int id; + i_assert(conn->handshake_received); + id = ++conn->client->request_id_counter; if (id == 0) { /* wrapped - ID 0 not allowed */ diff --git a/src/lib-auth/auth-server-connection.h b/src/lib-auth/auth-server-connection.h index 988fbfa435..c2c533a41d 100644 --- a/src/lib-auth/auth-server-connection.h +++ b/src/lib-auth/auth-server-connection.h @@ -36,6 +36,7 @@ int auth_server_connection_connect(struct auth_server_connection *conn); void auth_server_connection_disconnect(struct auth_server_connection *conn, const char *reason); +/* Queues a new request. Must not be called if connection is not connected. */ unsigned int auth_server_connection_add_request(struct auth_server_connection *conn, struct auth_client_request *request);