@@ -76,7 +76,7 @@ protected function doIsIPAllowed($ipAddress, $domain, $resetRequestCount)
76
76
$ this ->redirect = null ;
77
77
if ($ resetRequestCount ) {
78
78
$ this ->voidLookup = 0 ;
79
- $ this ->DNSRecordGetter ->resetRequestCount ();
79
+ $ this ->DNSRecordGetter ->resetRequestCounts ();
80
80
}
81
81
82
82
// Handle IPv4 address in IPv6 format
@@ -92,6 +92,12 @@ protected function doIsIPAllowed($ipAddress, $domain, $resetRequestCount)
92
92
return $ result ;
93
93
}
94
94
95
+ /**
96
+ * @param $ipAddress
97
+ * @param $domain
98
+ * @return bool|string
99
+ * @throws DNSLookupException
100
+ */
95
101
private function doCheck ($ ipAddress , $ domain )
96
102
{
97
103
try {
@@ -141,6 +147,14 @@ private function doCheck($ipAddress, $domain)
141
147
return self ::RESULT_NEUTRAL ;
142
148
}
143
149
150
+ /**
151
+ * @param $ipAddress
152
+ * @param $part
153
+ * @param $matchingDomain
154
+ * @return bool
155
+ * @throws DNSLookupLimitReachedException
156
+ * @throws DNSLookupException
157
+ */
144
158
protected function ipMatchesPart ($ ipAddress , $ part , $ matchingDomain )
145
159
{
146
160
$ qualifier = substr ($ part , 0 , 1 );
@@ -242,10 +256,8 @@ protected function ipMatchesPart($ipAddress, $part, $matchingDomain)
242
256
$ validIpAddresses = [];
243
257
$ this ->DNSRecordGetter ->countRequest ();
244
258
$ mxServers = $ this ->DNSRecordGetter ->resolveMx ($ domain );
245
- if (count ($ mxServers ) > 10 ) {
246
- return self ::RESULT_PERMERROR ;
247
- }
248
259
foreach ($ mxServers as $ mxServer ) {
260
+ $ this ->DNSRecordGetter ->countMxRequest ();
249
261
if (false !== filter_var ($ mxServer , FILTER_VALIDATE_IP )) {
250
262
$ validIpAddresses [] = $ mxServer ;
251
263
} else {
@@ -277,6 +289,7 @@ protected function ipMatchesPart($ipAddress, $part, $matchingDomain)
277
289
$ ptrRecords = $ this ->DNSRecordGetter ->resolvePtr ($ ipAddress );
278
290
$ validatedSendingDomainNames = array ();
279
291
foreach ($ ptrRecords as $ ptrRecord ) {
292
+ $ this ->DNSRecordGetter ->countPtrRequest ();
280
293
$ ptrRecord = strtolower ($ ptrRecord );
281
294
$ ipAddresses = $ this ->DNSRecordGetter ->resolveA ($ ptrRecord );
282
295
if (in_array ($ ipAddress , $ ipAddresses )) {
0 commit comments