diff options
author | Damien Miller <djm@mindrot.org> | 2005-07-17 17:19:24 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2005-07-17 17:19:24 +1000 |
commit | 2b9b045d930b8d724f768fafdd9a46fa453b9a3e (patch) | |
tree | f127eb67a0f4818cbb429b7faa76330e7659a6c5 /channels.c | |
parent | 37294fb6307202e6f52d7046b3ddb56a4786d27f (diff) |
- (djm) [auth-pam.c sftp.c] spaces vs. tabs at start of line
- djm@cvs.openbsd.org 2005/07/17 06:49:04
[channels.c channels.h session.c session.h]
Fix a number of X11 forwarding channel leaks:
1. Refuse multiple X11 forwarding requests on the same session
2. Clean up all listeners after a single_connection X11 forward, not just
the one that made the single connection
3. Destroy X11 listeners when the session owning them goes away
testing and ok dtucker@
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/channels.c b/channels.c index b7ff85007..8da399b69 100644 --- a/channels.c +++ b/channels.c | |||
@@ -39,7 +39,7 @@ | |||
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "includes.h" | 41 | #include "includes.h" |
42 | RCSID("$OpenBSD: channels.c,v 1.221 2005/07/16 01:35:24 djm Exp $"); | 42 | RCSID("$OpenBSD: channels.c,v 1.222 2005/07/17 06:49:04 djm Exp $"); |
43 | 43 | ||
44 | #include "ssh.h" | 44 | #include "ssh.h" |
45 | #include "ssh1.h" | 45 | #include "ssh1.h" |
@@ -2659,7 +2659,7 @@ channel_send_window_changes(void) | |||
2659 | */ | 2659 | */ |
2660 | int | 2660 | int |
2661 | x11_create_display_inet(int x11_display_offset, int x11_use_localhost, | 2661 | x11_create_display_inet(int x11_display_offset, int x11_use_localhost, |
2662 | int single_connection, u_int *display_numberp) | 2662 | int single_connection, u_int *display_numberp, int **chanids) |
2663 | { | 2663 | { |
2664 | Channel *nc = NULL; | 2664 | Channel *nc = NULL; |
2665 | int display_number, sock; | 2665 | int display_number, sock; |
@@ -2749,6 +2749,8 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost, | |||
2749 | } | 2749 | } |
2750 | 2750 | ||
2751 | /* Allocate a channel for each socket. */ | 2751 | /* Allocate a channel for each socket. */ |
2752 | if (chanids != NULL) | ||
2753 | *chanids = xmalloc(sizeof(**chanids) * (num_socks + 1)); | ||
2752 | for (n = 0; n < num_socks; n++) { | 2754 | for (n = 0; n < num_socks; n++) { |
2753 | sock = socks[n]; | 2755 | sock = socks[n]; |
2754 | nc = channel_new("x11 listener", | 2756 | nc = channel_new("x11 listener", |
@@ -2756,7 +2758,11 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost, | |||
2756 | CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, | 2758 | CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, |
2757 | 0, "X11 inet listener", 1); | 2759 | 0, "X11 inet listener", 1); |
2758 | nc->single_connection = single_connection; | 2760 | nc->single_connection = single_connection; |
2761 | if (*chanids != NULL) | ||
2762 | (*chanids)[n] = nc->self; | ||
2759 | } | 2763 | } |
2764 | if (*chanids != NULL) | ||
2765 | (*chanids)[n] = -1; | ||
2760 | 2766 | ||
2761 | /* Return the display number for the DISPLAY environment variable. */ | 2767 | /* Return the display number for the DISPLAY environment variable. */ |
2762 | *display_numberp = display_number; | 2768 | *display_numberp = display_number; |