1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

Add set_sockaddr_port function for winbindd.

Jeremy.
(This used to be commit 4b47052694)
This commit is contained in:
Jeremy Allison 2007-11-21 10:10:52 -08:00
parent b921f1690f
commit e68bbe3548
2 changed files with 15 additions and 0 deletions

View File

@ -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);

View File

@ -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;
}