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,
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;
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;
} else {
- sock = open_socket_out(SOCK_STREAM, &addr, DEFAULT_KPASSWD_PORT,
+ sock = open_socket_out(&addr, DEFAULT_KPASSWD_PORT,
LONG_CONNECT_TIMEOUT);
}
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;
} 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) {
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;
}
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;
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];