summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-10-08 02:48:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:31:14 -0500
commitf7055aef172663f1b511c72ce9f3ec62c8ed0c0d (patch)
treeb70c81640e21bc91a6fc995cc5c02619f1ae1686 /source3
parentb5535567c11552ed675ecc489d440558f91f1d1d (diff)
downloadsamba-f7055aef172663f1b511c72ce9f3ec62c8ed0c0d.tar.gz
samba-f7055aef172663f1b511c72ce9f3ec62c8ed0c0d.tar.bz2
samba-f7055aef172663f1b511c72ce9f3ec62c8ed0c0d.zip
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)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util_sock.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index f77fcc9968..d061d73a81 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;