From 1c11186837e33a1b57ea3346d4034a180cc654cb Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 26 May 2011 22:02:28 +0200 Subject: s3: Use cli_connect_nb in cli_start_connection --- source3/libsmb/cliconnect.c | 51 ++++----------------------------------------- 1 file changed, 4 insertions(+), 47 deletions(-) (limited to 'source3') diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 3f1be7bf18..9ee3b7972c 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -3226,59 +3226,16 @@ NTSTATUS cli_start_connection(struct cli_state **output_cli, int signing_state, int flags) { NTSTATUS nt_status; - struct nmb_name calling; - struct nmb_name called; struct cli_state *cli; - struct sockaddr_storage ss; - if (!my_name) - my_name = global_myname(); - - if (!(cli = cli_initialise_ex(signing_state))) { - return NT_STATUS_NO_MEMORY; - } - - make_nmb_name(&calling, my_name, 0x0); - make_nmb_name(&called , dest_host, 0x20); - - cli_set_port(cli, port); - cli_set_timeout(cli, 10000); /* 10 seconds. */ - - if (dest_ss) { - ss = *dest_ss; - } else { - zero_sockaddr(&ss); - } - -again: - - DEBUG(3,("Connecting to host=%s\n", dest_host)); - - nt_status = cli_connect(cli, dest_host, &ss); + nt_status = cli_connect_nb(dest_host, dest_ss, port, my_name, + signing_state, &cli); if (!NT_STATUS_IS_OK(nt_status)) { - char addr[INET6_ADDRSTRLEN]; - print_sockaddr(addr, sizeof(addr), &ss); - DEBUG(1,("cli_start_connection: failed to connect to %s (%s). Error %s\n", - nmb_namestr(&called), addr, nt_errstr(nt_status) )); - cli_shutdown(cli); + DEBUG(10, ("cli_connect_nb failed: %s\n", + nt_errstr(nt_status))); return nt_status; } - if (!cli_session_request(cli, &calling, &called)) { - char *p; - DEBUG(1,("session request to %s failed (%s)\n", - called.name, cli_errstr(cli))); - if ((p=strchr(called.name, '.')) && !is_ipaddress(called.name)) { - *p = 0; - goto again; - } - if (strcmp(called.name, STAR_SMBSERVER)) { - make_nmb_name(&called , STAR_SMBSERVER, 0x20); - goto again; - } - return NT_STATUS_BAD_NETWORK_NAME; - } - if (flags & CLI_FULL_CONNECTION_DONT_SPNEGO) cli->use_spnego = False; else if (flags & CLI_FULL_CONNECTION_USE_KERBEROS) -- cgit