Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error algo: fetchPublicKeys with dns_get_record #12

Open
jetsam729 opened this issue Mar 9, 2021 · 0 comments
Open

error algo: fetchPublicKeys with dns_get_record #12

jetsam729 opened this issue Mar 9, 2021 · 0 comments

Comments

@jetsam729
Copy link

validator.php line:296

    public static function fetchPublicKeys(string $domain, string $selector)
    {
        $host = sprintf('%s._domainkey.%s', $selector, $domain);
        $textRecords = dns_get_record($host, DNS_TXT);

        if ($textRecords === false) {
            return false;
        }

dns_get_record return FALSE if error dns/internet/format domain.
if no record - dns_get_record return EMPTY ARRAY - not FALSE!
try: var_export(dns_get_record('ssss1ss sssssssss.zzzzzzzzzzz', DNS_TXT)); - return FALSE (space at domain)
try: var_export(dns_get_record('ssss1sssssssssss.zzzzzzzzzzz', DNS_TXT)); - return array()

if false - this error get aka TEMPFAIL
if empty array - NO REC or NO DOMAIN aka PERMFAIL
must be as:

 if ($textRecords === false || empty($textRecords)) {
            return $textRecords;
        }

line:165

                if ($dnsKeys === false) {
                    $output[$signatureIndex][] = [
                        'status' => 'TEMPFAIL',
                        'reason' => 'Public key not found in DNS',
                    ];
                    continue;
                }

must as ~

                 if ($dnsKeys === false) {
                    $output[$signatureIndex][] = [
                        'status' => 'TEMPFAIL',
                        'reason' => 'Error DNS or NETWORK',
                    ];
                    continue;
                }
                if (empty($dnsKeys)) {
                    $output[$signatureIndex][] = [
                        'status' => 'PERMFAIL',
                        'reason' => 'Public key not found in DNS',
                    ];
                    continue;
                }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant