diff options
author | Volker Lendecke <vl@samba.org> | 2009-01-03 19:50:05 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-01-04 16:42:40 +0100 |
commit | 19b783cce9edf7b616cd1a9d9dcb78a02791d89e (patch) | |
tree | a188cb7b2dac77c277c814f7c347cb851c47f7a9 /source3/libsmb | |
parent | 1b328d98208d4245733dc8e04f6b81ab606ead8c (diff) | |
download | samba-19b783cce9edf7b616cd1a9d9dcb78a02791d89e.tar.gz samba-19b783cce9edf7b616cd1a9d9dcb78a02791d89e.tar.bz2 samba-19b783cce9edf7b616cd1a9d9dcb78a02791d89e.zip |
Async wrapper for open_socket_out_send/recv
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/cliconnect.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 44899e3b1a..1b03459658 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -1494,15 +1494,17 @@ bool cli_session_request(struct cli_state *cli, */ uint16_t port = (CVAL(cli->inbuf,8)<<8)+CVAL(cli->inbuf,9); struct in_addr dest_ip; + NTSTATUS status; /* SESSION RETARGET */ putip((char *)&dest_ip,cli->inbuf+4); in_addr_to_sockaddr_storage(&cli->dest_ss, dest_ip); - cli->fd = open_socket_out(&cli->dest_ss, port, - LONG_CONNECT_TIMEOUT); - if (cli->fd == -1) + status = open_socket_out(&cli->dest_ss, port, + LONG_CONNECT_TIMEOUT, &cli->fd); + if (!NT_STATUS_IS_OK(status)) { return False; + } DEBUG(3,("Retargeted\n")); @@ -1587,12 +1589,17 @@ 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(&cli->dest_ss, port, - cli->timeout); - if (cli->fd == -1 && cli->port == 0) { + NTSTATUS status; + + cli->fd = -1; + + status = open_socket_out(&cli->dest_ss, port, + cli->timeout, &cli->fd); + if (!NT_STATUS_IS_OK(status) && cli->port == 0) { port = 139; - cli->fd = open_socket_out(&cli->dest_ss, - port, cli->timeout); + status = open_socket_out( + &cli->dest_ss, port, cli->timeout, + &cli->fd); } if (cli->fd != -1) { cli->port = port; |