From 84d0b55e7646ddde7c475e6807542bcda2b6e08f Mon Sep 17 00:00:00 2001 From: Simon Arlott Date: Sun, 1 May 2016 11:50:26 +0100 Subject: [PATCH] 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. --- authd/provider.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/authd/provider.c b/authd/provider.c index 49fd5007..9a1e5f2d 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -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);