From dbeda234e6b70b6479f5be8331bfe6661243bbf7 Mon Sep 17 00:00:00 2001 From: Ed Kellett Date: Sat, 27 Jul 2019 13:50:53 +0100 Subject: [PATCH] override: always check oper:override It's possible to have the oper:override privilege removed by /grant. /grant triggers an empty umode change event to allow privileged umodes to be set or removed, so checking for oper:override on all umode changes (and not just ones where +o or +p is changed) allows us to remove +p when necessary. --- extensions/override.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/extensions/override.c b/extensions/override.c index 4df177a0..6f679e92 100644 --- a/extensions/override.c +++ b/extensions/override.c @@ -108,6 +108,7 @@ static void check_umode_change(void *vdata) { hook_data_umode_changed *data = (hook_data_umode_changed *)vdata; + bool changed = false; struct Client *source_p = data->client; if (!MyClient(source_p)) @@ -116,9 +117,7 @@ check_umode_change(void *vdata) if (data->oldumodes & UMODE_OPER && !IsOper(source_p)) source_p->umodes &= ~user_modes['p']; - /* didn't change +p umode, we don't need to do anything */ - if (!((data->oldumodes ^ source_p->umodes) & user_modes['p'])) - return; + changed = ((data->oldumodes ^ source_p->umodes) & user_modes['p']); if (source_p->umodes & user_modes['p']) { @@ -129,12 +128,14 @@ check_umode_change(void *vdata) return; } - update_session_deadline(source_p, NULL); - - sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s has enabled oper-override (+p)", - get_oper_name(source_p)); + if (changed) + { + update_session_deadline(source_p, NULL); + sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s has enabled oper-override (+p)", + get_oper_name(source_p)); + } } - else if (!(source_p->umodes & user_modes['p'])) + else if (changed && !(source_p->umodes & user_modes['p'])) { rb_dlink_node *n, *tn;