diff options
author | Jeremy Allison <jra@samba.org> | 2007-11-21 10:10:52 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2007-11-21 10:10:52 -0800 |
commit | e68bbe3548df2400022a86af4681bcdf89481e9a (patch) | |
tree | ef3c723cc2ab03456868e015861190bdd0ae7eb4 /source3/lib | |
parent | b921f1690fae8c6d9e080644d84f8b983d0b0d03 (diff) | |
download | samba-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/lib')
-rw-r--r-- | source3/lib/util_sock.c | 13 |
1 files changed, 13 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); |