summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-11-21 10:10:52 -0800
committerJeremy Allison <jra@samba.org>2007-11-21 10:10:52 -0800
commite68bbe3548df2400022a86af4681bcdf89481e9a (patch)
treeef3c723cc2ab03456868e015861190bdd0ae7eb4 /source3
parentb921f1690fae8c6d9e080644d84f8b983d0b0d03 (diff)
downloadsamba-e68bbe3548df2400022a86af4681bcdf89481e9a.tar.gz
samba-e68bbe3548df2400022a86af4681bcdf89481e9a.tar.bz2
samba-e68bbe3548df2400022a86af4681bcdf89481e9a.zip
Add set_sockaddr_port function for winbindd.
Jeremy. (This used to be commit 4b47052694285a1d1d313dfd61bd17011d62948d)
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;
}