2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
|
bufchain_clear(&c->v.v2.outbuffer);
sfree(c);
}
}
return ret;
}
static int ssh_closing(Plug plug, const char *error_msg, int error_code,
int calling_back)
{
Ssh ssh = (Ssh) plug;
int need_notify = ssh_do_close(ssh, FALSE);
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
|
bufchain_clear(&c->v.v2.outbuffer);
sfree(c);
}
}
return ret;
}
static void ssh_log(Plug plug, int type, SockAddr addr, int port,
const char *error_msg, int error_code)
{
Ssh ssh = (Ssh) plug;
char addrbuf[256], *msg;
sk_getaddr(addr, addrbuf, lenof(addrbuf));
if (type == 0)
msg = dupprintf("Connecting to %s port %d", addrbuf, port);
else
msg = dupprintf("Failed to connect to %s: %s", addrbuf, error_msg);
logevent(msg);
}
static int ssh_closing(Plug plug, const char *error_msg, int error_code,
int calling_back)
{
Ssh ssh = (Ssh) plug;
int need_notify = ssh_do_close(ssh, FALSE);
|
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
|
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static const char *connect_to_host(Ssh ssh, char *host, int port,
char **realhost, int nodelay, int keepalive)
{
static const struct plug_function_table fn_table = {
ssh_closing,
ssh_receive,
ssh_sent,
NULL
};
SockAddr addr;
|
>
|
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
|
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static const char *connect_to_host(Ssh ssh, char *host, int port,
char **realhost, int nodelay, int keepalive)
{
static const struct plug_function_table fn_table = {
ssh_log,
ssh_closing,
ssh_receive,
ssh_sent,
NULL
};
SockAddr addr;
|
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
|
sk_addr_free(addr);
return err;
}
/*
* Open socket.
*/
{
char addrbuf[100];
sk_getaddr(addr, addrbuf, 100);
logeventf(ssh, "Connecting to %s port %d", addrbuf, port);
}
ssh->fn = &fn_table;
ssh->s = new_connection(addr, *realhost, port,
0, 1, nodelay, keepalive, (Plug) ssh, &ssh->cfg);
if ((err = sk_socket_error(ssh->s)) != NULL) {
ssh->s = NULL;
notify_remote_exit(ssh->frontend);
return err;
|
<
<
<
<
<
|
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
|
sk_addr_free(addr);
return err;
}
/*
* Open socket.
*/
ssh->fn = &fn_table;
ssh->s = new_connection(addr, *realhost, port,
0, 1, nodelay, keepalive, (Plug) ssh, &ssh->cfg);
if ((err = sk_socket_error(ssh->s)) != NULL) {
ssh->s = NULL;
notify_remote_exit(ssh->frontend);
return err;
|