Using ssh to connect to a host defined in /etc/hosts on a FreeBSD 10.1-RELEASE i386 machine with a missing /etc/resolv.conf file results in a segmentation fault. Simply creating (an empty) resolv.conf file fixes the problem. On a amd64 machine, ssh works as expected with or without the resolv.conf file.
The segmentation fault is caused by ldns: (gdb) bt full #0 __free (ptr=0x28c00000) at arena.h:504 usize = <value optimized out> #1 0x2814e90d in ldns_resolver_deep_free (res=0x28c4556c) at /usr/src/lib/libldns/../../contrib/ldns/resolver.c:972 i = <value optimized out> #2 0x280b6337 in ssh_getrrsetbyname (hostname=<value optimized out>, rdclass=<value optimized out>, rdtype=<value optimized out>, flags=<value optimized out>) at /usr/src/secure/lib/libssh/../../../crypto/openssh/openbsd-compat/getrrsetbyname-ldns.c:246 res = (struct rrsetinfo **) Cannot access memory at address 0x0
Same if the host is not in /etc/hosts . 10.2-PRERELEASE i386.
This is fixed with r294332, cannot seem to reproduce on 10.3-RELEASE i386 nor 11-RELEASE i386. Thanks