summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util_sock.c13
-rw-r--r--source3/winbindd/winbindd_cm.c2
2 files changed, 15 insertions, 0 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index a59b1d5ef2..f1a6d826e0 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -627,6 +627,19 @@ static int get_socket_port(int fd)
}
#endif
+void set_sockaddr_port(struct sockaddr_storage *psa, uint16 port)
+{
+#if defined(HAVE_IPV6)
+ if (psa->ss_family == AF_INET6) {
+ ((struct sockaddr_in6 *)psa)->sin6_port = htons(port);
+ }
+#else
+ if (psa->ss_family == AF_INET) {
+ ((struct sockaddr_in *)psa)->sin_port = htons(port);
+ }
+#endif
+}
+
const char *client_name(int fd)
{
return get_peer_name(fd,false);
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index 4c9ae0365f..f8e76b0299 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -923,6 +923,8 @@ static bool add_sockaddr_to_array(TALLOC_CTX *mem_ctx,
}
(*addrs)[*num] = *pss;
+ set_sockaddr_port(&(*addrs)[*num], port);
+
*num += 1;
return True;
}