Skip to content

Commit 6dcaff3

Browse files
committed
Removed non-RFC-specified regex validation
1 parent 0d5a784 commit 6dcaff3

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

TechnitiumLibrary.Net/Dns/ResourceRecords/DnsNAPTRRecordData.cs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ You should have received a copy of the GNU General Public License
2222
using System.IO;
2323
using System.Text;
2424
using System.Text.Json;
25-
using System.Text.RegularExpressions;
2625
using System.Threading.Tasks;
2726
using TechnitiumLibrary.IO;
2827

@@ -104,15 +103,6 @@ public DnsNAPTRRecordData(ushort order, ushort preference, string flags, string
104103
throw new ArgumentException(
105104
"Either REGEXP or REPLACEMENT must be specified per RFC 3403.");
106105

107-
// OPTIONAL: Validate regex, not defined in RFC.
108-
// It is a NICE-TO-HAVE, not a MUST.
109-
if (!IsValidRegex(regexp))
110-
{
111-
throw new ArgumentException(
112-
"REGEXP is not a valid regular expression.",
113-
nameof(regexp));
114-
}
115-
116106
// DNS <character-string> constraints
117107
if (DnsClient.IsDomainNameUnicode(replacement))
118108
replacement = DnsClient.ConvertDomainNameToAscii(replacement);
@@ -152,23 +142,6 @@ private void Serialize()
152142
}
153143
}
154144

155-
private bool IsValidRegex(string pattern)
156-
{
157-
if (pattern is null) return false;
158-
try
159-
{
160-
_ = new Regex(
161-
pattern,
162-
RegexOptions.None,
163-
TimeSpan.FromMilliseconds(100));
164-
return true;
165-
}
166-
catch (ArgumentException)
167-
{
168-
return false;
169-
}
170-
}
171-
172145
#endregion
173146

174147
#region protected

0 commit comments

Comments
 (0)