2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
|
crReturnV;
}
crFinishV;
}
static int ssh_do_close(Ssh ssh, int notify_exit)
{
int i, ret = 0;
struct ssh_channel *c;
ssh->state = SSH_STATE_CLOSED;
if (ssh->s) {
sk_close(ssh->s);
ssh->s = NULL;
if (notify_exit)
notify_remote_exit(ssh->frontend);
else
ret = 1;
}
/*
* Now we must shut down any port and X forwardings going
* through this connection.
*/
if (ssh->channels) {
for (i = 0; NULL != (c = index234(ssh->channels, i)); i++) {
switch (c->type) {
case CHAN_X11:
x11_close(c->u.x11.s);
break;
case CHAN_SOCKDATA:
pfd_close(c->u.pfd.s);
break;
}
del234(ssh->channels, c);
if (ssh->version == 2)
bufchain_clear(&c->v.v2.outbuffer);
sfree(c);
}
}
return ret;
|
|
|
|
|
|
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
|
crReturnV;
}
crFinishV;
}
static int ssh_do_close(Ssh ssh, int notify_exit)
{
int ret = 0;
struct ssh_channel *c;
ssh->state = SSH_STATE_CLOSED;
if (ssh->s) {
sk_close(ssh->s);
ssh->s = NULL;
if (notify_exit)
notify_remote_exit(ssh->frontend);
else
ret = 1;
}
/*
* Now we must shut down any port- and X-forwarded channels going
* through this connection.
*/
if (ssh->channels) {
while (NULL != (c = index234(ssh->channels, 0))) {
switch (c->type) {
case CHAN_X11:
x11_close(c->u.x11.s);
break;
case CHAN_SOCKDATA:
pfd_close(c->u.pfd.s);
break;
}
del234(ssh->channels, c); /* moving next one to index 0 */
if (ssh->version == 2)
bufchain_clear(&c->v.v2.outbuffer);
sfree(c);
}
}
return ret;
|