From d4f7eb4ce6a0c5a703ddb0f5f5bfaf5d2037e605 Mon Sep 17 00:00:00 2001 From: Ed Kellett Date: Sun, 7 Jul 2019 05:34:28 +0100 Subject: [PATCH] Replace most checks for +o with oper:general I'm preparing to PR a succession of privs changes with the ultimate goal of severely limiting the scope of the binary oper/user dichotomy and move conceptually distinct oper functions into their own privs. Accomplishing this is a non-trivial task, and can wait, but it's inconvenient now to have such functions enabled by the same mechanism that grants any privs at all--so I'm moving all of them to a transitional priv with the intention of eroding that later. --- doc/ircd.conf.example | 2 +- doc/reference.conf | 4 +++- extensions/createauthonly.c | 3 ++- extensions/createoperonly.c | 3 ++- extensions/force_user_invis.c | 2 +- extensions/hurt.c | 4 ++-- extensions/m_findforwards.c | 2 +- extensions/sno_whois.c | 3 ++- include/client.h | 10 +++------ include/s_newconf.h | 1 + ircd/chmode.c | 4 ++-- ircd/hostmask.c | 3 ++- ircd/packet.c | 5 +++-- ircd/s_conf.c | 2 +- ircd/s_user.c | 5 +++++ modules/core/m_ban.c | 2 +- modules/core/m_join.c | 10 ++++----- modules/core/m_message.c | 6 +++--- modules/core/m_nick.c | 2 +- modules/core/m_part.c | 3 ++- modules/core/m_quit.c | 3 ++- modules/m_away.c | 3 ++- modules/m_info.c | 3 ++- modules/m_invite.c | 3 ++- modules/m_knock.c | 3 ++- modules/m_names.c | 3 ++- modules/m_services.c | 2 +- modules/m_stats.c | 40 +++++++++++++++++------------------ modules/m_topic.c | 2 +- modules/m_trace.c | 2 +- modules/m_who.c | 12 +++++------ modules/m_whois.c | 6 +++--- modules/m_whowas.c | 3 ++- modules/um_callerid.c | 4 ++-- 34 files changed, 91 insertions(+), 74 deletions(-) diff --git a/doc/ircd.conf.example b/doc/ircd.conf.example index 3a37476f..684c3611 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:local_kill, oper:operwall; + privs = oper:general, oper:local_kill, oper:operwall; }; privset "server_bot" { diff --git a/doc/reference.conf b/doc/reference.conf index 9c169bb9..2cef4865 100644 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -430,6 +430,8 @@ privset "local_op" { * * Available options: * + * oper:general: enable most general oper privileges that came + * with +o in older releases * oper:local_kill: allows local users to be /KILL'd * oper:global_kill: allows local and remote users to be /KILL'd * oper:routing: allows remote SQUIT and CONNECT @@ -454,7 +456,7 @@ privset "local_op" { * oper:mass_notice: allows sending wallops and mass notices * oper:grant: allows using the GRANT command */ - privs = oper:local_kill, oper:operwall; + privs = oper:general, oper:local_kill, oper:operwall; }; privset "server_bot" { diff --git a/extensions/createauthonly.c b/extensions/createauthonly.c index dea11a0c..78ad3da2 100644 --- a/extensions/createauthonly.c +++ b/extensions/createauthonly.c @@ -15,6 +15,7 @@ #include "s_conf.h" #include "snomask.h" #include "numeric.h" +#include "s_newconf.h" static const char restrict_desc[] = "Restricts channel creation to authenticated users and IRC operators only"; @@ -32,6 +33,6 @@ h_can_create_channel_authenticated(hook_data_client_approval *data) { struct Client *source_p = data->client; - if (*source_p->user->suser == '\0' && !IsOper(source_p)) + if (*source_p->user->suser == '\0' && !IsOperGeneral(source_p)) data->approved = ERR_NEEDREGGEDNICK; } diff --git a/extensions/createoperonly.c b/extensions/createoperonly.c index f763d676..fb004783 100644 --- a/extensions/createoperonly.c +++ b/extensions/createoperonly.c @@ -15,6 +15,7 @@ #include "s_conf.h" #include "snomask.h" #include "numeric.h" +#include "s_newconf.h" static const char restrict_desc[] = "Restricts channel creation to IRC operators"; @@ -32,7 +33,7 @@ h_can_create_channel_authenticated(hook_data_client_approval *data) { struct Client *source_p = data->client; - if (!IsOper(source_p)) + if (!IsOperGeneral(source_p)) { sendto_one_notice(source_p, ":*** Channel creation is restricted to network staff only."); data->approved = ERR_NEEDREGGEDNICK; diff --git a/extensions/force_user_invis.c b/extensions/force_user_invis.c index 6a53ee5e..8a94d33d 100644 --- a/extensions/force_user_invis.c +++ b/extensions/force_user_invis.c @@ -32,7 +32,7 @@ h_noi_umode_changed(hook_data_umode_changed *hdata) { struct Client *source_p = hdata->client; - if (MyClient(source_p) && !IsOper(source_p) && !IsInvisible(source_p)) { + if (MyClient(source_p) && !IsOperGeneral(source_p) && !IsInvisible(source_p)) { SetInvisible(source_p); } } diff --git a/extensions/hurt.c b/extensions/hurt.c index 9f6ee7ad..2baf3c58 100644 --- a/extensions/hurt.c +++ b/extensions/hurt.c @@ -470,9 +470,9 @@ doing_stats_hook(hook_data_int *hdata) source_p = hdata->client; if(hdata->arg2 != (int) 's') return; - if((ConfigFileEntry.stats_k_oper_only == 2) && !IsOper(source_p)) + if((ConfigFileEntry.stats_k_oper_only == 2) && !IsOperGeneral(source_p)) return; - if ((ConfigFileEntry.stats_k_oper_only == 1) && !IsOper(source_p)) + if ((ConfigFileEntry.stats_k_oper_only == 1) && !IsOperGeneral(source_p)) { hurt = hurt_find(source_p->sockhost); if (hurt != NULL) diff --git a/extensions/m_findforwards.c b/extensions/m_findforwards.c index 422197bf..9be22def 100644 --- a/extensions/m_findforwards.c +++ b/extensions/m_findforwards.c @@ -64,7 +64,7 @@ m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client * *p = '\0'; /* Allow ircops to search for forwards to nonexistent channels */ - if(!IsOper(source_p)) + if(!IsOperGeneral(source_p)) { if((chptr = find_channel(parv[1])) == NULL || (msptr = find_channel_membership(chptr, source_p)) == NULL) { diff --git a/extensions/sno_whois.c b/extensions/sno_whois.c index f5c69d92..eebc4d4e 100644 --- a/extensions/sno_whois.c +++ b/extensions/sno_whois.c @@ -12,6 +12,7 @@ #include "client.h" #include "ircd.h" #include "send.h" +#include "s_newconf.h" /* undefine this to allow anyone to receive whois notifications */ #define OPERONLY @@ -57,7 +58,7 @@ show_whois(hook_data_client *data) if(MyClient(target_p) && #ifdef OPERONLY - IsOper(target_p) && + IsOperGeneral(target_p) && #endif (source_p != target_p) && (target_p->snomask & snomask_modes['W'])) diff --git a/include/client.h b/include/client.h index e43838b9..f1285b18 100644 --- a/include/client.h +++ b/include/client.h @@ -371,7 +371,7 @@ struct ListClient (x)->handler = SERVER_HANDLER; } #define SetClient(x) {(x)->status = STAT_CLIENT; \ - (x)->handler = IsOper((x)) ? \ + (x)->handler = IsOperGeneral((x)) ? \ OPER_HANDLER : CLIENT_HANDLER; } #define SetRemoteClient(x) {(x)->status = STAT_CLIENT; \ (x)->handler = RCLIENT_HANDLER; } @@ -516,12 +516,8 @@ struct ListClient /* oper flags */ #define MyOper(x) (MyConnect(x) && IsOper(x)) -#define SetOper(x) {(x)->umodes |= UMODE_OPER; \ - if (MyClient((x))) (x)->handler = OPER_HANDLER;} - -#define ClearOper(x) {(x)->umodes &= ~(UMODE_OPER|UMODE_ADMIN); \ - if (MyClient((x)) && !IsOper((x)) && !IsServer((x))) \ - (x)->handler = CLIENT_HANDLER; } +#define SetOper(x) ((x)->umodes |= UMODE_OPER) +#define ClearOper(x) ((x)->umodes &= ~(UMODE_OPER|UMODE_ADMIN)) /* umode flags */ #define IsInvisible(x) ((x)->umodes & UMODE_INVISIBLE) diff --git a/include/s_newconf.h b/include/s_newconf.h index 4decc5a3..8f01dbc6 100644 --- a/include/s_newconf.h +++ b/include/s_newconf.h @@ -165,6 +165,7 @@ extern void cluster_generic(struct Client *, const char *, int cltype, #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) (HasPrivilege((x), "oper:general")) #define SeesOper(target, source) (IsOper((target)) && ((!ConfigFileEntry.hide_opers && !HasPrivilege((target), "oper:hidden")) || IsOper((source)))) diff --git a/ircd/chmode.c b/ircd/chmode.c index 591843b5..8b0b98a0 100644 --- a/ircd/chmode.c +++ b/ircd/chmode.c @@ -660,7 +660,7 @@ chm_hidden(struct Client *source_p, struct Channel *chptr, int alevel, int parc, int *parn, const char **parv, int *errors, int dir, char c, long mode_type) { - if(!IsOper(source_p) && !IsServer(source_p)) + if(!IsOperGeneral(source_p) && !IsServer(source_p)) { if(!(*errors & SM_ERR_NOPRIVS)) sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str(ERR_NOPRIVILEGES)); @@ -1269,7 +1269,7 @@ chm_forward(struct Client *source_p, struct Channel *chptr, if(!allow_mode_change(source_p, chptr, alevel, errors, c)) return; #else - if(!IsOper(source_p) && !IsServer(source_p)) + if(!IsOperGeneral(source_p) && !IsServer(source_p)) { if(!(*errors & SM_ERR_NOPRIVS)) sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str(ERR_NOPRIVILEGES)); diff --git a/ircd/hostmask.c b/ircd/hostmask.c index 94214041..922a8d44 100644 --- a/ircd/hostmask.c +++ b/ircd/hostmask.c @@ -26,6 +26,7 @@ #include "stdinc.h" #include "ircd_defs.h" #include "s_conf.h" +#include "s_newconf.h" #include "hostmask.h" #include "numeric.h" #include "send.h" @@ -729,7 +730,7 @@ report_auth(struct Client *client_p) { aconf = arec->aconf; - if(!IsOper(client_p) && IsConfDoSpoofIp(aconf)) + if(!IsOperGeneral(client_p) && IsConfDoSpoofIp(aconf)) continue; get_printable_conf(aconf, &name, &host, &pass, &user, &port, diff --git a/ircd/packet.c b/ircd/packet.c index 502d5344..af3b95da 100644 --- a/ircd/packet.c +++ b/ircd/packet.c @@ -32,6 +32,7 @@ #include "hook.h" #include "send.h" #include "s_assert.h" +#include "s_newconf.h" static char readBuf[READBUF_SIZE]; static void client_dopacket(struct Client *client_p, char *buffer, size_t length); @@ -108,7 +109,7 @@ parse_client_queued(struct Client *client_p) /* allow opers 4 times the amount of messages as users. why 4? * why not. :) --fl_ */ - if(IsOper(client_p) && ConfigFileEntry.no_oper_flood) + if(IsOperGeneral(client_p) && ConfigFileEntry.no_oper_flood) allow_read *= 4; /* * Handle flood protection here - if we exceed our flood limit on @@ -294,7 +295,7 @@ read_packet(rb_fde_t * F, void *data) if(!IsAnyServer(client_p) && (rb_linebuf_alloclen(&client_p->localClient->buf_recvq) > ConfigFileEntry.client_flood_max_lines)) { - if(!(ConfigFileEntry.no_oper_flood && IsOper(client_p))) + if(!(ConfigFileEntry.no_oper_flood && IsOperGeneral(client_p))) { exit_client(client_p, client_p, client_p, "Excess Flood"); return; diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 99eec283..346fe363 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -1381,7 +1381,7 @@ get_printable_kline(struct Client *source_p, struct ConfItem *aconf, *user = EmptyString(aconf->user) ? null : aconf->user; *reason = get_user_ban_reason(aconf); - if(!IsOper(source_p)) + if(!IsOperGeneral(source_p)) *oper_reason = NULL; else { diff --git a/ircd/s_user.c b/ircd/s_user.c index bda9bca8..1b1e748a 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -1237,6 +1237,9 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char source_p->umodes &= ~UMODE_ADMIN; } + if(MyClient(source_p)) + source_p->handler = IsOperGeneral(source_p) ? OPER_HANDLER : CLIENT_HANDLER; + /* let modules providing usermodes know that we've changed our usermode --nenolod */ hdata.client = source_p; hdata.oldumodes = setflags; @@ -1439,6 +1442,8 @@ oper_up(struct Client *source_p, struct oper_conf *oper_p) hdata.oldsnomask = oldsnomask; call_hook(h_umode_changed, &hdata); + source_p->handler = IsOperGeneral(source_p) ? OPER_HANDLER : CLIENT_HANDLER; + sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s (%s!%s@%s) is now an operator", oper_p->name, source_p->name, source_p->username, source_p->host); diff --git a/modules/core/m_ban.c b/modules/core/m_ban.c index 43e6fc9e..b1e738d3 100644 --- a/modules/core/m_ban.c +++ b/modules/core/m_ban.c @@ -64,7 +64,7 @@ m_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, { sendto_one_notice(source_p, ":The BAN command is not user-accessible."); sendto_one_notice(source_p, ":To ban a user from a channel, see /QUOTE HELP CMODE"); - if (IsOper(source_p)) + if (IsOperGeneral(source_p)) sendto_one_notice(source_p, ":To ban a user from a server or from the network, see /QUOTE HELP KLINE"); } diff --git a/modules/core/m_join.c b/modules/core/m_join.c index 4bac3f15..b155677c 100644 --- a/modules/core/m_join.c +++ b/modules/core/m_join.c @@ -209,7 +209,7 @@ m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p continue; } - if(splitmode && !IsOper(source_p) && (*name != '&') && + if(splitmode && !IsOperGeneral(source_p) && (*name != '&') && ConfigChannel.no_join_on_split) { sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE), @@ -269,7 +269,7 @@ m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p continue; } - if(splitmode && !IsOper(source_p) && (*name != '&') && + if(splitmode && !IsOperGeneral(source_p) && (*name != '&') && ConfigChannel.no_create_on_split) { sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE), @@ -320,7 +320,7 @@ m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p chptr = chptr2; if(flags == 0 && - !IsOper(source_p) && !IsExemptSpambot(source_p)) + !IsOperGeneral(source_p) && !IsExemptSpambot(source_p)) check_spambot_warning(source_p, name); /* add the user to the channel */ @@ -966,7 +966,7 @@ do_join_0(struct Client *client_p, struct Client *source_p) while((ptr = source_p->user->channel.head)) { if(MyConnect(source_p) && - !IsOper(source_p) && !IsExemptSpambot(source_p)) + !IsOperGeneral(source_p) && !IsExemptSpambot(source_p)) check_spambot_warning(source_p, NULL); msptr = ptr->data; @@ -987,7 +987,7 @@ check_channel_name_loc(struct Client *source_p, const char *name) if(EmptyString(name)) return false; - if(ConfigFileEntry.disable_fake_channels && !IsOper(source_p)) + if(ConfigFileEntry.disable_fake_channels && !IsOperGeneral(source_p)) { for(p = name; *p; ++p) { diff --git a/modules/core/m_message.c b/modules/core/m_message.c index d146eab8..694ff3ca 100644 --- a/modules/core/m_message.c +++ b/modules/core/m_message.c @@ -513,7 +513,7 @@ msg_channel(enum message_type msgtype, if((result = can_send(chptr, source_p, NULL))) { if(result != CAN_SEND_OPV && MyClient(source_p) && - !IsOper(source_p) && + !IsOperGeneral(source_p) && !add_channel_target(source_p, chptr)) { sendto_one(source_p, form_str(ERR_TARGCHANGE), @@ -531,7 +531,7 @@ msg_channel(enum message_type msgtype, (!(chptr->mode.mode & MODE_NOPRIVMSGS) || IsMember(source_p, chptr))) { - if(MyClient(source_p) && !IsOper(source_p) && + if(MyClient(source_p) && !IsOperGeneral(source_p) && !add_channel_target(source_p, chptr)) { sendto_one(source_p, form_str(ERR_TARGCHANGE), @@ -724,7 +724,7 @@ msg_client(enum message_type msgtype, source_p->localClient->last = rb_current_time(); /* auto cprivmsg/cnotice */ - do_floodcount = !IsOper(source_p) && + do_floodcount = !IsOperGeneral(source_p) && !find_allowing_channel(source_p, target_p); /* target change stuff, dont limit ctcp replies as that diff --git a/modules/core/m_nick.c b/modules/core/m_nick.c index 09d34df8..00f8f6f6 100644 --- a/modules/core/m_nick.c +++ b/modules/core/m_nick.c @@ -642,7 +642,7 @@ change_local_nick(struct Client *client_p, struct Client *source_p, source_p->localClient->last_nick_change = rb_current_time(); source_p->localClient->number_of_nick_changes++; - if(ConfigFileEntry.anti_nick_flood && !IsOper(source_p) && + if(ConfigFileEntry.anti_nick_flood && !IsOperGeneral(source_p) && source_p->localClient->number_of_nick_changes > ConfigFileEntry.max_nick_changes) { sendto_one(source_p, form_str(ERR_NICKTOOFAST), diff --git a/modules/core/m_part.c b/modules/core/m_part.c index 6a778b28..5016f85b 100644 --- a/modules/core/m_part.c +++ b/modules/core/m_part.c @@ -38,6 +38,7 @@ #include "packet.h" #include "inline/stringops.h" #include "hook.h" +#include "s_newconf.h" static const char part_desc[] = "Provides the PART command to leave a channel"; @@ -117,7 +118,7 @@ part_one_client(struct Client *client_p, struct Client *source_p, char *name, co return; } - if(MyConnect(source_p) && !IsOper(source_p) && !IsExemptSpambot(source_p)) + if(MyConnect(source_p) && !IsOperGeneral(source_p) && !IsExemptSpambot(source_p)) check_spambot_warning(source_p, NULL); /* diff --git a/modules/core/m_quit.c b/modules/core/m_quit.c index a986a327..9df243c8 100644 --- a/modules/core/m_quit.c +++ b/modules/core/m_quit.c @@ -33,6 +33,7 @@ #include "modules.h" #include "s_conf.h" #include "inline/stringops.h" +#include "s_newconf.h" static const char quit_desc[] = "Provides the QUIT command to allow a user to leave the network"; @@ -86,7 +87,7 @@ m_quit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p comment = reason; } - if (comment == NULL || (!IsOper(source_p) && hdata.reason == hdata.orig_reason && + if (comment == NULL || (!IsOperGeneral(source_p) && hdata.reason == hdata.orig_reason && (source_p->localClient->firsttime + ConfigFileEntry.anti_spam_exit_message_time) > rb_current_time())) { diff --git a/modules/m_away.c b/modules/m_away.c index 4e20235d..b216fb65 100644 --- a/modules/m_away.c +++ b/modules/m_away.c @@ -34,6 +34,7 @@ #include "s_conf.h" #include "s_serv.h" #include "packet.h" +#include "s_newconf.h" static const char away_desc[] = "Provides the AWAY command to set yourself away"; @@ -97,7 +98,7 @@ m_away(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p /* Rate limit this because it is sent to common channels. */ if (MyClient(source_p)) { - if(!IsOper(source_p) && + if(!IsOperGeneral(source_p) && source_p->localClient->next_away > rb_current_time()) { sendto_one(source_p, form_str(RPL_LOAD2HI), diff --git a/modules/m_info.c b/modules/m_info.c index ef409190..5046a7ff 100644 --- a/modules/m_info.c +++ b/modules/m_info.c @@ -37,6 +37,7 @@ #include "msg.h" #include "parse.h" #include "modules.h" +#include "s_newconf.h" static const char info_desc[] = "Provides the INFO command for retrieving server copyright, credits, and other info"; @@ -716,7 +717,7 @@ mo_info(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ info_spy(source_p); send_info_text(source_p); - if(IsOper(source_p)) + if(IsOperGeneral(source_p)) { send_conf_options(source_p); sendto_one_numeric(source_p, RPL_INFO, ":%s", diff --git a/modules/m_invite.c b/modules/m_invite.c index 0b882aab..e20ea7a7 100644 --- a/modules/m_invite.c +++ b/modules/m_invite.c @@ -37,6 +37,7 @@ #include "modules.h" #include "packet.h" #include "tgchange.h" +#include "s_newconf.h" static const char invite_desc[] = "Provides /invite"; @@ -176,7 +177,7 @@ m_invite(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source if(MyConnect(source_p)) { - if (ConfigFileEntry.target_change && !IsOper(source_p) && + if (ConfigFileEntry.target_change && !IsOperGeneral(source_p) && !find_allowing_channel(source_p, target_p) && !add_target(source_p, target_p)) { diff --git a/modules/m_knock.c b/modules/m_knock.c index 969595de..29cc3e5f 100644 --- a/modules/m_knock.c +++ b/modules/m_knock.c @@ -35,6 +35,7 @@ #include "modules.h" #include "s_serv.h" #include "supported.h" +#include "s_newconf.h" static const char knock_desc[] = "Provides the KNOCK command to ask for an invite to an invite-only channel"; @@ -142,7 +143,7 @@ m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ * allow one knock per user per knock_delay * allow one knock per channel per knock_delay_channel */ - if(!IsOper(source_p) && + if(!IsOperGeneral(source_p) && (source_p->localClient->last_knock + ConfigChannel.knock_delay) > rb_current_time()) { sendto_one(source_p, form_str(ERR_TOOMANYKNOCK), diff --git a/modules/m_names.c b/modules/m_names.c index 026dfd2d..b1e4b279 100644 --- a/modules/m_names.c +++ b/modules/m_names.c @@ -35,6 +35,7 @@ #include "msg.h" #include "parse.h" #include "modules.h" +#include "s_newconf.h" static const char names_desc[] = "Provides the NAMES command to view users on a channel"; @@ -88,7 +89,7 @@ m_names(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ } else { - if(!IsOper(source_p)) + if(!IsOperGeneral(source_p)) { if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) { diff --git a/modules/m_services.c b/modules/m_services.c index 6633319d..af729064 100644 --- a/modules/m_services.c +++ b/modules/m_services.c @@ -334,7 +334,7 @@ h_svc_stats(hook_data_int *data) char statchar = (char) data->arg2; rb_dlink_node *ptr; - if (statchar == 'U' && IsOper(data->client)) + if (statchar == 'U' && IsOperGeneral(data->client)) { RB_DLINK_FOREACH(ptr, service_list.head) { diff --git a/modules/m_stats.c b/modules/m_stats.c index ef255ee9..03a70d6a 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.c @@ -212,7 +212,7 @@ m_stats(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ statchar = parv[1][0]; - if(MyClient(source_p) && !IsOper(source_p) && parc > 2) + if(MyClient(source_p) && !IsOperGeneral(source_p) && parc > 2) { /* Check the user is actually allowed to do /stats, and isnt flooding */ if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) @@ -253,7 +253,7 @@ m_stats(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ me.name, source_p->name, "admin"); goto stats_out; } - if(cmd->need_oper && !IsOper(source_p)) + if(cmd->need_oper && !IsOperGeneral(source_p)) { sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str (ERR_NOPRIVILEGES)); @@ -322,7 +322,7 @@ stats_connect(struct Client *source_p) if((ConfigFileEntry.stats_c_oper_only || (ConfigServerHide.flatten_links && !IsExemptShide(source_p))) && - !IsOper(source_p)) + !IsOperGeneral(source_p)) { sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str(ERR_NOPRIVILEGES)); @@ -338,7 +338,7 @@ stats_connect(struct Client *source_p) s = buf; - if(IsOper(source_p)) + if(IsOperGeneral(source_p)) { if(ServerConfAutoconn(server_p)) *s++ = 'A'; @@ -527,7 +527,7 @@ stats_hubleaf(struct Client *source_p) if((ConfigFileEntry.stats_h_oper_only || (ConfigServerHide.flatten_links && !IsExemptShide(source_p))) && - !IsOper(source_p)) + !IsOperGeneral(source_p)) { sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str (ERR_NOPRIVILEGES)); @@ -554,12 +554,12 @@ static void stats_auth (struct Client *source_p) { /* Oper only, if unopered, return ERR_NOPRIVS */ - if((ConfigFileEntry.stats_i_oper_only == 2) && !IsOper (source_p)) + if((ConfigFileEntry.stats_i_oper_only == 2) && !IsOperGeneral (source_p)) sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str (ERR_NOPRIVILEGES)); /* If unopered, Only return matching auth blocks */ - else if((ConfigFileEntry.stats_i_oper_only == 1) && !IsOper (source_p)) + else if((ConfigFileEntry.stats_i_oper_only == 1) && !IsOperGeneral (source_p)) { struct ConfItem *aconf; char *name, *host, *user, *classname; @@ -598,12 +598,12 @@ static void stats_tklines(struct Client *source_p) { /* Oper only, if unopered, return ERR_NOPRIVS */ - if((ConfigFileEntry.stats_k_oper_only == 2) && !IsOper (source_p)) + if((ConfigFileEntry.stats_k_oper_only == 2) && !IsOperGeneral (source_p)) sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str (ERR_NOPRIVILEGES)); /* If unopered, Only return matching klines */ - else if((ConfigFileEntry.stats_k_oper_only == 1) && !IsOper (source_p)) + else if((ConfigFileEntry.stats_k_oper_only == 1) && !IsOperGeneral (source_p)) { struct ConfItem *aconf; char *host, *pass, *user, *oper_reason; @@ -700,12 +700,12 @@ static void stats_klines(struct Client *source_p) { /* Oper only, if unopered, return ERR_NOPRIVS */ - if((ConfigFileEntry.stats_k_oper_only == 2) && !IsOper (source_p)) + if((ConfigFileEntry.stats_k_oper_only == 2) && !IsOperGeneral (source_p)) sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str (ERR_NOPRIVILEGES)); /* If unopered, Only return matching klines */ - else if((ConfigFileEntry.stats_k_oper_only == 1) && !IsOper (source_p)) + else if((ConfigFileEntry.stats_k_oper_only == 1) && !IsOperGeneral (source_p)) { struct ConfItem *aconf; char *host, *pass, *user, *oper_reason; @@ -775,7 +775,7 @@ stats_oper(struct Client *source_p) struct oper_conf *oper_p; rb_dlink_node *ptr; - if(!IsOper(source_p) && ConfigFileEntry.stats_o_oper_only) + if(!IsOperGeneral(source_p) && ConfigFileEntry.stats_o_oper_only) { sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str (ERR_NOPRIVILEGES)); @@ -789,7 +789,7 @@ stats_oper(struct Client *source_p) sendto_one_numeric(source_p, RPL_STATSOLINE, form_str(RPL_STATSOLINE), oper_p->username, oper_p->host, oper_p->name, - IsOper(source_p) ? oper_p->privset->name : "0", "-1"); + IsOperGeneral(source_p) ? oper_p->privset->name : "0", "-1"); } } @@ -853,7 +853,7 @@ stats_operedup (struct Client *source_p) static void stats_ports (struct Client *source_p) { - if(!IsOper (source_p) && ConfigFileEntry.stats_P_oper_only) + if(!IsOperGeneral (source_p) && ConfigFileEntry.stats_P_oper_only) sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str (ERR_NOPRIVILEGES)); else @@ -1181,7 +1181,7 @@ stats_servers (struct Client *source_p) int days, hours, minutes; int j = 0; - if(ConfigServerHide.flatten_links && !IsOper(source_p) && + if(ConfigServerHide.flatten_links && !IsOperGeneral(source_p) && !IsExemptShide(source_p)) { sendto_one_numeric(source_p, ERR_NOPRIVILEGES, @@ -1257,7 +1257,7 @@ stats_gecos(struct Client *source_p) static void stats_class(struct Client *source_p) { - if(ConfigFileEntry.stats_y_oper_only && !IsOper(source_p)) + if(ConfigFileEntry.stats_y_oper_only && !IsOperGeneral(source_p)) sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str (ERR_NOPRIVILEGES)); else @@ -1524,7 +1524,7 @@ stats_servlinks (struct Client *source_p) int j = 0; char buf[128]; - if(ConfigServerHide.flatten_links && !IsOper (source_p) && + if(ConfigServerHide.flatten_links && !IsOperGeneral (source_p) && !IsExemptShide(source_p)) { sendto_one_numeric(source_p, ERR_NOPRIVILEGES, @@ -1553,7 +1553,7 @@ stats_servlinks (struct Client *source_p) rb_current_time() - target_p->localClient->firsttime, (rb_current_time() > target_p->localClient->lasttime) ? (rb_current_time() - target_p->localClient->lasttime) : 0, - IsOper (source_p) ? show_capabilities (target_p) : "TS"); + IsOperGeneral (source_p) ? show_capabilities (target_p) : "TS"); } sendto_one_numeric(source_p, RPL_STATSDEBUG, @@ -1659,7 +1659,7 @@ stats_ltrace(struct Client *source_p, int parc, const char *parv[]) stats_l_list(source_p, name, doall, wilds, &local_oper_list, statchar, stats_l_should_show_oper); } - if (!ConfigServerHide.flatten_links || IsOper(source_p) || + if (!ConfigServerHide.flatten_links || IsOperGeneral(source_p) || IsExemptShide(source_p)) stats_l_list(source_p, name, doall, wilds, &serv_list, statchar, NULL); @@ -1713,7 +1713,7 @@ stats_l_client(struct Client *source_p, struct Client *target_p, rb_current_time() - target_p->localClient->firsttime, (rb_current_time() > target_p->localClient->lasttime) ? (rb_current_time() - target_p->localClient->lasttime) : 0, - IsOper(source_p) ? show_capabilities(target_p) : "-"); + IsOperGeneral(source_p) ? show_capabilities(target_p) : "-"); } else diff --git a/modules/m_topic.c b/modules/m_topic.c index f1a9898a..e4e734b2 100644 --- a/modules/m_topic.c +++ b/modules/m_topic.c @@ -112,7 +112,7 @@ m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ } if(MyClient(source_p) && !is_chanop_voiced(msptr) && - !IsOper(source_p) && + !IsOperGeneral(source_p) && !add_channel_target(source_p, chptr)) { sendto_one(source_p, form_str(ERR_TARGCHANGE), diff --git a/modules/m_trace.c b/modules/m_trace.c index 1baf2bd7..a634635b 100644 --- a/modules/m_trace.c +++ b/modules/m_trace.c @@ -125,7 +125,7 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ /* giving this out with flattened links defeats the * object --fl */ - if(IsOper(source_p) || IsExemptShide(source_p) || + if(IsOperGeneral(source_p) || IsExemptShide(source_p) || !ConfigServerHide.flatten_links) sendto_one_numeric(source_p, RPL_TRACELINK, form_str(RPL_TRACELINK), diff --git a/modules/m_who.c b/modules/m_who.c index b7198a65..e9760943 100644 --- a/modules/m_who.c +++ b/modules/m_who.c @@ -192,7 +192,7 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, if(chptr != NULL) { - if (!IsOper(source_p) && !ratelimit_client_who(source_p, rb_dlink_list_length(&chptr->members)/50)) + if (!IsOperGeneral(source_p) && !ratelimit_client_who(source_p, rb_dlink_list_length(&chptr->members)/50)) { sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "WHO"); @@ -254,7 +254,7 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, flood_endgrace(source_p); /* it has to be a global who at this point, limit it */ - if(!IsOper(source_p)) + if(!IsOperGeneral(source_p)) { if((last_used + ConfigFileEntry.pace_wait) > rb_current_time() || !ratelimit_client(source_p, 1)) { @@ -324,7 +324,7 @@ who_common_channel(struct Client *source_p, struct Channel *chptr, if((mask == NULL) || match(mask, target_p->name) || match(mask, target_p->username) || match(mask, target_p->host) || match(mask, target_p->servptr->name) || - (IsOper(source_p) && match(mask, target_p->orighost)) || + (IsOperGeneral(source_p) && match(mask, target_p->orighost)) || match(mask, target_p->info)) { do_who(source_p, target_p, NULL, fmt); @@ -395,7 +395,7 @@ who_global(struct Client *source_p, const char *mask, int server_oper, int opers if(!mask || match(mask, target_p->name) || match(mask, target_p->username) || match(mask, target_p->host) || match(mask, target_p->servptr->name) || - (IsOper(source_p) && match(mask, target_p->orighost)) || + (IsOperGeneral(source_p) && match(mask, target_p->orighost)) || match(mask, target_p->info)) { do_who(source_p, target_p, NULL, fmt); @@ -495,7 +495,7 @@ do_who(struct Client *source_p, struct Client *target_p, struct membership *mspt source_p->name, msptr ? msptr->chptr->chname : "*", target_p->username, target_p->host, target_p->servptr->name, target_p->name, status, - ConfigServerHide.flatten_links && !IsOper(source_p) && !IsExemptShide(source_p) ? 0 : target_p->hopcount, + ConfigServerHide.flatten_links && !IsOperGeneral(source_p) && !IsExemptShide(source_p) ? 0 : target_p->hopcount, target_p->info); else { @@ -525,7 +525,7 @@ do_who(struct Client *source_p, struct Client *target_p, struct membership *mspt if (fmt->fields & FIELD_FLAGS) append_format(str, sizeof str, &pos, " %s", status); if (fmt->fields & FIELD_HOP) - append_format(str, sizeof str, &pos, " %d", ConfigServerHide.flatten_links && !IsOper(source_p) && !IsExemptShide(source_p) ? 0 : target_p->hopcount); + append_format(str, sizeof str, &pos, " %d", ConfigServerHide.flatten_links && !IsOperGeneral(source_p) && !IsExemptShide(source_p) ? 0 : target_p->hopcount); if (fmt->fields & FIELD_IDLE) append_format(str, sizeof str, &pos, " %d", (int)(MyClient(target_p) ? rb_current_time() - target_p->localClient->last : 0)); if (fmt->fields & FIELD_ACCOUNT) diff --git a/modules/m_whois.c b/modules/m_whois.c index 796d3084..b0ca2c2a 100644 --- a/modules/m_whois.c +++ b/modules/m_whois.c @@ -89,7 +89,7 @@ m_whois(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ return; } - if(!IsOper(source_p)) + if(!IsOperGeneral(source_p)) { /* seeing as this is going across servers, we should limit it */ if((last_used + ConfigFileEntry.pace_wait_simple) > rb_current_time() || !ratelimit_client(source_p, 2)) @@ -340,7 +340,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy) sendto_one_numeric(source_p, RPL_WHOISSECURE, form_str(RPL_WHOISSECURE), target_p->name, cbuf); - if((source_p == target_p || IsOper(source_p)) && + if((source_p == target_p || IsOperGeneral(source_p)) && target_p->certfp != NULL) sendto_one_numeric(source_p, RPL_WHOISCERTFP, form_str(RPL_WHOISCERTFP), @@ -349,7 +349,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy) if(MyClient(target_p)) { - if (IsDynSpoof(target_p) && (IsOper(source_p) || source_p == target_p)) + if (IsDynSpoof(target_p) && (IsOperGeneral(source_p) || source_p == target_p)) { /* trick here: show a nonoper their own IP if * dynamic spoofed but not if auth{} spoofed diff --git a/modules/m_whowas.c b/modules/m_whowas.c index a5038cce..1566f402 100644 --- a/modules/m_whowas.c +++ b/modules/m_whowas.c @@ -37,6 +37,7 @@ #include "msg.h" #include "parse.h" #include "modules.h" +#include "s_newconf.h" static const char whowas_desc[] = "Provides the WHOWAS command to display information on a disconnected user"; @@ -70,7 +71,7 @@ m_whowas(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source static time_t last_used = 0L; - if(MyClient(source_p) && !IsOper(source_p)) + if(MyClient(source_p) && !IsOperGeneral(source_p)) { if(last_used + (parc > 3 ? ConfigFileEntry.pace_wait : ConfigFileEntry.pace_wait_simple diff --git a/modules/um_callerid.c b/modules/um_callerid.c index 1e7a9e75..bfc94fd8 100644 --- a/modules/um_callerid.c +++ b/modules/um_callerid.c @@ -118,7 +118,7 @@ allow_message(struct Client *source_p, struct Client *target_p) return true; /* XXX: controversial? allow opers to send through +g */ - if (IsOper(source_p)) + if (IsOperGeneral(source_p)) return true; if (accept_message(source_p, target_p)) @@ -168,7 +168,7 @@ add_callerid_accept_for_source(enum message_type msgtype, struct Client *source_ if(msgtype != MESSAGE_TYPE_NOTICE && IsSetAnyCallerID(source_p) && !accept_message(target_p, source_p) && - !IsOper(target_p)) + !IsOperGeneral(target_p)) { if(rb_dlink_list_length(&source_p->localClient->allow_list) < (unsigned long)ConfigFileEntry.max_accept)