From cc4d393152cd39194793d61f811988ce9e7310b6 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Mon, 28 Mar 2016 02:19:34 -0500 Subject: [PATCH] ircd/authd: implement client noticing --- ircd/authd.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/ircd/authd.c b/ircd/authd.c index cfbbb52f..5d4a7f8f 100644 --- a/ircd/authd.c +++ b/ircd/authd.c @@ -189,7 +189,36 @@ parse_authd_reply(rb_helper * helper) rb_free(id); authd_decide_client(client_p, parv[3], parv[4], false, toupper(*parv[2]), parv[5], parv[6]); - return; + break; + case 'N': /* Notice to client */ + if(parv != 3) + { + iwarn("authd sent us a result with wrong number of arguments: got %d", parc); + restart_authd(); + return; + } + + if((lcid = strtol(parv[1], NULL, 16)) > UINT32_MAX) + { + iwarn("authd sent us back a bad client ID"); + restart_authd(); + return; + } + + /* cid to uid */ + if((id = rb_dictionary_retrieve(cid_clients, RB_UINT_TO_POINTER((uint32_t)lcid))) == NULL) + { + iwarn("authd sent us back an unknown client ID"); + restart_authd(); + return; + } + + if((client_p = find_id(id)) == NULL) + /* Client vanished... we'll let the timeout code handle it */ + return; + + sendto_one_notice(client_p, ":%s", parv[2]); + break; case 'E': /* DNS Result */ if(parc != 5) {