Bug 7335 - util_sock.c: name resolution incomplete
Summary: util_sock.c: name resolution incomplete
Status: NEW
Alias: None
Product: Samba 3.4
Classification: Unclassified
Component: File services (show other bugs)
Version: 3.4.2
Hardware: Other Windows XP
: P3 normal
Target Milestone: ---
Assignee: Volker Lendecke
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-07 06:33 UTC by Jan Engelhardt
Modified: 2010-04-07 06:53 UTC (History)
1 user (show)

See Also:


Attachments

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:192.168.100.110" 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);
(gdb)
1644            if (!lp_hostname_lookups() && (force_lookup == false)) {
(gdb)
1653            lookup_nc(&nc);
(gdb)
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);
(gdb)
1659            if (sockaddr_equal((struct sockaddr *)&ss, (struct sockaddr *)&nc.ss)) {
(gdb) p p
$2 = 0x7fffffffc4e0 "::ffff:192.168.100.110"

Looks reasonable.

(gdb) n
1664            if (fd == -1) {
(gdb)
1669            ret = sys_getnameinfo((struct sockaddr *)&ss,
(gdb)
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)) {
(gdb)
matchname: host name/address mismatch: ::ffff:192.168.100.110 != excelsior.medozas.de
1685                            DEBUG(0,("Matchname failed on %s %s\n",name_buf,p));
(gdb)

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