Skip to content

Commit

Permalink
lib-master: master-login-auth - Make sure connection is disconnected …
Browse files Browse the repository at this point in the history
…upon error.
  • Loading branch information
stephanbosch committed Mar 8, 2019
1 parent 41f08b2 commit 60282f0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/lib-master/master-login-auth.c
Expand Up @@ -183,6 +183,8 @@ master_login_auth_fail(struct master_login_auth *auth,
if (reason == NULL)
reason = "Disconnected from auth server, aborting";

if (auth->connected)
connection_disconnect(&auth->conn);
auth->connected = FALSE;

while (auth->request_head != NULL) {
Expand All @@ -202,7 +204,6 @@ master_login_auth_fail(struct master_login_auth *auth,

void master_login_auth_disconnect(struct master_login_auth *auth)
{
connection_disconnect(&auth->conn);
master_login_auth_fail(auth, NULL);
}

Expand Down Expand Up @@ -245,8 +246,6 @@ static void master_login_auth_destroy(struct connection *_conn)
struct master_login_auth *auth =
container_of(_conn, struct master_login_auth, conn);

auth->connected = FALSE;

switch (_conn->disconnect_reason) {
case CONNECTION_DISCONNECT_HANDSHAKE_FAILED:
master_login_auth_fail(auth,
Expand Down

0 comments on commit 60282f0

Please sign in to comment.