summaryrefslogtreecommitdiff
path: root/source4/lib/socket_wrapper/socket_wrapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/socket_wrapper/socket_wrapper.c')
-rw-r--r--source4/lib/socket_wrapper/socket_wrapper.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/source4/lib/socket_wrapper/socket_wrapper.c b/source4/lib/socket_wrapper/socket_wrapper.c
index 4814f6c929..2a26ba1534 100644
--- a/source4/lib/socket_wrapper/socket_wrapper.c
+++ b/source4/lib/socket_wrapper/socket_wrapper.c
@@ -249,7 +249,8 @@ int swrap_connect(int s, const struct sockaddr *serv_addr, socklen_t addrlen)
}
/* only allow pseudo loopback connections */
- if (((const struct sockaddr_in *)serv_addr)->sin_addr.s_addr !=
+ if (serv_addr->sa_family == AF_INET &&
+ ((const struct sockaddr_in *)serv_addr)->sin_addr.s_addr !=
htonl(INADDR_LOOPBACK)) {
errno = ENETUNREACH;
return -1;