summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/util_sock.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 8ceabe19b2..30a3b83be7 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -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;
}