Bug 7335 - util_sock.c: name resolution incomplete
util_sock.c: name resolution incomplete
Status: NEW
Product: Samba 3.4
Classification: Unclassified
Component: File services
Other Windows XP
: P3 normal
: ---
Assigned To: Volker Lendecke
Samba QA Contact
Depends on:
  Show dependency treegraph
Reported: 2010-04-07 06:33 UTC by Jan Engelhardt
Modified: 2010-04-07 06:53 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Jan Engelhardt 2010-04-07 06:33:05 UTC
I tried figuring out why I'm only getting "::ffff:" in utmp. After enabling hostname lookups = yes, things look better debug-wise, but I still get the ugly address in utmp. Looking at util_sock.c more, it's somehow obvious.

Breakpoint 1, get_peer_name (fd=30, force_lookup=false) at lib/util_sock.c:1630
1630    {
(gdb) n
1634            socklen_t length = sizeof(ss);
1644            if (!lp_hostname_lookups() && (force_lookup == false)) {
1653            lookup_nc(&nc);
1655            memset(&ss, '\0', sizeof(ss));
(gdb) p nc
$1 = {ss = {ss_family = 0, __ss_align = 0,
    __ss_padding = '\000' <repeats 111 times>}, name = 0x0}
(gdb) n
1656            p = get_peer_addr_internal(fd, addr_buf, sizeof(addr_buf), (struct sockaddr *)&ss, &length);
1659            if (sockaddr_equal((struct sockaddr *)&ss, (struct sockaddr *)&nc.ss)) {
(gdb) p p
$2 = 0x7fffffffc4e0 "::ffff:"

Looks reasonable.

(gdb) n
1664            if (fd == -1) {
1669            ret = sys_getnameinfo((struct sockaddr *)&ss,
Missing separate debuginfo for /lib64/libnss_dns.so.2
Try: zypper install -C "debuginfo(build-id)=0a5fdd80d65e0c95c2d8c607ed2ec4a337d942df"
1677            if (ret) {
(gdb) p name_buf
$3 = "excelsior.site\000..."

That meets my expectations too.

(gdb) n
1684                    if (!matchname(name_buf, (struct sockaddr *)&ss, length)) {
matchname: host name/address mismatch: ::ffff: != excelsior.medozas.de
1685                            DEBUG(0,("Matchname failed on %s %s\n",name_buf,p));

That however makes absolutely no sense. Why does it compare an address to a hostname? That's almost never going to be equal.