mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-03-24 14:30:01 +00:00
DropRequests: fixed issue in BlockedQuestion caused due to unknown type causing it to match with all requests.
This commit is contained in:
@@ -153,10 +153,17 @@ namespace DropRequests
|
||||
if (jsonQuestion.TryGetProperty("blockZone", out JsonElement jsonBlockZone))
|
||||
_blockZone = jsonBlockZone.GetBoolean();
|
||||
|
||||
if (jsonQuestion.TryGetProperty("type", out JsonElement jsonType) && Enum.TryParse(jsonType.GetString(), true, out DnsResourceRecordType type))
|
||||
if (jsonQuestion.TryGetProperty("type", out JsonElement jsonType))
|
||||
{
|
||||
if (!Enum.TryParse(jsonType.GetString(), true, out DnsResourceRecordType type))
|
||||
throw new NotSupportedException("DNS record type is not supported: " + jsonType.GetString());
|
||||
|
||||
_type = type;
|
||||
}
|
||||
else
|
||||
{
|
||||
_type = DnsResourceRecordType.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user