m_sasl: check if the agent is present after every client_exit

When a server disconnects the client_exit hook will only be called once
but there could be multiple servers and clients behind that server.

After any client exits, check if the agent is still present.
This commit is contained in:
Simon Arlott 2018-08-12 12:16:51 +01:00
parent bfd95f010b
commit 15b05f95f0
No known key found for this signature in database
GPG key ID: 49BFFEEFD4C3ED53
4 changed files with 52 additions and 18 deletions

View file

@ -1626,6 +1626,8 @@ exit_client(struct Client *client_p, /* The local client originating the
const char *comment /* Reason for the exit */
)
{
int ret = -1;
hook_data_client_exit hdata;
if(IsClosing(source_p))
return -1;
@ -1646,23 +1648,25 @@ exit_client(struct Client *client_p, /* The local client originating the
{
/* Local clients of various types */
if(IsPerson(source_p))
return exit_local_client(client_p, source_p, from, comment);
ret = exit_local_client(client_p, source_p, from, comment);
else if(IsServer(source_p))
return exit_local_server(client_p, source_p, from, comment);
ret = exit_local_server(client_p, source_p, from, comment);
/* IsUnknown || IsConnecting || IsHandShake */
else if(!IsReject(source_p))
return exit_unknown_client(client_p, source_p, from, comment);
ret = exit_unknown_client(client_p, source_p, from, comment);
}
else
{
/* Remotes */
if(IsPerson(source_p))
return exit_remote_client(client_p, source_p, from, comment);
ret = exit_remote_client(client_p, source_p, from, comment);
else if(IsServer(source_p))
return exit_remote_server(client_p, source_p, from, comment);
ret = exit_remote_server(client_p, source_p, from, comment);
}
return -1;
call_hook(h_after_client_exit, NULL);
return ret;
}
/*

View file

@ -52,6 +52,7 @@ int h_burst_finished;
int h_server_introduced;
int h_server_eob;
int h_client_exit;
int h_after_client_exit;
int h_umode_changed;
int h_new_local_user;
int h_new_remote_user;
@ -75,6 +76,7 @@ init_hook(void)
h_server_introduced = register_hook("server_introduced");
h_server_eob = register_hook("server_eob");
h_client_exit = register_hook("client_exit");
h_after_client_exit = register_hook("after_client_exit");
h_umode_changed = register_hook("umode_changed");
h_new_local_user = register_hook("new_local_user");
h_new_remote_user = register_hook("new_remote_user");