mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-02 14:53:14 +02:00
- #0003139 reported by vonitsanet, improving error messages on /connect
when trying to /connect to a server with wildcards (* and ?) in the link block. We also raise an error if link::options::autoconnect is used together with wildcards in hostname.
This commit is contained in:
@@ -1653,3 +1653,8 @@ MOTDs
|
||||
accidentially.
|
||||
- #0002318 reported by Stealth, regarding small error in oper block
|
||||
documentation
|
||||
- #0003139 reported by vonitsanet, improving error messages on /connect
|
||||
when trying to /connect to a server with wildcards (* and ?) in the link
|
||||
block. We also raise an error if link::options::autoconnect is used
|
||||
together with wildcards in hostname.
|
||||
|
||||
|
||||
+10
-1
@@ -169,16 +169,25 @@ DLLFUNC CMD_FUNC(m_connect)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Evaluate deny link */
|
||||
for (deny = conf_deny_link; deny; deny = (ConfigItem_deny_link *) deny->next) {
|
||||
if (deny->flag.type == CRULE_ALL && !match(deny->mask, aconf->servername)
|
||||
&& crule_eval(deny->rule)) {
|
||||
sendto_one(sptr,
|
||||
":%s %s %s :Connect: Disallowed by connection rule",
|
||||
":%s %s %s :*** Connect: Disallowed by connection rule",
|
||||
me.name, IsWebTV(sptr) ? "PRIVMSG" : "NOTICE", parv[0]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (strchr(aconf->hostname, '*') != NULL || strchr(aconf->hostname, '?') != NULL)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s %s %s :*** Connect: You cannot connect to a server with wildcards (* and ?) in the hostname",
|
||||
me.name, IsWebTV(sptr) ? "PRIVMSG" : "NOTICE", parv[0]);
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
** Notify all operators about remote connect requests
|
||||
*/
|
||||
|
||||
+17
-1
@@ -5809,6 +5809,8 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce)
|
||||
char has_passwordreceive = 0, has_passwordconnect = 0, has_class = 0;
|
||||
char has_hub = 0, has_leaf = 0, has_leafdepth = 0, has_ciphers = 0;
|
||||
char has_options = 0;
|
||||
char has_autoconnect = 0;
|
||||
char has_hostname_wildcards = 0;
|
||||
#ifdef ZIP_LINKS
|
||||
char has_compressionlevel = 0;
|
||||
#endif
|
||||
@@ -5875,7 +5877,11 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce)
|
||||
cep->ce_fileptr->cf_filename, cep->ce_varlinenum, ce->ce_vardata);
|
||||
errors++;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if (ofp->flag == CONNECT_AUTO)
|
||||
{
|
||||
has_autoconnect = 1;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -5918,6 +5924,10 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce)
|
||||
errors++;
|
||||
}
|
||||
#endif
|
||||
if (strchr(cep->ce_vardata, '*') != NULL || strchr(cep->ce_vardata, '?'))
|
||||
{
|
||||
has_hostname_wildcards = 1;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(cep->ce_varname, "bind-ip"))
|
||||
{
|
||||
@@ -6090,6 +6100,12 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce)
|
||||
"link::class");
|
||||
errors++;
|
||||
}
|
||||
if (has_autoconnect || has_hostname_wildcards)
|
||||
{
|
||||
config_error("%s:%i: link block with autoconnect and wildcards (* and/or ? in hostname)",
|
||||
ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
|
||||
errors++;
|
||||
}
|
||||
if (errors > 0)
|
||||
return errors;
|
||||
for (cep = ce->ce_entries; cep; cep = cep->ce_next)
|
||||
|
||||
Reference in New Issue
Block a user