bug in 3.2.0 nmblookup

Herb Lewis hlewis at panasas.com
Thu Jul 3 23:18:29 GMT 2008


On freebsd 4.6.2 at least, the getnameinfo function expects the length
field inside the struct sockaddr to match the salen arg or it returns
an error. This causes nmblookup to not print the address of the found
name in a query like the following

nmblookup -R -U 172.17.132.16 nt4pdc#20

The following patch fixes this. I don't have IPV6 so could not actually
test the AF_INET6 portion of the fix.


--- /tmp/tmp.66554.0    Thu Jul  3 16:02:36 2008
+++ source/lib/util_sock.c Thu Jul  3 16:02:00 2008
@@ -366,6 +366,7 @@
         struct sockaddr_in *sa = (struct sockaddr_in *)ss;
         memset(ss, '\0', sizeof(*ss));
         ss->ss_family = AF_INET;
+       ss->ss_len = sizeof(struct sockaddr_in);
         sa->sin_addr = ip;
  }

@@ -380,6 +381,7 @@
         struct sockaddr_in6 *sa = (struct sockaddr_in6 *)ss;
         memset(ss, '\0', sizeof(*ss));
         ss->ss_family = AF_INET6;
+       ss->ss_len = sizeof(struct sockaddr_in6);
         sa->sin6_addr = ip;
  }


More information about the samba-technical mailing list