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.
This commit is contained in:
Ed Kellett 2019-07-07 05:34:28 +01:00
parent ad7ecd5cbb
commit d4f7eb4ce6
No known key found for this signature in database
GPG key ID: CB9986DEF342FABC
34 changed files with 91 additions and 74 deletions

View file

@ -236,7 +236,7 @@ auth {
* means they must be defined before operator {}. * means they must be defined before operator {}.
*/ */
privset "local_op" { privset "local_op" {
privs = oper:local_kill, oper:operwall; privs = oper:general, oper:local_kill, oper:operwall;
}; };
privset "server_bot" { privset "server_bot" {

View file

@ -430,6 +430,8 @@ privset "local_op" {
* *
* Available options: * 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:local_kill: allows local users to be /KILL'd
* oper:global_kill: allows local and remote users to be /KILL'd * oper:global_kill: allows local and remote users to be /KILL'd
* oper:routing: allows remote SQUIT and CONNECT * oper:routing: allows remote SQUIT and CONNECT
@ -454,7 +456,7 @@ privset "local_op" {
* oper:mass_notice: allows sending wallops and mass notices * oper:mass_notice: allows sending wallops and mass notices
* oper:grant: allows using the GRANT command * oper:grant: allows using the GRANT command
*/ */
privs = oper:local_kill, oper:operwall; privs = oper:general, oper:local_kill, oper:operwall;
}; };
privset "server_bot" { privset "server_bot" {

View file

@ -15,6 +15,7 @@
#include "s_conf.h" #include "s_conf.h"
#include "snomask.h" #include "snomask.h"
#include "numeric.h" #include "numeric.h"
#include "s_newconf.h"
static const char restrict_desc[] = "Restricts channel creation to authenticated users and IRC operators only"; 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; 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; data->approved = ERR_NEEDREGGEDNICK;
} }

View file

@ -15,6 +15,7 @@
#include "s_conf.h" #include "s_conf.h"
#include "snomask.h" #include "snomask.h"
#include "numeric.h" #include "numeric.h"
#include "s_newconf.h"
static const char restrict_desc[] = "Restricts channel creation to IRC operators"; 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; 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."); sendto_one_notice(source_p, ":*** Channel creation is restricted to network staff only.");
data->approved = ERR_NEEDREGGEDNICK; data->approved = ERR_NEEDREGGEDNICK;

View file

@ -32,7 +32,7 @@ h_noi_umode_changed(hook_data_umode_changed *hdata)
{ {
struct Client *source_p = hdata->client; 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); SetInvisible(source_p);
} }
} }

View file

@ -470,9 +470,9 @@ doing_stats_hook(hook_data_int *hdata)
source_p = hdata->client; source_p = hdata->client;
if(hdata->arg2 != (int) 's') if(hdata->arg2 != (int) 's')
return; return;
if((ConfigFileEntry.stats_k_oper_only == 2) && !IsOper(source_p)) if((ConfigFileEntry.stats_k_oper_only == 2) && !IsOperGeneral(source_p))
return; 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); hurt = hurt_find(source_p->sockhost);
if (hurt != NULL) if (hurt != NULL)

View file

@ -64,7 +64,7 @@ m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
*p = '\0'; *p = '\0';
/* Allow ircops to search for forwards to nonexistent channels */ /* 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) if((chptr = find_channel(parv[1])) == NULL || (msptr = find_channel_membership(chptr, source_p)) == NULL)
{ {

View file

@ -12,6 +12,7 @@
#include "client.h" #include "client.h"
#include "ircd.h" #include "ircd.h"
#include "send.h" #include "send.h"
#include "s_newconf.h"
/* undefine this to allow anyone to receive whois notifications */ /* undefine this to allow anyone to receive whois notifications */
#define OPERONLY #define OPERONLY
@ -57,7 +58,7 @@ show_whois(hook_data_client *data)
if(MyClient(target_p) && if(MyClient(target_p) &&
#ifdef OPERONLY #ifdef OPERONLY
IsOper(target_p) && IsOperGeneral(target_p) &&
#endif #endif
(source_p != target_p) && (source_p != target_p) &&
(target_p->snomask & snomask_modes['W'])) (target_p->snomask & snomask_modes['W']))

View file

@ -371,7 +371,7 @@ struct ListClient
(x)->handler = SERVER_HANDLER; } (x)->handler = SERVER_HANDLER; }
#define SetClient(x) {(x)->status = STAT_CLIENT; \ #define SetClient(x) {(x)->status = STAT_CLIENT; \
(x)->handler = IsOper((x)) ? \ (x)->handler = IsOperGeneral((x)) ? \
OPER_HANDLER : CLIENT_HANDLER; } OPER_HANDLER : CLIENT_HANDLER; }
#define SetRemoteClient(x) {(x)->status = STAT_CLIENT; \ #define SetRemoteClient(x) {(x)->status = STAT_CLIENT; \
(x)->handler = RCLIENT_HANDLER; } (x)->handler = RCLIENT_HANDLER; }
@ -516,12 +516,8 @@ struct ListClient
/* oper flags */ /* oper flags */
#define MyOper(x) (MyConnect(x) && IsOper(x)) #define MyOper(x) (MyConnect(x) && IsOper(x))
#define SetOper(x) {(x)->umodes |= UMODE_OPER; \ #define SetOper(x) ((x)->umodes |= UMODE_OPER)
if (MyClient((x))) (x)->handler = OPER_HANDLER;} #define ClearOper(x) ((x)->umodes &= ~(UMODE_OPER|UMODE_ADMIN))
#define ClearOper(x) {(x)->umodes &= ~(UMODE_OPER|UMODE_ADMIN); \
if (MyClient((x)) && !IsOper((x)) && !IsServer((x))) \
(x)->handler = CLIENT_HANDLER; }
/* umode flags */ /* umode flags */
#define IsInvisible(x) ((x)->umodes & UMODE_INVISIBLE) #define IsInvisible(x) ((x)->umodes & UMODE_INVISIBLE)

View file

@ -165,6 +165,7 @@ extern void cluster_generic(struct Client *, const char *, int cltype,
#define IsOperInvis(x) (HasPrivilege((x), "oper:hidden")) #define IsOperInvis(x) (HasPrivilege((x), "oper:hidden"))
#define IsOperRemoteBan(x) (HasPrivilege((x), "oper:remoteban")) #define IsOperRemoteBan(x) (HasPrivilege((x), "oper:remoteban"))
#define IsOperMassNotice(x) (HasPrivilege((x), "oper:mass_notice")) #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)))) #define SeesOper(target, source) (IsOper((target)) && ((!ConfigFileEntry.hide_opers && !HasPrivilege((target), "oper:hidden")) || IsOper((source))))

View file

@ -660,7 +660,7 @@ chm_hidden(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn, int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type) 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)) if(!(*errors & SM_ERR_NOPRIVS))
sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str(ERR_NOPRIVILEGES)); 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)) if(!allow_mode_change(source_p, chptr, alevel, errors, c))
return; return;
#else #else
if(!IsOper(source_p) && !IsServer(source_p)) if(!IsOperGeneral(source_p) && !IsServer(source_p))
{ {
if(!(*errors & SM_ERR_NOPRIVS)) if(!(*errors & SM_ERR_NOPRIVS))
sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str(ERR_NOPRIVILEGES)); sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str(ERR_NOPRIVILEGES));

View file

@ -26,6 +26,7 @@
#include "stdinc.h" #include "stdinc.h"
#include "ircd_defs.h" #include "ircd_defs.h"
#include "s_conf.h" #include "s_conf.h"
#include "s_newconf.h"
#include "hostmask.h" #include "hostmask.h"
#include "numeric.h" #include "numeric.h"
#include "send.h" #include "send.h"
@ -729,7 +730,7 @@ report_auth(struct Client *client_p)
{ {
aconf = arec->aconf; aconf = arec->aconf;
if(!IsOper(client_p) && IsConfDoSpoofIp(aconf)) if(!IsOperGeneral(client_p) && IsConfDoSpoofIp(aconf))
continue; continue;
get_printable_conf(aconf, &name, &host, &pass, &user, &port, get_printable_conf(aconf, &name, &host, &pass, &user, &port,

View file

@ -32,6 +32,7 @@
#include "hook.h" #include "hook.h"
#include "send.h" #include "send.h"
#include "s_assert.h" #include "s_assert.h"
#include "s_newconf.h"
static char readBuf[READBUF_SIZE]; static char readBuf[READBUF_SIZE];
static void client_dopacket(struct Client *client_p, char *buffer, size_t length); 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? /* allow opers 4 times the amount of messages as users. why 4?
* why not. :) --fl_ * why not. :) --fl_
*/ */
if(IsOper(client_p) && ConfigFileEntry.no_oper_flood) if(IsOperGeneral(client_p) && ConfigFileEntry.no_oper_flood)
allow_read *= 4; allow_read *= 4;
/* /*
* Handle flood protection here - if we exceed our flood limit on * 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) && if(!IsAnyServer(client_p) &&
(rb_linebuf_alloclen(&client_p->localClient->buf_recvq) > ConfigFileEntry.client_flood_max_lines)) (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"); exit_client(client_p, client_p, client_p, "Excess Flood");
return; return;

View file

@ -1381,7 +1381,7 @@ get_printable_kline(struct Client *source_p, struct ConfItem *aconf,
*user = EmptyString(aconf->user) ? null : aconf->user; *user = EmptyString(aconf->user) ? null : aconf->user;
*reason = get_user_ban_reason(aconf); *reason = get_user_ban_reason(aconf);
if(!IsOper(source_p)) if(!IsOperGeneral(source_p))
*oper_reason = NULL; *oper_reason = NULL;
else else
{ {

View file

@ -1237,6 +1237,9 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char
source_p->umodes &= ~UMODE_ADMIN; 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 */ /* let modules providing usermodes know that we've changed our usermode --nenolod */
hdata.client = source_p; hdata.client = source_p;
hdata.oldumodes = setflags; hdata.oldumodes = setflags;
@ -1439,6 +1442,8 @@ oper_up(struct Client *source_p, struct oper_conf *oper_p)
hdata.oldsnomask = oldsnomask; hdata.oldsnomask = oldsnomask;
call_hook(h_umode_changed, &hdata); call_hook(h_umode_changed, &hdata);
source_p->handler = IsOperGeneral(source_p) ? OPER_HANDLER : CLIENT_HANDLER;
sendto_realops_snomask(SNO_GENERAL, L_ALL, sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s (%s!%s@%s) is now an operator", oper_p->name, source_p->name, "%s (%s!%s@%s) is now an operator", oper_p->name, source_p->name,
source_p->username, source_p->host); source_p->username, source_p->host);

View file

@ -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, ":The BAN command is not user-accessible.");
sendto_one_notice(source_p, ":To ban a user from a channel, see /QUOTE HELP CMODE"); 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"); sendto_one_notice(source_p, ":To ban a user from a server or from the network, see /QUOTE HELP KLINE");
} }

View file

@ -209,7 +209,7 @@ m_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
continue; continue;
} }
if(splitmode && !IsOper(source_p) && (*name != '&') && if(splitmode && !IsOperGeneral(source_p) && (*name != '&') &&
ConfigChannel.no_join_on_split) ConfigChannel.no_join_on_split)
{ {
sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE), 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; continue;
} }
if(splitmode && !IsOper(source_p) && (*name != '&') && if(splitmode && !IsOperGeneral(source_p) && (*name != '&') &&
ConfigChannel.no_create_on_split) ConfigChannel.no_create_on_split)
{ {
sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE), 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; chptr = chptr2;
if(flags == 0 && if(flags == 0 &&
!IsOper(source_p) && !IsExemptSpambot(source_p)) !IsOperGeneral(source_p) && !IsExemptSpambot(source_p))
check_spambot_warning(source_p, name); check_spambot_warning(source_p, name);
/* add the user to the channel */ /* 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)) while((ptr = source_p->user->channel.head))
{ {
if(MyConnect(source_p) && if(MyConnect(source_p) &&
!IsOper(source_p) && !IsExemptSpambot(source_p)) !IsOperGeneral(source_p) && !IsExemptSpambot(source_p))
check_spambot_warning(source_p, NULL); check_spambot_warning(source_p, NULL);
msptr = ptr->data; msptr = ptr->data;
@ -987,7 +987,7 @@ check_channel_name_loc(struct Client *source_p, const char *name)
if(EmptyString(name)) if(EmptyString(name))
return false; return false;
if(ConfigFileEntry.disable_fake_channels && !IsOper(source_p)) if(ConfigFileEntry.disable_fake_channels && !IsOperGeneral(source_p))
{ {
for(p = name; *p; ++p) for(p = name; *p; ++p)
{ {

View file

@ -513,7 +513,7 @@ msg_channel(enum message_type msgtype,
if((result = can_send(chptr, source_p, NULL))) if((result = can_send(chptr, source_p, NULL)))
{ {
if(result != CAN_SEND_OPV && MyClient(source_p) && if(result != CAN_SEND_OPV && MyClient(source_p) &&
!IsOper(source_p) && !IsOperGeneral(source_p) &&
!add_channel_target(source_p, chptr)) !add_channel_target(source_p, chptr))
{ {
sendto_one(source_p, form_str(ERR_TARGCHANGE), sendto_one(source_p, form_str(ERR_TARGCHANGE),
@ -531,7 +531,7 @@ msg_channel(enum message_type msgtype,
(!(chptr->mode.mode & MODE_NOPRIVMSGS) || (!(chptr->mode.mode & MODE_NOPRIVMSGS) ||
IsMember(source_p, chptr))) IsMember(source_p, chptr)))
{ {
if(MyClient(source_p) && !IsOper(source_p) && if(MyClient(source_p) && !IsOperGeneral(source_p) &&
!add_channel_target(source_p, chptr)) !add_channel_target(source_p, chptr))
{ {
sendto_one(source_p, form_str(ERR_TARGCHANGE), 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(); source_p->localClient->last = rb_current_time();
/* auto cprivmsg/cnotice */ /* auto cprivmsg/cnotice */
do_floodcount = !IsOper(source_p) && do_floodcount = !IsOperGeneral(source_p) &&
!find_allowing_channel(source_p, target_p); !find_allowing_channel(source_p, target_p);
/* target change stuff, dont limit ctcp replies as that /* target change stuff, dont limit ctcp replies as that

View file

@ -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->last_nick_change = rb_current_time();
source_p->localClient->number_of_nick_changes++; 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) source_p->localClient->number_of_nick_changes > ConfigFileEntry.max_nick_changes)
{ {
sendto_one(source_p, form_str(ERR_NICKTOOFAST), sendto_one(source_p, form_str(ERR_NICKTOOFAST),

View file

@ -38,6 +38,7 @@
#include "packet.h" #include "packet.h"
#include "inline/stringops.h" #include "inline/stringops.h"
#include "hook.h" #include "hook.h"
#include "s_newconf.h"
static const char part_desc[] = "Provides the PART command to leave a channel"; 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; 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); check_spambot_warning(source_p, NULL);
/* /*

View file

@ -33,6 +33,7 @@
#include "modules.h" #include "modules.h"
#include "s_conf.h" #include "s_conf.h"
#include "inline/stringops.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"; 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; 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) > (source_p->localClient->firsttime + ConfigFileEntry.anti_spam_exit_message_time) >
rb_current_time())) rb_current_time()))
{ {

View file

@ -34,6 +34,7 @@
#include "s_conf.h" #include "s_conf.h"
#include "s_serv.h" #include "s_serv.h"
#include "packet.h" #include "packet.h"
#include "s_newconf.h"
static const char away_desc[] = "Provides the AWAY command to set yourself away"; 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. */ /* Rate limit this because it is sent to common channels. */
if (MyClient(source_p)) if (MyClient(source_p))
{ {
if(!IsOper(source_p) && if(!IsOperGeneral(source_p) &&
source_p->localClient->next_away > rb_current_time()) source_p->localClient->next_away > rb_current_time())
{ {
sendto_one(source_p, form_str(RPL_LOAD2HI), sendto_one(source_p, form_str(RPL_LOAD2HI),

View file

@ -37,6 +37,7 @@
#include "msg.h" #include "msg.h"
#include "parse.h" #include "parse.h"
#include "modules.h" #include "modules.h"
#include "s_newconf.h"
static const char info_desc[] = static const char info_desc[] =
"Provides the INFO command for retrieving server copyright, credits, and other info"; "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); info_spy(source_p);
send_info_text(source_p); send_info_text(source_p);
if(IsOper(source_p)) if(IsOperGeneral(source_p))
{ {
send_conf_options(source_p); send_conf_options(source_p);
sendto_one_numeric(source_p, RPL_INFO, ":%s", sendto_one_numeric(source_p, RPL_INFO, ":%s",

View file

@ -37,6 +37,7 @@
#include "modules.h" #include "modules.h"
#include "packet.h" #include "packet.h"
#include "tgchange.h" #include "tgchange.h"
#include "s_newconf.h"
static const char invite_desc[] = "Provides /invite"; 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(MyConnect(source_p))
{ {
if (ConfigFileEntry.target_change && !IsOper(source_p) && if (ConfigFileEntry.target_change && !IsOperGeneral(source_p) &&
!find_allowing_channel(source_p, target_p) && !find_allowing_channel(source_p, target_p) &&
!add_target(source_p, target_p)) !add_target(source_p, target_p))
{ {

View file

@ -35,6 +35,7 @@
#include "modules.h" #include "modules.h"
#include "s_serv.h" #include "s_serv.h"
#include "supported.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"; 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 user per knock_delay
* allow one knock per channel per knock_delay_channel * 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()) (source_p->localClient->last_knock + ConfigChannel.knock_delay) > rb_current_time())
{ {
sendto_one(source_p, form_str(ERR_TOOMANYKNOCK), sendto_one(source_p, form_str(ERR_TOOMANYKNOCK),

View file

@ -35,6 +35,7 @@
#include "msg.h" #include "msg.h"
#include "parse.h" #include "parse.h"
#include "modules.h" #include "modules.h"
#include "s_newconf.h"
static const char names_desc[] = "Provides the NAMES command to view users on a channel"; 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 else
{ {
if(!IsOper(source_p)) if(!IsOperGeneral(source_p))
{ {
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
{ {

View file

@ -334,7 +334,7 @@ h_svc_stats(hook_data_int *data)
char statchar = (char) data->arg2; char statchar = (char) data->arg2;
rb_dlink_node *ptr; rb_dlink_node *ptr;
if (statchar == 'U' && IsOper(data->client)) if (statchar == 'U' && IsOperGeneral(data->client))
{ {
RB_DLINK_FOREACH(ptr, service_list.head) RB_DLINK_FOREACH(ptr, service_list.head)
{ {

View file

@ -212,7 +212,7 @@ m_stats(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
statchar = parv[1][0]; 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 */ /* Check the user is actually allowed to do /stats, and isnt flooding */
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) 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"); me.name, source_p->name, "admin");
goto stats_out; goto stats_out;
} }
if(cmd->need_oper && !IsOper(source_p)) if(cmd->need_oper && !IsOperGeneral(source_p))
{ {
sendto_one_numeric(source_p, ERR_NOPRIVILEGES, sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
form_str (ERR_NOPRIVILEGES)); form_str (ERR_NOPRIVILEGES));
@ -322,7 +322,7 @@ stats_connect(struct Client *source_p)
if((ConfigFileEntry.stats_c_oper_only || if((ConfigFileEntry.stats_c_oper_only ||
(ConfigServerHide.flatten_links && !IsExemptShide(source_p))) && (ConfigServerHide.flatten_links && !IsExemptShide(source_p))) &&
!IsOper(source_p)) !IsOperGeneral(source_p))
{ {
sendto_one_numeric(source_p, ERR_NOPRIVILEGES, sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
form_str(ERR_NOPRIVILEGES)); form_str(ERR_NOPRIVILEGES));
@ -338,7 +338,7 @@ stats_connect(struct Client *source_p)
s = buf; s = buf;
if(IsOper(source_p)) if(IsOperGeneral(source_p))
{ {
if(ServerConfAutoconn(server_p)) if(ServerConfAutoconn(server_p))
*s++ = 'A'; *s++ = 'A';
@ -527,7 +527,7 @@ stats_hubleaf(struct Client *source_p)
if((ConfigFileEntry.stats_h_oper_only || if((ConfigFileEntry.stats_h_oper_only ||
(ConfigServerHide.flatten_links && !IsExemptShide(source_p))) && (ConfigServerHide.flatten_links && !IsExemptShide(source_p))) &&
!IsOper(source_p)) !IsOperGeneral(source_p))
{ {
sendto_one_numeric(source_p, ERR_NOPRIVILEGES, sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
form_str (ERR_NOPRIVILEGES)); form_str (ERR_NOPRIVILEGES));
@ -554,12 +554,12 @@ static void
stats_auth (struct Client *source_p) stats_auth (struct Client *source_p)
{ {
/* Oper only, if unopered, return ERR_NOPRIVS */ /* 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, sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
form_str (ERR_NOPRIVILEGES)); form_str (ERR_NOPRIVILEGES));
/* If unopered, Only return matching auth blocks */ /* 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; struct ConfItem *aconf;
char *name, *host, *user, *classname; char *name, *host, *user, *classname;
@ -598,12 +598,12 @@ static void
stats_tklines(struct Client *source_p) stats_tklines(struct Client *source_p)
{ {
/* Oper only, if unopered, return ERR_NOPRIVS */ /* 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, sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
form_str (ERR_NOPRIVILEGES)); form_str (ERR_NOPRIVILEGES));
/* If unopered, Only return matching klines */ /* 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; struct ConfItem *aconf;
char *host, *pass, *user, *oper_reason; char *host, *pass, *user, *oper_reason;
@ -700,12 +700,12 @@ static void
stats_klines(struct Client *source_p) stats_klines(struct Client *source_p)
{ {
/* Oper only, if unopered, return ERR_NOPRIVS */ /* 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, sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
form_str (ERR_NOPRIVILEGES)); form_str (ERR_NOPRIVILEGES));
/* If unopered, Only return matching klines */ /* 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; struct ConfItem *aconf;
char *host, *pass, *user, *oper_reason; char *host, *pass, *user, *oper_reason;
@ -775,7 +775,7 @@ stats_oper(struct Client *source_p)
struct oper_conf *oper_p; struct oper_conf *oper_p;
rb_dlink_node *ptr; 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, sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
form_str (ERR_NOPRIVILEGES)); form_str (ERR_NOPRIVILEGES));
@ -789,7 +789,7 @@ stats_oper(struct Client *source_p)
sendto_one_numeric(source_p, RPL_STATSOLINE, sendto_one_numeric(source_p, RPL_STATSOLINE,
form_str(RPL_STATSOLINE), form_str(RPL_STATSOLINE),
oper_p->username, oper_p->host, oper_p->name, 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 static void
stats_ports (struct Client *source_p) 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, sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
form_str (ERR_NOPRIVILEGES)); form_str (ERR_NOPRIVILEGES));
else else
@ -1181,7 +1181,7 @@ stats_servers (struct Client *source_p)
int days, hours, minutes; int days, hours, minutes;
int j = 0; int j = 0;
if(ConfigServerHide.flatten_links && !IsOper(source_p) && if(ConfigServerHide.flatten_links && !IsOperGeneral(source_p) &&
!IsExemptShide(source_p)) !IsExemptShide(source_p))
{ {
sendto_one_numeric(source_p, ERR_NOPRIVILEGES, sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
@ -1257,7 +1257,7 @@ stats_gecos(struct Client *source_p)
static void static void
stats_class(struct Client *source_p) 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, sendto_one_numeric(source_p, ERR_NOPRIVILEGES,
form_str (ERR_NOPRIVILEGES)); form_str (ERR_NOPRIVILEGES));
else else
@ -1524,7 +1524,7 @@ stats_servlinks (struct Client *source_p)
int j = 0; int j = 0;
char buf[128]; char buf[128];
if(ConfigServerHide.flatten_links && !IsOper (source_p) && if(ConfigServerHide.flatten_links && !IsOperGeneral (source_p) &&
!IsExemptShide(source_p)) !IsExemptShide(source_p))
{ {
sendto_one_numeric(source_p, ERR_NOPRIVILEGES, 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->firsttime,
(rb_current_time() > target_p->localClient->lasttime) ? (rb_current_time() > target_p->localClient->lasttime) ?
(rb_current_time() - target_p->localClient->lasttime) : 0, (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, 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); 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)) IsExemptShide(source_p))
stats_l_list(source_p, name, doall, wilds, &serv_list, statchar, NULL); 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->firsttime,
(rb_current_time() > target_p->localClient->lasttime) ? (rb_current_time() > target_p->localClient->lasttime) ?
(rb_current_time() - target_p->localClient->lasttime) : 0, (rb_current_time() - target_p->localClient->lasttime) : 0,
IsOper(source_p) ? show_capabilities(target_p) : "-"); IsOperGeneral(source_p) ? show_capabilities(target_p) : "-");
} }
else else

View file

@ -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) && if(MyClient(source_p) && !is_chanop_voiced(msptr) &&
!IsOper(source_p) && !IsOperGeneral(source_p) &&
!add_channel_target(source_p, chptr)) !add_channel_target(source_p, chptr))
{ {
sendto_one(source_p, form_str(ERR_TARGCHANGE), sendto_one(source_p, form_str(ERR_TARGCHANGE),

View file

@ -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 /* giving this out with flattened links defeats the
* object --fl * object --fl
*/ */
if(IsOper(source_p) || IsExemptShide(source_p) || if(IsOperGeneral(source_p) || IsExemptShide(source_p) ||
!ConfigServerHide.flatten_links) !ConfigServerHide.flatten_links)
sendto_one_numeric(source_p, RPL_TRACELINK, sendto_one_numeric(source_p, RPL_TRACELINK,
form_str(RPL_TRACELINK), form_str(RPL_TRACELINK),

View file

@ -192,7 +192,7 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
if(chptr != NULL) 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), sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "WHO"); 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); flood_endgrace(source_p);
/* it has to be a global who at this point, limit it */ /* 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)) 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) || if((mask == NULL) ||
match(mask, target_p->name) || match(mask, target_p->username) || match(mask, target_p->name) || match(mask, target_p->username) ||
match(mask, target_p->host) || match(mask, target_p->servptr->name) || 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)) match(mask, target_p->info))
{ {
do_who(source_p, target_p, NULL, fmt); 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 || if(!mask ||
match(mask, target_p->name) || match(mask, target_p->username) || match(mask, target_p->name) || match(mask, target_p->username) ||
match(mask, target_p->host) || match(mask, target_p->servptr->name) || 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)) match(mask, target_p->info))
{ {
do_who(source_p, target_p, NULL, fmt); 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 : "*", source_p->name, msptr ? msptr->chptr->chname : "*",
target_p->username, target_p->host, target_p->username, target_p->host,
target_p->servptr->name, target_p->name, status, 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); target_p->info);
else else
{ {
@ -525,7 +525,7 @@ do_who(struct Client *source_p, struct Client *target_p, struct membership *mspt
if (fmt->fields & FIELD_FLAGS) if (fmt->fields & FIELD_FLAGS)
append_format(str, sizeof str, &pos, " %s", status); append_format(str, sizeof str, &pos, " %s", status);
if (fmt->fields & FIELD_HOP) 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) if (fmt->fields & FIELD_IDLE)
append_format(str, sizeof str, &pos, " %d", (int)(MyClient(target_p) ? rb_current_time() - target_p->localClient->last : 0)); append_format(str, sizeof str, &pos, " %d", (int)(MyClient(target_p) ? rb_current_time() - target_p->localClient->last : 0));
if (fmt->fields & FIELD_ACCOUNT) if (fmt->fields & FIELD_ACCOUNT)

View file

@ -89,7 +89,7 @@ m_whois(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
return; return;
} }
if(!IsOper(source_p)) if(!IsOperGeneral(source_p))
{ {
/* seeing as this is going across servers, we should limit it */ /* 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)) 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), sendto_one_numeric(source_p, RPL_WHOISSECURE, form_str(RPL_WHOISSECURE),
target_p->name, cbuf); target_p->name, cbuf);
if((source_p == target_p || IsOper(source_p)) && if((source_p == target_p || IsOperGeneral(source_p)) &&
target_p->certfp != NULL) target_p->certfp != NULL)
sendto_one_numeric(source_p, RPL_WHOISCERTFP, sendto_one_numeric(source_p, RPL_WHOISCERTFP,
form_str(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(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 /* trick here: show a nonoper their own IP if
* dynamic spoofed but not if auth{} spoofed * dynamic spoofed but not if auth{} spoofed

View file

@ -37,6 +37,7 @@
#include "msg.h" #include "msg.h"
#include "parse.h" #include "parse.h"
#include "modules.h" #include "modules.h"
#include "s_newconf.h"
static const char whowas_desc[] = static const char whowas_desc[] =
"Provides the WHOWAS command to display information on a disconnected user"; "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; 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 : if(last_used + (parc > 3 ? ConfigFileEntry.pace_wait :
ConfigFileEntry.pace_wait_simple ConfigFileEntry.pace_wait_simple

View file

@ -118,7 +118,7 @@ allow_message(struct Client *source_p, struct Client *target_p)
return true; return true;
/* XXX: controversial? allow opers to send through +g */ /* XXX: controversial? allow opers to send through +g */
if (IsOper(source_p)) if (IsOperGeneral(source_p))
return true; return true;
if (accept_message(source_p, target_p)) 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 && if(msgtype != MESSAGE_TYPE_NOTICE &&
IsSetAnyCallerID(source_p) && IsSetAnyCallerID(source_p) &&
!accept_message(target_p, source_p) && !accept_message(target_p, source_p) &&
!IsOper(target_p)) !IsOperGeneral(target_p))
{ {
if(rb_dlink_list_length(&source_p->localClient->allow_list) < if(rb_dlink_list_length(&source_p->localClient->allow_list) <
(unsigned long)ConfigFileEntry.max_accept) (unsigned long)ConfigFileEntry.max_accept)