mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
Move set_sockaddr_port to libutil.
This commit is contained in:
parent
7577d9ebf0
commit
22f566c39b
@ -408,3 +408,17 @@ bool is_address_any(const struct sockaddr *psa)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void set_sockaddr_port(struct sockaddr *psa, uint16_t port)
|
||||
{
|
||||
#if defined(HAVE_IPV6)
|
||||
if (psa->sa_family == AF_INET6) {
|
||||
((struct sockaddr_in6 *)psa)->sin6_port = htons(port);
|
||||
}
|
||||
#endif
|
||||
if (psa->sa_family == AF_INET) {
|
||||
((struct sockaddr_in *)psa)->sin_port = htons(port);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -241,18 +241,6 @@ 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);
|
||||
}
|
||||
#endif
|
||||
if (psa->ss_family == AF_INET) {
|
||||
((struct sockaddr_in *)psa)->sin_port = htons(port);
|
||||
}
|
||||
}
|
||||
|
||||
const char *client_name(int fd)
|
||||
{
|
||||
return get_peer_name(fd,false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user