mirror of
https://github.com/samba-team/samba.git
synced 2025-08-04 08:22:08 +03:00
s4:lib/socket Add function to set a port on the socket address
This commit is contained in:
@ -25,6 +25,7 @@
|
||||
#include "system/network.h"
|
||||
#include "param/param.h"
|
||||
#include "../lib/tsocket/tsocket.h"
|
||||
#include "lib/util/util_net.h"
|
||||
|
||||
/*
|
||||
auto-close sockets on free
|
||||
@ -371,6 +372,17 @@ _PUBLIC_ struct tsocket_address *socket_address_to_tsocket_address(TALLOC_CTX *m
|
||||
return r;
|
||||
}
|
||||
|
||||
_PUBLIC_ void socket_address_set_port(struct socket_address *a,
|
||||
uint16_t port)
|
||||
{
|
||||
if (a->sockaddr) {
|
||||
set_sockaddr_port(a->sockaddr, port);
|
||||
} else {
|
||||
a->port = port;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_PUBLIC_ struct socket_address *tsocket_address_to_socket_address(TALLOC_CTX *mem_ctx,
|
||||
const struct tsocket_address *a)
|
||||
{
|
||||
|
Reference in New Issue
Block a user