svn commit: samba r25563 - in branches: SAMBA_3_2/source/torture SAMBA_3_2_0/source/torture

Jeremy Allison jra at samba.org
Mon Oct 8 02:39:58 GMT 2007


On Sun, Oct 07, 2007 at 03:43:17PM +0200, Volker Lendecke wrote:
> Hi, Jeremy!
> 
> On Sun, Oct 07, 2007 at 01:37:01PM +0000, vlendec at samba.org wrote:
> > Log:
> > Show which local-substitute subtest fails
> 
> This got broken with r25492. The tests makes sure that with
> an uninitialized socket library "%i" and "%I" both
> substitute to 0.0.0.0. After 25492 "%i" returns "" instead
> of "0.0.0.0".
> 
> Which of both is correct? And, can you modify the code or
> the test appropriately?

Ok, it's this change from that check in that broke things :

 static char *get_socket_addr(int fd)
 {
-       struct sockaddr sa;
-       struct sockaddr_in *sockin = (struct sockaddr_in *) (&sa);
+       struct sockaddr_storage sa;
        socklen_t length = sizeof(sa);
-       static fstring addr_buf;
+       static char addr_buf[INET6_ADDRSTRLEN];

-       fstrcpy(addr_buf,"0.0.0.0");
+       addr_buf[0] = '\0';

I think the change is correct, but I need to look at
the unintended side effects to decide if we should keep it.

The problem is once we have IPv6, an uninitialized socket
could be "::" as well as 0.0.0.0 :-). Both are valid non-addresses
for an incorrect socket :-).

I'll probably just restore the old 0.0.0.0 return - that's
just as invalid as :: :-).

Jeremy.


More information about the samba-technical mailing list