From e1dd8acd72fa5b80ec28fc759e3a5ee1eadc25b2 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Tue, 4 Jul 2006 10:05:18 +0000 Subject: [PATCH] - Made it so undefining SHOW_SECRET (not the default) properly hides +s channels from ircops (except netadmins), as it should. Reported and patch supplied by Jason (#0002965). --- Changes | 2 ++ include/struct.h | 5 +++++ src/modules/m_list.c | 6 +++--- src/modules/m_names.c | 2 +- src/modules/m_topic.c | 2 +- src/modules/m_who.c | 2 +- src/modules/m_whois.c | 6 +----- src/modules/webtv.c | 8 ++------ 8 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Changes b/Changes index 583819d50..a53de66ee 100644 --- a/Changes +++ b/Changes @@ -1265,3 +1265,5 @@ - Added HOOKTYPE_SILENCED: this is called whenever a message did not get delivered to a user because the user was on the silence list. - Added OpenBSD 3.9 to the supported OS list. +- Made it so undefining SHOW_SECRET (not the default) properly hides +s channels from ircops + (except netadmins), as it should. Reported and patch supplied by Jason (#0002965). diff --git a/include/struct.h b/include/struct.h index ba1e330a1..5a8962148 100644 --- a/include/struct.h +++ b/include/struct.h @@ -613,6 +613,11 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ #define OPIsNetAdmin(x) ((x)->oflag & OFLAG_NETADMIN) #define OPIsCoAdmin(x) ((x)->oflag & OFLAG_COADMIN) #define OPIsWhois(x) ((x)->oflag & OFLAG_WHOIS) +#ifdef SHOW_SECRET +#define OPCanSeeSecret(x) IsAnOper(x) +#else +#define OPCanSeeSecret(x) IsNetAdmin(x) +#endif #define OPSetRehash(x) ((x)->oflag |= OFLAG_REHASH) #define OPSetDie(x) ((x)->oflag |= OFLAG_DIE) diff --git a/src/modules/m_list.c b/src/modules/m_list.c index 73dd17363..0fe5a9f1b 100644 --- a/src/modules/m_list.c +++ b/src/modules/m_list.c @@ -269,7 +269,7 @@ DLLFUNC CMD_FUNC(m_list) else /* Just a normal channel */ { chptr = find_channel(name, NullChn); - if (chptr && (ShowChannel(sptr, chptr) || IsAnOper(sptr))) { + if (chptr && (ShowChannel(sptr, chptr) || OPCanSeeSecret(sptr))) { #ifdef LIST_SHOW_MODES modebuf[0] = '['; channel_modes(sptr, &modebuf[1], parabuf, chptr); @@ -364,7 +364,7 @@ void _send_list(aClient *cptr, int numsend) { if (SecretChannel(chptr) && !IsMember(cptr, chptr) - && !IsAnOper(cptr)) + && !OPCanSeeSecret(cptr)) continue; /* Much more readable like this -- codemastr */ @@ -405,7 +405,7 @@ void _send_list(aClient *cptr, int numsend) else strlcat(modebuf, "]", sizeof modebuf); #endif - if (!IsAnOper(cptr)) + if (!OPCanSeeSecret(cptr)) sendto_one(cptr, rpl_str(RPL_LIST), me.name, cptr->name, diff --git a/src/modules/m_names.c b/src/modules/m_names.c index 74bfa1dce..addf65162 100644 --- a/src/modules/m_names.c +++ b/src/modules/m_names.c @@ -126,7 +126,7 @@ DLLFUNC CMD_FUNC(m_names) chptr = find_channel(para, (aChannel *)NULL); - if (!chptr || (!ShowChannel(sptr, chptr) && !IsAnOper(sptr))) + if (!chptr || (!ShowChannel(sptr, chptr) && !OPCanSeeSecret(sptr))) { sendto_one(sptr, rpl_str(RPL_ENDOFNAMES), me.name, parv[0], para); diff --git a/src/modules/m_topic.c b/src/modules/m_topic.c index 601740005..01ed095ac 100644 --- a/src/modules/m_topic.c +++ b/src/modules/m_topic.c @@ -146,7 +146,7 @@ long flags = 0; /* cache: membership flags */ if (parc > 2 || SecretChannel(chptr)) { if (!ismember && !IsServer(sptr) - && !IsOper(sptr) && !IsULine(sptr)) + && !OPCanSeeSecret(sptr) && !IsULine(sptr)) { sendto_one(sptr, err_str(ERR_NOTONCHANNEL), me.name, parv[0], name); diff --git a/src/modules/m_who.c b/src/modules/m_who.c index 1761c7524..d2a47ac5f 100644 --- a/src/modules/m_who.c +++ b/src/modules/m_who.c @@ -796,7 +796,7 @@ static char *first_visible_channel(aClient *sptr, aClient *acptr, int *flg) cansee = 0; if (!cansee) { - if (IsAnOper(sptr)) + if (OPCanSeeSecret(sptr)) *flg |= FVC_HIDDEN; else continue; diff --git a/src/modules/m_whois.c b/src/modules/m_whois.c index 193ad5322..1135202f5 100644 --- a/src/modules/m_whois.c +++ b/src/modules/m_whois.c @@ -209,11 +209,7 @@ DLLFUNC int m_whois(aClient *cptr, aClient *sptr, int parc, char *parv[]) showchannel = 0; if (ShowChannel(sptr, chptr)) showchannel = 1; -#ifndef SHOW_SECRET - if (IsAnOper(sptr) && !SecretChannel(chptr)) -#else - if (IsAnOper(sptr)) -#endif + if (OPCanSeeSecret(sptr)) showchannel = 1; if ((acptr->umodes & UMODE_HIDEWHOIS) && !IsMember(sptr, chptr) && !IsAnOper(sptr)) showchannel = 0; diff --git a/src/modules/webtv.c b/src/modules/webtv.c index c83024b25..c1e6fb929 100644 --- a/src/modules/webtv.c +++ b/src/modules/webtv.c @@ -214,7 +214,7 @@ int w_whois(aClient *cptr, aClient *sptr, int parc, char *parv[]) if (!invis && HiddenChannel(chptr) && !SecretChannel(chptr)) showperson = 1; - else if (IsAnOper(sptr) && SecretChannel(chptr)) { + else if (OPCanSeeSecret(sptr) && SecretChannel(chptr)) { showperson = 1; showsecret = 1; } @@ -266,11 +266,7 @@ int w_whois(aClient *cptr, aClient *sptr, int parc, char *parv[]) showchannel = 0; if (ShowChannel(sptr, chptr)) showchannel = 1; -#ifndef SHOW_SECRET - if (IsAnOper(sptr) && !SecretChannel(chptr)) -#else - if (IsAnOper(sptr)) -#endif + if (OPCanSeeSecret(sptr)) showchannel = 1; if ((acptr->umodes & UMODE_HIDEWHOIS) && !IsMember(sptr, chptr) && !IsAnOper(sptr)) showchannel = 0;