1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-29 02:16:39 +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
+4
View File
@@ -3172,3 +3172,7 @@ This is the 3.2 fixes branch.
- Imported TRE 0.6.7 for *nix and made use of tre_version to report the version of TRE
in use at startup
- Fixed a Win32 module bug
- 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).
+5
View File
@@ -502,6 +502,7 @@ into spaces at runtime. And double underscore ('__') gets an underscore ('_'). A
<p><b>set::spamfilter::ban-time</b> allows you to modify the default ban time for *lines added by spamfilter (default: 1 day)<br>
<b>set::spamfilter::ban-reason</b> allows you to specify a default reason for the *lines (default: 'Spam/advertising')<br>
<b>set::spamfilter::virus-help-channel</b> allows you to specify the channel to join for action 'viruschan' (default: #help)<br>
<b>set::spamfilter::virus-help-channel-deny</b> allows you to block any normal joins to virus-help-channel (default: no)<br>
</p></div>
<p><font size="+2"><b>3.15 - Other features</b></font><a name="feature_other"></a></p><div class="desc">
@@ -2170,6 +2171,10 @@ set {
Reason to be used for *lines added by spamfilter</p>
<p><font class="set">set::spamfilter::virus-help-channel &lt;channel&gt;</font><br>
The channel to use for the 'viruschan' action in spamfilter</p>
<p><font class="set">set::spamfilter::virus-help-channel-deny &lt;yes|no&gt;</font><br>
If set to yes (or '1') it replies 'invite only' to any normal users that try to join
the virus-help-channel. Only opers, people that match spamfilters and people that
are /invite'd can join.</p>
<p><font class="set">set::spamfilter::except &lt;target(s)&gt;</font><br>
These targets are exempt from spam filtering (no action will be taken),
can be single target or comma seperated list.. Ex: except "#help,#spamreport"</p>
+2
View File
@@ -134,6 +134,7 @@ struct zConfiguration {
long spamfilter_ban_time;
char *spamfilter_ban_reason;
char *spamfilter_virus_help_channel;
char spamfilter_vchan_deny;
SpamExcept *spamexcept;
char *spamexcept_line;
aNetwork network;
@@ -230,4 +231,5 @@ extern MODVAR aConfiguration iConf;
#define SPAMFILTER_BAN_TIME iConf.spamfilter_ban_time
#define SPAMFILTER_BAN_REASON iConf.spamfilter_ban_reason
#define SPAMFILTER_VIRUSCHAN iConf.spamfilter_virus_help_channel
#define SPAMFILTER_VIRUSCHANDENY iConf.spamfilter_vchan_deny
#define SPAMFILTER_EXCEPT iConf.spamexcept_line
+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));