1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-05 11:53:13 +02:00

- Added set::spamfilter::virus-help-channel-deny. This allows you to block any

normal joins to the virus-help-channel. This way you could prevent users into
  accidental (or tricked) joining of the virus-help-channel and becomming infected.
  This feature is disabled by default. Requested by bleepy (#0001811).
This commit is contained in:
Bram Matthys
2004-05-18 00:39:45 +00:00
parent 6d09e29d0c
commit 76f0f87fdd
7 changed files with 53 additions and 2 deletions
+23 -1
View File
@@ -65,6 +65,7 @@ long opermode = 0;
aChannel *channel = NullChn;
extern char backupbuf[];
extern ircstats IRCstats;
extern int spamf_ugly_vchanoverride;
#ifndef NO_FDLIST
extern int lifesux;
@@ -3351,7 +3352,6 @@ Ban *banned;
#endif
#endif
return 0;
}
@@ -3912,6 +3912,28 @@ CMD_FUNC(do_join)
}
}
}
/* ugly set::spamfilter::virus-help-channel-deny hack.. */
if (SPAMFILTER_VIRUSCHANDENY && SPAMFILTER_VIRUSCHAN &&
!strcasecmp(name, SPAMFILTER_VIRUSCHAN) &&
!IsAnOper(sptr) && !spamf_ugly_vchanoverride)
{
int invited = 0;
Link *lp;
aChannel *chptr = find_channel(name, NULL);
if (chptr)
{
for (lp = sptr->user->invited; lp; lp = lp->next)
if (lp->value.chptr == chptr)
invited = 1;
}
if (!invited)
{
sendnotice(sptr, "*** Cannot join '%s' because it's the virus-help-channel which is "
"reserved for infected users only", name);
continue;
}
}
}
chptr = get_channel(sptr, name, CREATE);
+9
View File
@@ -193,6 +193,15 @@ DLLFUNC CMD_FUNC(m_invite)
}
}
if (MyClient(sptr) && SPAMFILTER_VIRUSCHANDENY && SPAMFILTER_VIRUSCHAN &&
!strcasecmp(chptr->chname, SPAMFILTER_VIRUSCHAN) &&
!is_chan_op(sptr, chptr) && !IsAnOper(sptr) && !IsULine(sptr))
{
sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED),
me.name, parv[0], chptr->chname);
return -1;
}
if (MyConnect(sptr))
{
if (check_for_target_limit(sptr, acptr, acptr->name))
+4
View File
@@ -5824,6 +5824,8 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce)
ircstrdup(tempiConf.spamfilter_ban_reason, cepp->ce_vardata);
if (!strcmp(cepp->ce_varname, "virus-help-channel"))
ircstrdup(tempiConf.spamfilter_virus_help_channel, cepp->ce_vardata);
if (!strcmp(cepp->ce_varname, "virus-help-channel-deny"))
tempiConf.spamfilter_vchan_deny = config_checkval(cepp->ce_vardata,CFG_YESNO);
if (!strcmp(cepp->ce_varname, "except"))
{
char *name, *p;
@@ -6442,6 +6444,8 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce)
continue;
}
} else
if (!strcmp(cepp->ce_varname, "virus-help-channel-deny"))
{ } else
if (!strcmp(cepp->ce_varname, "except"))
{ } else
{
+6 -1
View File
@@ -43,6 +43,7 @@
aTKline *tklines[TKLISTLEN];
extern MODVAR char zlinebuf[BUFSIZE];
int spamf_ugly_vchanoverride = 0;
/** tkl hash method.
* NOTE1: the input value 'c' is assumed to be in range a-z or A-Z!
@@ -1434,6 +1435,7 @@ char *str = (char *)StripControlCodes(str_in);
{
char *xparv[3], chbuf[CHANNELLEN + 16];
aChannel *chptr;
int ret;
if (IsVirus(sptr)) /* Already tagged */
return 0;
@@ -1442,7 +1444,10 @@ char *str = (char *)StripControlCodes(str_in);
xparv[1] = buf;
xparv[2] = NULL;
/* RECURSIVE CAUTION in case we ever add blacklisted chans */
if (m_join(sptr, sptr, 2, xparv) == FLUSH_BUFFER)
spamf_ugly_vchanoverride = 1;
ret = m_join(sptr, sptr, 2, xparv);
spamf_ugly_vchanoverride = 0;
if (ret == FLUSH_BUFFER)
return FLUSH_BUFFER; /* don't ask me how we could have died... */
sendnotice(sptr, "You are now restricted to talking in %s: %s",
SPAMFILTER_VIRUSCHAN, unreal_decodespace(tk->spamf->tkl_reason));