diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-03-10 15:55:26 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-03-11 11:27:47 +1100 |
commit | 0201b2fa9f31d8c9a75f3057f91b3f720f62292c (patch) | |
tree | 1e4ea6928f25827ed9af76c44eaffa163c656597 /source4/lib/socket/socket.c | |
parent | 4ab3e220c4188b6c147e1a0fa8ce1e2965d74d43 (diff) | |
download | samba-0201b2fa9f31d8c9a75f3057f91b3f720f62292c.tar.gz samba-0201b2fa9f31d8c9a75f3057f91b3f720f62292c.tar.bz2 samba-0201b2fa9f31d8c9a75f3057f91b3f720f62292c.zip |
s4:lib/socket Add function to set a port on the socket address
Diffstat (limited to 'source4/lib/socket/socket.c')
-rw-r--r-- | source4/lib/socket/socket.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source4/lib/socket/socket.c b/source4/lib/socket/socket.c index 30db03fd97..4b5cecab34 100644 --- a/source4/lib/socket/socket.c +++ b/source4/lib/socket/socket.c @@ -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) { |