minor fixes

This commit is contained in:
Miraty 2023-08-13 19:50:45 +02:00
parent 40d6994126
commit 2ebf1eee2a
2 changed files with 2 additions and 3 deletions

View file

@ -1,5 +1,6 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
umask(0077); umask(0077);
const LF = "\n";
set_error_handler(function ($level, $message, $file = '', $line = 0) { set_error_handler(function ($level, $message, $file = '', $line = 0) {
throw new ErrorException($message, 0, $level, $file, $line); throw new ErrorException($message, 0, $level, $file, $line);
@ -36,8 +37,6 @@ header('Content-Language: ' . LOCALE);
const SERVICES_USER = ['reg', 'ns', 'ht']; const SERVICES_USER = ['reg', 'ns', 'ht'];
const LF = "\n";
const PLACEHOLDER_DOMAIN = 'example'; // From RFC2606: Reserved Top Level DNS Names > 2. TLDs for Testing, & Documentation Examples const PLACEHOLDER_DOMAIN = 'example'; // From RFC2606: Reserved Top Level DNS Names > 2. TLDs for Testing, & Documentation Examples
const PLACEHOLDER_IPV6 = '2001:db8::3'; // From RFC3849: IPv6 Address Prefix Reserved for Documentation const PLACEHOLDER_IPV6 = '2001:db8::3'; // From RFC3849: IPv6 Address Prefix Reserved for Documentation
const PLACEHOLDER_IPV4 = '203.0.113.42'; // From RFC5737: IPv4 Address Blocks Reserved for Documentation const PLACEHOLDER_IPV4 = '203.0.113.42'; // From RFC5737: IPv4 Address Blocks Reserved for Documentation

View file

@ -11,7 +11,7 @@ if ($parent_authoritatives === [])
foreach ($parent_authoritatives as $parent_authoritative) foreach ($parent_authoritatives as $parent_authoritative)
checkAbsoluteDomainFormat($parent_authoritative); checkAbsoluteDomainFormat($parent_authoritative);
$ns_records = array_column(kdig(name: $_POST['domain'], type: 'NS', server: (CONF['ns']['local_only_check'] ? CONF['reg']['address'] : $parentAuthoritatives[0]))['authorityRRs'], 'rdataNS'); $ns_records = array_column(kdig(name: $_POST['domain'], type: 'NS', server: (CONF['ns']['local_only_check'] ? CONF['reg']['address'] : $parent_authoritative[0]))['authorityRRs'], 'rdataNS');
if (preg_match('/^(?<salt>[0-9a-f]{8})-(?<hash>[0-9a-f]{32})\._domain-verification\.' . preg_quote(SERVER_NAME, '/') . '\.$/Dm', implode(LF, $ns_records), $matches) !== 1) if (preg_match('/^(?<salt>[0-9a-f]{8})-(?<hash>[0-9a-f]{32})\._domain-verification\.' . preg_quote(SERVER_NAME, '/') . '\.$/Dm', implode(LF, $ns_records), $matches) !== 1)
output(403, _('NS authentication record not found.')); output(403, _('NS authentication record not found.'));