struct tevent_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
+ int protocol,
const struct sockaddr_storage *pss,
uint16_t port,
int timeout)
};
state->port = port;
- state->fd = socket(state->saddr.u.sa.sa_family, SOCK_STREAM, 0);
+ state->fd = socket(state->saddr.u.sa.sa_family, SOCK_STREAM, protocol);
if (state->fd == -1) {
status = map_nt_error_from_unix(errno);
tevent_req_nterror(req, status);
goto fail;
}
- req = open_socket_out_send(frame, ev, pss, port, timeout);
+ req = open_socket_out_send(frame, ev, IPPROTO_TCP, pss, port, timeout);
if (req == NULL) {
goto fail;
}
return;
}
- subreq = open_socket_out_send(state, state->ev, &state->ss,
- state->port, state->timeout);
+ subreq = open_socket_out_send(state,
+ state->ev,
+ IPPROTO_TCP,
+ &state->ss,
+ state->port,
+ state->timeout);
if (tevent_req_nomem(subreq, req)) {
return;
}
tevent_req_set_cleanup_fn(req, nb_connect_cleanup);
- subreq = open_socket_out_send(state, ev, addr, NBT_SMB_PORT, 5000);
+ subreq = open_socket_out_send(state,
+ ev,
+ IPPROTO_TCP,
+ addr,
+ NBT_SMB_PORT,
+ 5000);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
state->called_name = "*SMBSERVER";
make_nmb_name(&state->called, state->called_name, 0x20);
- subreq = open_socket_out_send(state, state->ev, state->addr,
- NBT_SMB_PORT, 5000);
+ subreq = open_socket_out_send(state,
+ state->ev,
+ IPPROTO_TCP,
+ state->addr,
+ NBT_SMB_PORT,
+ 5000);
if (tevent_req_nomem(subreq, req)) {
return;
}
return req;
}
if (port != 0) {
- state->req_445 = open_socket_out_send(state, ev, addr, port,
+ state->req_445 = open_socket_out_send(state,
+ ev,
+ IPPROTO_TCP,
+ addr,
+ port,
5000);
if (tevent_req_nomem(state->req_445, req)) {
return tevent_req_post(req, ev);
* port==0, try both
*/
- state->req_445 = open_socket_out_send(state, ev, addr, TCP_SMB_PORT, 5000);
+ state->req_445 = open_socket_out_send(state,
+ ev,
+ IPPROTO_TCP,
+ addr,
+ TCP_SMB_PORT,
+ 5000);
if (tevent_req_nomem(state->req_445, req)) {
return tevent_req_post(req, ev);
}