Bug 2857

Summary: ssh 7.7p1 does not find SSHFP records unless you supply the canonical hostname
Product: Portable OpenSSH Reporter: Craig Leres <mindrot10>
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: major    
Priority: P5    
Version: -current   
Hardware: All   
OS: FreeBSD   

Description Craig Leres 2018-04-12 14:03:06 AEST
After upgrading from 7.6p1 to 7.7p1 via the FreeBSD port I found SSHFP records were not being found unless the canonical, fully qualified domain is used. Looking at dns queries, 7.6p1 correctly uses my the dns search path and once it figures out the FQDN, it uses it to look up A, AAAA and SSHFP records. 7.7p1 finds the FQDN and is able to look up the A and AAAA records but uses the non-canonical version of the hostname when looking up the SSHFP records.

I see that this block moved from main() to ssh_session2():

        /* Find canonic host name. */
        if (strchr(host, '.') == 0) {
                struct addrinfo hints;
                struct addrinfo *ai = NULL;
                int errgai;
                memset(&hints, 0, sizeof(hints));
                hints.ai_family = options.address_family;
                hints.ai_flags = AI_CANONNAME;
                hints.ai_socktype = SOCK_STREAM;
                errgai = getaddrinfo(host, NULL, &hints, &ai);
                if (errgai == 0) {
                        if (ai->ai_canonname != NULL)
                                host = xstrdup(ai->ai_canonname);
                        freeaddrinfo(ai);
                }
        }

I'm not sure why it was moved but it's the cause of this issue.
Comment 1 Craig Leres 2018-04-12 14:11:44 AEST
Oops. It looks like the real issue is with a broken FreeBSD port patch and not with openssh-portable 7.7p1. Sorry for the noise!
Comment 2 Damien Miller 2021-04-23 15:10:03 AEST
closing resolved bugs as of 8.6p1 release