mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-10 01:03:12 +02:00
Added ban version {}
This commit is contained in:
@@ -1980,3 +1980,6 @@ seen. gmtime warning still there
|
||||
- Minor /die and /restart code cleanups
|
||||
- Added channel mode +M to 005 (#0000803) reported by jollino
|
||||
- Fixed a bug where +x would make hosts lowercase (#0000810) reported by rayman
|
||||
- Implemented a ban version {} (bans users based on CTCP VERSION). It works by sending out
|
||||
a CTCP VERSION when a user connects then checking the reply. If you don't use any
|
||||
ban version{}'s then no version request is sent so users are not inconvenienced.
|
||||
|
||||
@@ -62,6 +62,7 @@ struct zConfiguration {
|
||||
unsigned fail_oper_warn:1;
|
||||
unsigned show_connect_info:1;
|
||||
unsigned dont_resolve:1;
|
||||
unsigned use_ban_version:1;
|
||||
unsigned use_egd;
|
||||
long host_timeout;
|
||||
int host_retries;
|
||||
@@ -150,3 +151,4 @@ extern aConfiguration iConf;
|
||||
#ifdef THROTTLING
|
||||
#define THROTTLING_PERIOD iConf.throttle_period
|
||||
#endif
|
||||
#define USE_BAN_VERSION iConf.use_ban_version
|
||||
|
||||
@@ -903,6 +903,7 @@ struct _configflag_tld
|
||||
#define CONF_BAN_SERVER 3
|
||||
#define CONF_BAN_USER 4
|
||||
#define CONF_BAN_REALNAME 5
|
||||
#define CONF_BAN_VERSION 6
|
||||
|
||||
#define CONF_BAN_TYPE_CONF 0
|
||||
#define CONF_BAN_TYPE_AKILL 1
|
||||
|
||||
@@ -1239,6 +1239,7 @@ void config_rehash()
|
||||
ConfigItem_help *help_ptr;
|
||||
ListStruct *next, *next2;
|
||||
|
||||
USE_BAN_VERSION = 0;
|
||||
/* clean out stuff that we don't use */
|
||||
for (admin_ptr = conf_admin; admin_ptr; admin_ptr = (ConfigItem_admin *)next)
|
||||
{
|
||||
@@ -4650,6 +4651,11 @@ int _conf_ban(ConfigFile *conf, ConfigEntry *ce)
|
||||
ca->flag.type = CONF_BAN_USER;
|
||||
else if (!strcmp(ce->ce_vardata, "realname"))
|
||||
ca->flag.type = CONF_BAN_REALNAME;
|
||||
else if (!strcmp(ce->ce_vardata, "version"))
|
||||
{
|
||||
ca->flag.type = CONF_BAN_VERSION;
|
||||
tempiConf.use_ban_version = 1;
|
||||
}
|
||||
else {
|
||||
int value;
|
||||
for (global_i = Hooks[HOOKTYPE_CONFIGRUN]; global_i;
|
||||
@@ -4691,6 +4697,8 @@ int _test_ban(ConfigFile *conf, ConfigEntry *ce)
|
||||
{}
|
||||
else if (!strcmp(ce->ce_vardata, "realname"))
|
||||
{}
|
||||
else if (!strcmp(ce->ce_vardata, "version"))
|
||||
{}
|
||||
else
|
||||
{
|
||||
int used = 0;
|
||||
|
||||
+8
-1
@@ -1724,7 +1724,6 @@ CMD_FUNC(m_nick)
|
||||
me.name, nick, sptr->nospoof, sptr->nospoof);
|
||||
sendto_one(sptr, "PING :%X", sptr->nospoof);
|
||||
#endif /* NOSPOOF */
|
||||
|
||||
#ifdef CONTACT_EMAIL
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** If you need assistance with a"
|
||||
@@ -1762,11 +1761,15 @@ CMD_FUNC(m_nick)
|
||||
** may reject the client and call exit_client for it
|
||||
** --must test this and exit m_nick too!!!
|
||||
*/
|
||||
if (USE_BAN_VERSION)
|
||||
sendto_one(sptr, ":IRC PRIVMSG %s :\1VERSION\1",
|
||||
nick);
|
||||
sptr->lastnick = TStime(); /* Always local client */
|
||||
if (register_user(cptr, sptr, nick,
|
||||
sptr->user->username, NULL, NULL) == FLUSH_BUFFER)
|
||||
return FLUSH_BUFFER;
|
||||
update_watch = 0;
|
||||
|
||||
}
|
||||
}
|
||||
/*
|
||||
@@ -1978,6 +1981,10 @@ CMD_FUNC(m_user)
|
||||
if (sptr->name[0] && (IsServer(cptr) ? 1 : IsNotSpoof(sptr)))
|
||||
/* NICK and no-spoof already received, now we have USER... */
|
||||
{
|
||||
if (USE_BAN_VERSION)
|
||||
sendto_one(sptr, ":IRC PRIVMSG %s :\1VERSION\1",
|
||||
sptr->name);
|
||||
|
||||
return(
|
||||
register_user(cptr, sptr, sptr->name, username, umodex,
|
||||
virthost));
|
||||
|
||||
+18
@@ -49,10 +49,15 @@ struct zMessage {
|
||||
|
||||
|
||||
int w_whois(aClient *cptr, aClient *sptr, int parc, char *parv[]);
|
||||
/* This really has nothing to do with WebTV yet, but eventually it will, so I figured
|
||||
* it's easiest to put it here so why not? -- codemastr
|
||||
*/
|
||||
int ban_version(aClient *cptr, aClient *sptr, int parc, char *parv[]);
|
||||
|
||||
aMessage webtv_cmds[] =
|
||||
{
|
||||
{"WHOIS", w_whois, 15},
|
||||
{"\1VERSION", ban_version, 1},
|
||||
{NULL, 0, 15}
|
||||
};
|
||||
|
||||
@@ -380,3 +385,16 @@ int w_whois(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
int ban_version(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
{
|
||||
int len;
|
||||
ConfigItem_ban *ban;
|
||||
if (parc < 2)
|
||||
return 0;
|
||||
len = strlen(parv[1]);
|
||||
if (parv[1][len-1] == '\1')
|
||||
parv[1][len-1] = '\0';
|
||||
if ((ban = Find_ban(parv[1], CONF_BAN_VERSION)))
|
||||
return exit_client(cptr, sptr, sptr, ban->reason);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user