diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 3 | ||||
-rw-r--r-- | source3/lib/util_sock.c | 12 | ||||
-rw-r--r-- | source3/libads/krb5_setpw.c | 2 | ||||
-rw-r--r-- | source3/libsmb/cliconnect.c | 12 | ||||
-rw-r--r-- | source3/modules/vfs_smb_traffic_analyzer.c | 2 | ||||
-rw-r--r-- | source3/rpc_client/cli_pipe.c | 2 | ||||
-rw-r--r-- | source3/utils/smbfilter.c | 2 |
7 files changed, 13 insertions, 22 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index be34bb0e65..42d1f52fe1 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1457,8 +1457,7 @@ int open_socket_in(int type, int dlevel, const struct sockaddr_storage *psock, bool rebind); -int open_socket_out(int type, - const struct sockaddr_storage *pss, +int open_socket_out(const struct sockaddr_storage *pss, uint16_t port, int timeout); bool open_any_socket_out(struct sockaddr_storage *addrs, int num_addrs, diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index d23758ad6a..a8c3b3031d 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -952,10 +952,8 @@ int open_socket_in(int type, Create an outgoing socket. timeout is in milliseconds. **************************************************************************/ -int open_socket_out(int type, - const struct sockaddr_storage *pss, - uint16_t port, - int timeout) +int open_socket_out(const struct sockaddr_storage *pss, uint16_t port, + int timeout) { char addr[INET6_ADDRSTRLEN]; struct sockaddr_storage sock_out = *pss; @@ -964,16 +962,12 @@ int open_socket_out(int type, int increment = 10; /* create a socket to write to */ - res = socket(pss->ss_family, type, 0); + res = socket(pss->ss_family, SOCK_STREAM, 0); if (res == -1) { DEBUG(0,("socket error (%s)\n", strerror(errno))); return -1; } - if (type != SOCK_STREAM) { - return res; - } - #if defined(HAVE_IPV6) if (pss->ss_family == AF_INET6) { struct sockaddr_in6 *psa6 = (struct sockaddr_in6 *)&sock_out; diff --git a/source3/libads/krb5_setpw.c b/source3/libads/krb5_setpw.c index 5032ffd14c..e164a55b38 100644 --- a/source3/libads/krb5_setpw.c +++ b/source3/libads/krb5_setpw.c @@ -428,7 +428,7 @@ static ADS_STATUS do_krb5_kpasswd_request(krb5_context context, } else { - sock = open_socket_out(SOCK_STREAM, &addr, DEFAULT_KPASSWD_PORT, + sock = open_socket_out(&addr, DEFAULT_KPASSWD_PORT, LONG_CONNECT_TIMEOUT); } diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 5892bdc859..44899e3b1a 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -1499,10 +1499,8 @@ bool cli_session_request(struct cli_state *cli, putip((char *)&dest_ip,cli->inbuf+4); in_addr_to_sockaddr_storage(&cli->dest_ss, dest_ip); - cli->fd = open_socket_out(SOCK_STREAM, - &cli->dest_ss, - port, - LONG_CONNECT_TIMEOUT); + cli->fd = open_socket_out(&cli->dest_ss, port, + LONG_CONNECT_TIMEOUT); if (cli->fd == -1) return False; @@ -1589,11 +1587,11 @@ NTSTATUS cli_connect(struct cli_state *cli, } else { /* try 445 first, then 139 */ uint16_t port = cli->port?cli->port:445; - cli->fd = open_socket_out(SOCK_STREAM, &cli->dest_ss, - port, cli->timeout); + cli->fd = open_socket_out(&cli->dest_ss, port, + cli->timeout); if (cli->fd == -1 && cli->port == 0) { port = 139; - cli->fd = open_socket_out(SOCK_STREAM, &cli->dest_ss, + cli->fd = open_socket_out(&cli->dest_ss, port, cli->timeout); } if (cli->fd != -1) { diff --git a/source3/modules/vfs_smb_traffic_analyzer.c b/source3/modules/vfs_smb_traffic_analyzer.c index 63cc904bed..fe292e5ce8 100644 --- a/source3/modules/vfs_smb_traffic_analyzer.c +++ b/source3/modules/vfs_smb_traffic_analyzer.c @@ -86,7 +86,7 @@ static int smb_traffic_analyzer_connect_inet_socket(vfs_handle_struct *handle, ZERO_STRUCT(ss); memcpy(&ss, res->ai_addr, res->ai_addrlen); - sockfd = open_socket_out(SOCK_STREAM, &ss, port, 10000); + sockfd = open_socket_out(&ss, port, 10000); if (sockfd != -1) { break; } diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index a2d334230d..45eab503fe 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -2618,7 +2618,7 @@ static NTSTATUS rpc_pipe_open_tcp_port(TALLOC_CTX *mem_ctx, const char *host, goto fail; } - result->trans.sock.fd = open_socket_out(SOCK_STREAM, &addr, port, 60); + result->trans.sock.fd = open_socket_out(&addr, port, 60); if (result->trans.sock.fd == -1) { status = map_nt_error_from_unix(errno); goto fail; diff --git a/source3/utils/smbfilter.c b/source3/utils/smbfilter.c index 1e22a40201..e7b71bd5db 100644 --- a/source3/utils/smbfilter.c +++ b/source3/utils/smbfilter.c @@ -144,7 +144,7 @@ static void filter_child(int c, struct sockaddr_storage *dest_ss) int s; /* we have a connection from a new client, now connect to the server */ - s = open_socket_out(SOCK_STREAM, dest_ss, 445, LONG_CONNECT_TIMEOUT); + s = open_socket_out(dest_ss, 445, LONG_CONNECT_TIMEOUT); if (s == -1) { char addr[INET6_ADDRSTRLEN]; |