From f7055aef172663f1b511c72ce9f3ec62c8ed0c0d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 8 Oct 2007 02:48:03 +0000 Subject: r25565: Fix unintended consequence change for IPv6 noticed by Volker. We used to return 0.0.0.0 for the text address of an uninitialized socket - ensure we still do so. Once uninitialized address is as good as any other. Jeremy. (This used to be commit 2827bbe0f853d413b6fcb0eb676048c041cea713) --- source3/lib/util_sock.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index f77fcc9968b..d061d73a818 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -70,7 +70,12 @@ static char *get_socket_addr(int fd) socklen_t length = sizeof(sa); static char addr_buf[INET6_ADDRSTRLEN]; - addr_buf[0] = '\0'; + /* Ok, returning a hard coded IPv4 address + * is bogus, but it's just as bogus as a + * zero IPv6 address. No good choice here. + */ + + safe_strcpy(addr_buf, "0.0.0.0", sizeof(addr_buf)-1); if (fd == -1) { return addr_buf; -- cgit