From 7d84719d682b3ac00ae9fb46010e01bb77f711f6 Mon Sep 17 00:00:00 2001 From: Ed Kellett Date: Sat, 24 Oct 2020 23:49:28 +0100 Subject: [PATCH] Unify oper:{global,local}_kill --- doc/ircd.conf.example | 4 ++-- doc/reference.conf | 7 +++---- help/opers/kill | 3 +-- include/s_newconf.h | 9 ++++----- modules/core/m_kill.c | 12 ++---------- testsuite/ircd.conf.1 | 4 ++-- testsuite/ircd.conf.2 | 4 ++-- testsuite/ircd.conf.3 | 4 ++-- 8 files changed, 18 insertions(+), 29 deletions(-) diff --git a/doc/ircd.conf.example b/doc/ircd.conf.example index 8771f232..f45aa4dc 100644 --- a/doc/ircd.conf.example +++ b/doc/ircd.conf.example @@ -236,7 +236,7 @@ auth { * means they must be defined before operator {}. */ privset "local_op" { - privs = oper:general, oper:privs, oper:testline, oper:local_kill, oper:operwall, usermode:servnotice, + privs = oper:general, oper:privs, oper:testline, oper:kill, oper:operwall, usermode:servnotice, auspex:oper, auspex:hostname, auspex:umodes, auspex:cmodes; }; @@ -247,7 +247,7 @@ privset "server_bot" { privset "global_op" { extends = "local_op"; - privs = oper:global_kill, oper:routing, oper:kline, oper:unkline, oper:xline, + privs = oper:routing, oper:kline, oper:unkline, oper:xline, oper:resv, oper:cmodes, oper:mass_notice, oper:remoteban; }; diff --git a/doc/reference.conf b/doc/reference.conf index a6b4d7cb..0f3e1af7 100644 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -441,8 +441,7 @@ privset "local_op" { * auspex:hostname: shows hidden hostnames/ips * oper:privs: allows /stats o/O and seeing privset in /whois * oper:testline: allows /testline and /testgecos - * oper:local_kill: allows local users to be /KILL'd - * oper:global_kill: allows local and remote users to be /KILL'd + * oper:kill: allows local and remote users to be /KILL'd * oper:routing: allows remote SQUIT and CONNECT * oper:kline: allows KLINE and DLINE * oper:unkline: allows UNKLINE and UNDLINE @@ -475,7 +474,7 @@ privset "local_op" { * confers the benefits of chmode +M (operpeace) (from extensions/chm_operpeace) * usermode:helpops allows setting +H (from extensions/helpops) */ - privs = oper:general, oper:privs, oper:testline, oper:local_kill, oper:operwall, usermode:servnotice, + privs = oper:general, oper:privs, oper:testline, oper:kill, oper:operwall, usermode:servnotice, auspex:oper, auspex:hostname, auspex:umodes, auspex:cmodes; }; @@ -487,7 +486,7 @@ privset "server_bot" { privset "global_op" { extends = "local_op"; - privs = oper:global_kill, oper:routing, oper:kline, oper:unkline, oper:xline, + privs = oper:routing, oper:kline, oper:unkline, oper:xline, oper:resv, oper:cmodes, oper:mass_notice, oper:remoteban; }; diff --git a/help/opers/kill b/help/opers/kill index 3e617ffd..91f6ecf6 100644 --- a/help/opers/kill +++ b/help/opers/kill @@ -3,5 +3,4 @@ KILL Disconnects user from the IRC server he/she is connected to with reason . -- Requires Oper Priv: oper:local_kill -- Requires Oper Priv: oper:global_kill for users not on your IRC server +- Requires Oper Priv: oper:kill diff --git a/include/s_newconf.h b/include/s_newconf.h index 1322d671..eab53819 100644 --- a/include/s_newconf.h +++ b/include/s_newconf.h @@ -149,8 +149,7 @@ extern void cluster_generic(struct Client *, const char *, int cltype, #define HasPrivilege(x, y) ((x)->user != NULL && (x)->user->privset != NULL && privilegeset_in_set((x)->user->privset, (y))) #define MayHavePrivilege(x, y) (HasPrivilege((x), (y)) || (IsOper((x)) && (x)->user != NULL && (x)->user->privset == NULL)) -#define IsOperGlobalKill(x) (HasPrivilege((x), "oper:global_kill")) -#define IsOperLocalKill(x) (HasPrivilege((x), "oper:local_kill")) +#define IsOperKill(x) (HasPrivilege((x), "oper:kill")) #define IsOperRemote(x) (HasPrivilege((x), "oper:routing")) #define IsOperUnkline(x) (HasPrivilege((x), "oper:unkline")) #define IsOperN(x) (HasPrivilege((x), "snomask:nick_changes")) @@ -164,9 +163,9 @@ extern void cluster_generic(struct Client *, const char *, int cltype, #define IsOperOperwall(x) (HasPrivilege((x), "oper:operwall")) #define IsOperSpy(x) (HasPrivilege((x), "oper:spy")) #define IsOperInvis(x) (HasPrivilege((x), "oper:hidden")) -#define IsOperRemoteBan(x) (HasPrivilege((x), "oper:remoteban")) -#define IsOperMassNotice(x) (HasPrivilege((x), "oper:mass_notice")) -#define IsOperGeneral(x) (MayHavePrivilege((x), "oper:general")) +#define IsOperRemoteBan(x) (HasPrivilege((x), "oper:remoteban")) +#define IsOperMassNotice(x) (HasPrivilege((x), "oper:mass_notice")) +#define IsOperGeneral(x) (MayHavePrivilege((x), "oper:general")) #define SeesOper(target, source) (IsOper((target)) && ((!ConfigFileEntry.hide_opers && !HasPrivilege((target), "oper:hidden")) || HasPrivilege((source), "auspex:oper"))) diff --git a/modules/core/m_kill.c b/modules/core/m_kill.c index dd4e71d5..060310bc 100644 --- a/modules/core/m_kill.c +++ b/modules/core/m_kill.c @@ -78,9 +78,9 @@ mo_kill(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ user = parv[1]; - if(!IsOperLocalKill(source_p)) + if(!IsOperKill(source_p)) { - sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "local_kill"); + sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "kill"); return; } @@ -114,14 +114,6 @@ mo_kill(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ sendto_one_notice(source_p, ":KILL changed from %s to %s", user, target_p->name); } - if(!MyConnect(target_p) && (!IsOperGlobalKill(source_p))) - { - sendto_one_notice(source_p, ":Nick %s is not on your server " - "and you do not have the global_kill flag", - target_p->name); - return; - } - /* Last chance to stop the kill */ moduledata.client = source_p; moduledata.target = target_p; diff --git a/testsuite/ircd.conf.1 b/testsuite/ircd.conf.1 index 47944450..b90b78ae 100644 --- a/testsuite/ircd.conf.1 +++ b/testsuite/ircd.conf.1 @@ -43,8 +43,8 @@ auth { user = "*@127.0.0.0/8"; class = "users"; }; operator "oper" { user = "*@127.0.0.0/8"; - password = "oper"; - flags = global_kill, remote, kline, unkline, nick_changes, + password = "oper"; + flags = kill, remote, kline, unkline, nick_changes, die, rehash, admin, xline, operwall, oper_spy, ~encrypted; }; diff --git a/testsuite/ircd.conf.2 b/testsuite/ircd.conf.2 index 23cbfcb9..9149aec7 100644 --- a/testsuite/ircd.conf.2 +++ b/testsuite/ircd.conf.2 @@ -43,8 +43,8 @@ auth { user = "*@127.0.0.0/8"; class = "users"; }; operator "oper" { user = "*@127.0.0.0/8"; - password = "oper"; - flags = global_kill, remote, kline, unkline, nick_changes, + password = "oper"; + flags = kill, remote, kline, unkline, nick_changes, die, rehash, admin, xline, operwall, oper_spy, ~encrypted; }; diff --git a/testsuite/ircd.conf.3 b/testsuite/ircd.conf.3 index ebe28986..4cf2fe25 100644 --- a/testsuite/ircd.conf.3 +++ b/testsuite/ircd.conf.3 @@ -43,8 +43,8 @@ auth { user = "*@127.0.0.0/8"; class = "users"; }; operator "oper" { user = "*@127.0.0.0/8"; - password = "oper"; - flags = global_kill, remote, kline, unkline, nick_changes, + password = "oper"; + flags = kill, remote, kline, unkline, nick_changes, die, rehash, admin, xline, operwall, oper_spy, ~encrypted; };