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.9~2627 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05a4fe649671ac5ca6b3beb085c73e6e85bc4f8b;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 265c6afb44..1e4f09b5fa 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 6fb7aa098d..179b5dbd4c 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);