0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 19:28:52 +02:00

authd: fix reference far off the end of the array on shutdown

When authd has no more input it tries to reject all current clients with
an id of UINT32_MAX.
This commit is contained in:
Simon Arlott 2016-05-01 11:50:26 +01:00
parent 2f598dacdd
commit 84d0b55e76
No known key found for this signature in database
GPG key ID: C8975F2043CA5D24

View file

@ -204,8 +204,7 @@ cancel_providers(struct auth_client *auth)
}
}
/* Provider is done
* WARNING: do not use auth instance after calling! */
/* Provider is done */
void
provider_done(struct auth_client *auth, uint32_t id)
{
@ -234,8 +233,7 @@ provider_done(struct auth_client *auth, uint32_t id)
}
}
/* Reject a client and cancel any outstanding providers
* WARNING: do not use auth instance after calling! */
/* Reject a client and cancel any outstanding providers */
void
reject_client(struct auth_client *auth, uint32_t id, const char *data, const char *fmt, ...)
{
@ -251,7 +249,7 @@ reject_client(struct auth_client *auth, uint32_t id, const char *data, const cha
* --Elizafox
*/
rb_helper_write(authd_helper, "R %x %c %s %s %s :%s",
auth->cid, auth->data[id].provider->letter,
auth->cid, id != UINT32_MAX ? auth->data[id].provider->letter : '*',
auth->username, auth->hostname,
data == NULL ? "*" : data, buf);