mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
open_socket_out is always used with SOCK_STREAM, remove argument "type"
This commit is contained in:
parent
b6138bf4f2
commit
fafb9ecc61
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user