Fix a bug in the output from print_canonical_sockaddr() fix from 36f8bafbd3dee66a8....
authorGerald W. Carter <jerry@samba.org>
Wed, 26 Mar 2008 21:58:27 +0000 (16:58 -0500)
committerGerald W. Carter <jerry@samba.org>
Wed, 26 Mar 2008 21:58:27 +0000 (16:58 -0500)
Make sure that IPv4 addresses are not enclised in []'s.
(This used to be commit 4ddf58dbdc3d74cb72788ef4a2ec7587d4948c40)

source3/lib/util_sock.c

index 8ceabe19b2258d9183aeaf25f852edca1ccf8ea8..30a3b83be75894b56e6b2807116b258ca13e4530 100644 (file)
@@ -556,11 +556,17 @@ char *print_canonical_sockaddr(TALLOC_CTX *ctx,
        if (ret != 0) {
                return NULL;
        }
+
+       if (pss->ss_family != AF_INET) {
 #if defined(HAVE_IPV6)
-       dest = talloc_asprintf(ctx, "[%s]", addr);
+               dest = talloc_asprintf(ctx, "[%s]", addr);
 #else
-       dest = talloc_asprintf(ctx, "%s", addr);
+               return NULL;
 #endif
+       } else {
+               dest = talloc_asprintf(ctx, "%s", addr);
+       }
+       
        return dest;
 }