comparison common-channel.c @ 1800:c584b5602bd8

Return errstring on connect failure
author Matt Johnston <matt@ucc.asn.au>
date Fri, 05 Mar 2021 21:13:20 +0800
parents 79eef94ccea9
children 8a78cc13eb30
comparison
equal deleted inserted replaced
1799:8df3d6aa5f23 1800:c584b5602bd8
354 354
355 /* Check whether a deferred (EINPROGRESS) connect() was successful, and 355 /* Check whether a deferred (EINPROGRESS) connect() was successful, and
356 * if so, set up the channel properly. Otherwise, the channel is cleaned up, so 356 * if so, set up the channel properly. Otherwise, the channel is cleaned up, so
357 * it is important that the channel reference isn't used after a call to this 357 * it is important that the channel reference isn't used after a call to this
358 * function */ 358 * function */
359 void channel_connect_done(int result, int sock, void* user_data, const char* UNUSED(errstring)) { 359 void channel_connect_done(int result, int sock, void* user_data, const char* errstring) {
360
361 struct Channel *channel = user_data; 360 struct Channel *channel = user_data;
362 361
363 TRACE(("enter channel_connect_done")) 362 TRACE(("enter channel_connect_done"))
364 363
365 if (result == DROPBEAR_SUCCESS) 364 if (result == DROPBEAR_SUCCESS)
371 TRACE(("leave channel_connect_done: success")) 370 TRACE(("leave channel_connect_done: success"))
372 } 371 }
373 else 372 else
374 { 373 {
375 send_msg_channel_open_failure(channel->remotechan, 374 send_msg_channel_open_failure(channel->remotechan,
376 SSH_OPEN_CONNECT_FAILED, "", ""); 375 SSH_OPEN_CONNECT_FAILED, errstring, "");
377 remove_channel(channel); 376 remove_channel(channel);
378 TRACE(("leave check_in_progress: fail")) 377 TRACE(("leave check_in_progress: fail. internal errstring: %s", errstring))
379 } 378 }
380 } 379 }
381 380
382 381
383 /* Send the close message and set the channel as closed */ 382 /* Send the close message and set the channel as closed */