1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2024-12-23 02:04:46 +02:00

Make DNS lookups fail gracefully.

This commit is contained in:
Sebastian Marsching 2023-10-12 21:47:29 +02:00
parent c4a158ea81
commit d8161e6fe2

View File

@ -56,7 +56,7 @@ header('Content-Type: application/xml');
<?php <?php
$records = dns_get_record('_pop3s._tcp.' . $domain, DNS_SRV); // check if POP3 is announced as "not provided" via SRV record $records = dns_get_record('_pop3s._tcp.' . $domain, DNS_SRV); // check if POP3 is announced as "not provided" via SRV record
if (count($records) == 0 || $records[0]['target'] != '') { ?> if ($records === FALSE || count($records) == 0 || $records[0]['target'] != '') { ?>
<incomingServer type="pop3"> <incomingServer type="pop3">
<hostname><?=$autodiscover_config['pop3']['server']; ?></hostname> <hostname><?=$autodiscover_config['pop3']['server']; ?></hostname>
<port><?=$autodiscover_config['pop3']['port']; ?></port> <port><?=$autodiscover_config['pop3']['port']; ?></port>
@ -67,7 +67,7 @@ if (count($records) == 0 || $records[0]['target'] != '') { ?>
<?php } ?> <?php } ?>
<?php <?php
$records = dns_get_record('_pop3._tcp.' . $domain, DNS_SRV); // check if POP3 is announced as "not provided" via SRV record $records = dns_get_record('_pop3._tcp.' . $domain, DNS_SRV); // check if POP3 is announced as "not provided" via SRV record
if (count($records) == 0 || $records[0]['target'] != '') { ?> if ($records === FALSE || count($records) == 0 || $records[0]['target'] != '') { ?>
<incomingServer type="pop3"> <incomingServer type="pop3">
<hostname><?=$autodiscover_config['pop3']['server']; ?></hostname> <hostname><?=$autodiscover_config['pop3']['server']; ?></hostname>
<port><?=$autodiscover_config['pop3']['tlsport']; ?></port> <port><?=$autodiscover_config['pop3']['tlsport']; ?></port>