Fixed IP bans preventing non-banned players from connecting to SQLite-backed servers (#31154)

Fixed IP bans causing server errors with SQLite DB
This commit is contained in:
TGRCDev
2024-08-18 04:53:09 -07:00
committed by GitHub
parent 77a60bd3b8
commit 517f7ad344
2 changed files with 9 additions and 1 deletions

View File

@@ -61,6 +61,12 @@ namespace Content.Server.IP
public static bool IsInSubnet(this System.Net.IPAddress address, System.Net.IPAddress maskAddress, int maskLength)
{
if (maskAddress.AddressFamily != address.AddressFamily)
{
// We got something like an IPV4-Address for an IPv6-Mask. This is not valid.
return false;
}
if (maskAddress.AddressFamily == AddressFamily.InterNetwork)
{
// Convert the mask address to an unsigned integer.
@@ -89,7 +95,7 @@ namespace Content.Server.IP
if (maskAddressBits.Length != ipAddressBits.Length)
{
throw new ArgumentException("Length of IP Address and Subnet Mask do not match.");
return false;
}
// Compare the prefix bits.