diff options
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 40 |
1 files changed, 6 insertions, 34 deletions
diff --git a/channels.c b/channels.c index 283a70323..d9513fada 100644 --- a/channels.c +++ b/channels.c | |||
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | 41 | ||
42 | #include "includes.h" | 42 | #include "includes.h" |
43 | RCSID("$OpenBSD: channels.c,v 1.125 2001/06/07 20:23:04 markus Exp $"); | 43 | RCSID("$OpenBSD: channels.c,v 1.126 2001/06/20 13:56:39 markus Exp $"); |
44 | 44 | ||
45 | #include "ssh.h" | 45 | #include "ssh.h" |
46 | #include "ssh1.h" | 46 | #include "ssh1.h" |
@@ -223,11 +223,7 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, | |||
223 | channels = xmalloc(channels_alloc * sizeof(Channel *)); | 223 | channels = xmalloc(channels_alloc * sizeof(Channel *)); |
224 | for (i = 0; i < channels_alloc; i++) | 224 | for (i = 0; i < channels_alloc; i++) |
225 | channels[i] = NULL; | 225 | channels[i] = NULL; |
226 | /* | 226 | fatal_add_cleanup((void (*) (void *)) channel_free_all, NULL); |
227 | * Kludge: arrange a call to channel_stop_listening if we | ||
228 | * terminate with fatal(). | ||
229 | */ | ||
230 | fatal_add_cleanup((void (*) (void *)) channel_stop_listening, NULL); | ||
231 | } | 227 | } |
232 | /* Try to find a free slot where to put the new channel. */ | 228 | /* Try to find a free slot where to put the new channel. */ |
233 | for (found = -1, i = 0; i < channels_alloc; i++) | 229 | for (found = -1, i = 0; i < channels_alloc; i++) |
@@ -334,38 +330,14 @@ channel_free(Channel *c) | |||
334 | xfree(c); | 330 | xfree(c); |
335 | } | 331 | } |
336 | 332 | ||
337 | |||
338 | /* | ||
339 | * Stops listening for channels, and removes any unix domain sockets that we | ||
340 | * might have. | ||
341 | */ | ||
342 | |||
343 | void | 333 | void |
344 | channel_stop_listening() | 334 | channel_free_all(void) |
345 | { | 335 | { |
346 | int i; | 336 | int i; |
347 | Channel *c; | ||
348 | 337 | ||
349 | for (i = 0; i < channels_alloc; i++) { | 338 | for (i = 0; i < channels_alloc; i++) |
350 | c = channels[i]; | 339 | if (channels[i] != NULL) |
351 | if (c != NULL) { | 340 | channel_free(channels[i]); |
352 | switch (c->type) { | ||
353 | case SSH_CHANNEL_AUTH_SOCKET: | ||
354 | close(c->sock); | ||
355 | /* auth_sock_cleanup_proc deletes the socket */ | ||
356 | channel_free(c); | ||
357 | break; | ||
358 | case SSH_CHANNEL_PORT_LISTENER: | ||
359 | case SSH_CHANNEL_RPORT_LISTENER: | ||
360 | case SSH_CHANNEL_X11_LISTENER: | ||
361 | close(c->sock); | ||
362 | channel_free(c); | ||
363 | break; | ||
364 | default: | ||
365 | break; | ||
366 | } | ||
367 | } | ||
368 | } | ||
369 | } | 341 | } |
370 | 342 | ||
371 | /* | 343 | /* |