summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2016-06-05 14:16:36 +0100
committerRussell King <rmk+kernel@armlinux.org.uk>2016-06-05 17:47:56 +0100
commit14630f6b4763b34ff96c091c3e55f387862af185 (patch)
tree035a58ea3b2da4767b8e638f306605a8ad992dcc
parent4f57d083c810f57edc0fe449b0de1f48e402107b (diff)
Convert global channel operator support to OFTC's God mode.
OFTC's God mode is very similar to the global channel operator mode, with the following differences: - gaining God mode notifies all operators - uses of God mode privileges notifies all operators - God mode times out after a configurable period - uses umode S rather than O - S is taken for SSL clients in hybrid 8.1.13. So align with OFTC's implementation, but omit these features.
-rw-r--r--include/channel_mode.h3
-rw-r--r--include/client.h4
-rw-r--r--modules/core/m_join.c2
-rw-r--r--modules/core/m_kick.c6
-rw-r--r--modules/m_invite.c2
-rw-r--r--modules/m_topic.c2
-rw-r--r--src/channel.c8
-rw-r--r--src/channel_mode.c5
-rw-r--r--src/conf.c2
-rw-r--r--src/conf_parser.y6
-rw-r--r--src/s_user.c2
11 files changed, 24 insertions, 18 deletions
diff --git a/include/channel_mode.h b/include/channel_mode.h
index 76136ec..755c17a 100644
--- a/include/channel_mode.h
+++ b/include/channel_mode.h
@@ -44,7 +44,8 @@ enum
CHACCESS_NOTONCHAN = -1,
CHACCESS_PEON = 0,
CHACCESS_HALFOP = 1,
- CHACCESS_CHANOP = 2
+ CHACCESS_CHANOP = 2,
+ CHACCESS_GOD = 3
};
/* can_send results */
diff --git a/include/client.h b/include/client.h
index e799eca..a983cd5 100644
--- a/include/client.h
+++ b/include/client.h
@@ -168,7 +168,7 @@ struct MaskItem;
#define UMODE_HIDDENHOST 0x01000000 /**< User's host is hidden */
#define UMODE_SSL 0x02000000 /**< User is connected via TLS/SSL */
#define UMODE_WEBIRC 0x04000000 /**< User connected via a webirc gateway */
-#define UMODE_GCHANOP 0x08000000 /**< Global channel operator */
+#define UMODE_GOD 0x08000000 /**< Operator is God */
#define UMODE_ALL UMODE_SERVNOTICE
@@ -181,7 +181,7 @@ struct MaskItem;
UMODE_REGONLY | UMODE_REGISTERED | UMODE_ADMIN |\
UMODE_HIDDEN | UMODE_HIDDENHOST | UMODE_SSL |\
UMODE_WEBIRC | UMODE_CALLERID | UMODE_SOFTCALLERID |\
- UMODE_GCHANOP)
+ UMODE_GOD)
diff --git a/modules/core/m_join.c b/modules/core/m_join.c
index 673e88c..5c9ba9a 100644
--- a/modules/core/m_join.c
+++ b/modules/core/m_join.c
@@ -174,7 +174,7 @@ m_join(struct Client *client_p, struct Client *source_p,
/*
* can_join checks for +i key, bans.
*/
- if ((i = can_join(source_p, chptr, key)))
+ if ((i = can_join(source_p, chptr, key)) && !HasUMode(source_p, UMODE_GOD))
{
sendto_one(source_p, form_str(i), me.name,
source_p->name, chptr->chname);
diff --git a/modules/core/m_kick.c b/modules/core/m_kick.c
index a9f012f..27818e5 100644
--- a/modules/core/m_kick.c
+++ b/modules/core/m_kick.c
@@ -97,7 +97,7 @@ m_kick(struct Client *client_p, struct Client *source_p,
}
}
- if (!has_member_flags(ms_source, CHFL_CHANOP|CHFL_HALFOP) && !HasUMode(source_p, UMODE_GCHANOP))
+ if (!has_member_flags(ms_source, CHFL_CHANOP|CHFL_HALFOP) && !HasUMode(source_p, UMODE_GOD))
{
/* was a user, not a server, and user isn't seen as a chanop here */
if (MyConnect(source_p))
@@ -146,10 +146,10 @@ m_kick(struct Client *client_p, struct Client *source_p,
{
#ifdef HALFOPS
/* half ops cannot kick other halfops on private channels */
- if (has_member_flags(ms_source, CHFL_HALFOP) && !has_member_flags(ms_source, CHFL_CHANOP) && !HasUMode(source_p, UMODE_GCHANOP))
+ if (has_member_flags(ms_source, CHFL_HALFOP) && !has_member_flags(ms_source, CHFL_CHANOP) && !HasUMode(source_p, UMODE_GOD))
{
if (((chptr->mode.mode & MODE_PRIVATE) && has_member_flags(ms_target,
- CHFL_CHANOP|CHFL_HALFOP)) || has_member_flags(ms_target, CHFL_CHANOP) || HasUMode(who, UMODE_GCHANOP))
+ CHFL_CHANOP|CHFL_HALFOP)) || has_member_flags(ms_target, CHFL_CHANOP) || HasUMode(target_p, UMODE_GOD))
{
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, chptr->chname);
diff --git a/modules/m_invite.c b/modules/m_invite.c
index 48e86e6..ccca4dd 100644
--- a/modules/m_invite.c
+++ b/modules/m_invite.c
@@ -91,7 +91,7 @@ m_invite(struct Client *client_p, struct Client *source_p,
}
if (MyConnect(source_p) && !has_member_flags(ms, CHFL_CHANOP)
- && !HasUMode(source_p, UMODE_GCHANOP))
+ && !HasUMode(source_p, UMODE_GOD))
{
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, chptr->chname);
diff --git a/modules/m_topic.c b/modules/m_topic.c
index 3aa5e3d..6d7e351 100644
--- a/modules/m_topic.c
+++ b/modules/m_topic.c
@@ -82,7 +82,7 @@ m_topic(struct Client *client_p, struct Client *source_p,
if (!(chptr->mode.mode & MODE_TOPICLIMIT) ||
has_member_flags(ms, CHFL_CHANOP|CHFL_HALFOP) ||
- HasUMode(source_p, UMODE_GCHANOP))
+ HasUMode(source_p, UMODE_GOD))
{
char topic_info[USERHOST_REPLYLEN];
diff --git a/src/channel.c b/src/channel.c
index 1feb5d1..a96468b 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -436,7 +436,7 @@ channel_member_names(struct Client *source_p, struct Channel *chptr,
int multi_prefix = HasCap(source_p, CAP_MULTI_PREFIX) != 0;
int uhnames = HasCap(source_p, CAP_UHNAMES) != 0;
- if (PubChannel(chptr) || is_member)
+ if (PubChannel(chptr) || is_member || HasUMode(source_p, UMODE_GOD))
{
t = lbuf + snprintf(lbuf, sizeof(lbuf), form_str(RPL_NAMREPLY),
me.name, source_p->name,
@@ -447,7 +447,8 @@ channel_member_names(struct Client *source_p, struct Channel *chptr,
{
const struct Membership *ms = ptr->data;
- if (HasUMode(ms->client_p, UMODE_INVISIBLE) && !is_member)
+ if (HasUMode(ms->client_p, UMODE_INVISIBLE) && !is_member &&
+ !HasUMode(source_p, UMODE_GOD))
continue;
if (!uhnames)
@@ -750,7 +751,8 @@ can_send(struct Channel *chptr, struct Client *source_p,
{
struct MaskItem *conf = NULL;
- if (IsServer(source_p) || HasFlag(source_p, FLAGS_SERVICE) || HasUMode(source_p, UMODE_GCHANOP))
+ if (IsServer(source_p) || HasFlag(source_p, FLAGS_SERVICE) ||
+ HasUMode(source_p, UMODE_GOD))
return CAN_SEND_OPV;
if (MyClient(source_p) && !IsExemptResv(source_p))
diff --git a/src/channel_mode.c b/src/channel_mode.c
index b4d2373..b5c1abc 100644
--- a/src/channel_mode.c
+++ b/src/channel_mode.c
@@ -1595,7 +1595,7 @@ get_channel_access(const struct Client *source_p,
const struct Membership *member)
{
/* Let hacked servers in for now... */
- if (!MyClient(source_p) || HasUMode(source_p, UMODE_GCHANOP))
+ if (!MyClient(source_p))
return CHACCESS_CHANOP;
if (member == NULL)
@@ -1612,6 +1612,9 @@ get_channel_access(const struct Client *source_p,
return CHACCESS_HALFOP;
#endif
+ if (HasUMode(source_p, UMODE_GOD))
+ return CHACCESS_GOD;
+
return CHACCESS_PEON;
}
diff --git a/src/conf.c b/src/conf.c
index 3bf306a..9628962 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -1172,7 +1172,7 @@ set_default_conf(void)
ConfigFileEntry.true_no_oper_flood = 0;
ConfigFileEntry.oper_pass_resv = 1;
ConfigFileEntry.max_targets = MAX_TARGETS_DEFAULT;
- ConfigFileEntry.oper_only_umodes = UMODE_GCHANOP | UMODE_DEBUG;
+ ConfigFileEntry.oper_only_umodes = UMODE_GOD | UMODE_DEBUG;
ConfigFileEntry.oper_umodes = UMODE_BOTS | UMODE_LOCOPS | UMODE_SERVNOTICE |
UMODE_OPERWALL | UMODE_WALLOP;
ConfigFileEntry.use_egd = 0;
diff --git a/src/conf_parser.y b/src/conf_parser.y
index efb1176..a626270 100644
--- a/src/conf_parser.y
+++ b/src/conf_parser.y
@@ -1264,7 +1264,7 @@ oper_umodes_item: T_BOTS
} | T_GCHANOPS
{
if (conf_parser_ctx.pass == 2)
- block_state.modes.value |= UMODE_GCHANOP;
+ block_state.modes.value |= UMODE_GOD;
};
oper_flags: IRCD_FLAGS
@@ -2789,7 +2789,7 @@ umode_oitem: T_BOTS
ConfigFileEntry.oper_umodes |= UMODE_FARCONNECT;
} | T_GCHANOPS
{
- ConfigFileEntry.oper_umodes |= UMODE_GCHANOP;
+ ConfigFileEntry.oper_umodes |= UMODE_GOD;
};
general_oper_only_umodes: OPER_ONLY_UMODES
@@ -2863,7 +2863,7 @@ umode_item: T_BOTS
ConfigFileEntry.oper_only_umodes |= UMODE_FARCONNECT;
} | T_GCHANOPS
{
- ConfigFileEntry.oper_only_umodes |= UMODE_GCHANOP;
+ ConfigFileEntry.oper_only_umodes |= UMODE_GOD;
};
general_min_nonwildcard: MIN_NONWILDCARD '=' NUMBER ';'
diff --git a/src/s_user.c b/src/s_user.c
index 9482508..b9a9a64 100644
--- a/src/s_user.c
+++ b/src/s_user.c
@@ -99,7 +99,7 @@ const unsigned int user_modes[256] =
0, /* L */
0, /* M */
0, /* N */
- UMODE_GCHANOP, /* O */
+ UMODE_GOD, /* O */
0, /* P */
0, /* Q */
UMODE_REGONLY, /* R */