mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-08 18:33:13 +02:00
Fix read-after-free when linking in a server (that is fully authenticated)
when there is already another established link with a server with the same name. For example, when there is a network issue and the "old server" is still waiting to be timed out and the "new server" is already linking in.
This commit is contained in:
+1
-1
@@ -148,7 +148,7 @@ extern ConfigItem_listen *find_listen(const char *ipmask, int port, SocketType s
|
||||
extern ConfigItem_sni *find_sni(const char *name);
|
||||
extern ConfigItem_ulines *find_uline(const char *host);
|
||||
extern ConfigItem_tld *find_tld(Client *cptr);
|
||||
extern ConfigItem_link *find_link(const char *servername, Client *acptr);
|
||||
extern ConfigItem_link *find_link(const char *servername);
|
||||
extern ConfigItem_ban *find_ban(Client *, const char *host, short type);
|
||||
extern ConfigItem_ban *find_banEx(Client *,const char *host, short type, short type2);
|
||||
extern ConfigItem_vhost *find_vhost(const char *name);
|
||||
|
||||
+3
-4
@@ -3066,15 +3066,14 @@ ConfigItem_tld *find_tld(Client *client)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
ConfigItem_link *find_link(const char *servername, Client *client)
|
||||
/** Find a link block by server name (but don't check any restrictions like IP or auth) */
|
||||
ConfigItem_link *find_link(const char *servername)
|
||||
{
|
||||
ConfigItem_link *link;
|
||||
|
||||
for (link = conf_link; link; link = link->next)
|
||||
{
|
||||
if (match_simple(link->servername, servername) &&
|
||||
user_allowed_by_security_group(client, link->incoming.match))
|
||||
if (!link->flag.temporary && match_simple(link->servername, servername))
|
||||
{
|
||||
return link;
|
||||
}
|
||||
|
||||
@@ -684,9 +684,7 @@ ConfigItem_link *_verify_link(Client *client)
|
||||
goto skip_host_check;
|
||||
} else {
|
||||
/* Hunt the linkblock down ;) */
|
||||
for(link = conf_link; link; link = link->next)
|
||||
if (match_simple(link->servername, client->name))
|
||||
break;
|
||||
link = find_link(client->name);
|
||||
}
|
||||
|
||||
if (!link)
|
||||
@@ -707,9 +705,7 @@ ConfigItem_link *_verify_link(Client *client)
|
||||
}
|
||||
|
||||
orig_link = link;
|
||||
link = find_link(client->name, client);
|
||||
|
||||
if (!link)
|
||||
if (!user_allowed_by_security_group(client, link->incoming.match))
|
||||
{
|
||||
unreal_log(ULOG_ERROR, "link", "LINK_DENIED_INCOMING_MASK_MISMATCH", client,
|
||||
"Link with server $client.details denied: Server is in link block but link::incoming::mask didn't match",
|
||||
|
||||
Reference in New Issue
Block a user