summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--channels.c20
-rw-r--r--channels.h6
-rw-r--r--session.c4
4 files changed, 25 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index abf02912a..2979b95f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -47,6 +47,10 @@
47 - stevesk@cvs.openbsd.org 2001/12/19 17:16:13 47 - stevesk@cvs.openbsd.org 2001/12/19 17:16:13
48 [authfile.c bufaux.c bufaux.h buffer.c buffer.h packet.c packet.h ssh.c] 48 [authfile.c bufaux.c bufaux.h buffer.c buffer.h packet.c packet.h ssh.c]
49 change the buffer/packet interface to use void* vs. char*; ok markus@ 49 change the buffer/packet interface to use void* vs. char*; ok markus@
50 - markus@cvs.openbsd.org 2001/12/20 16:37:29
51 [channels.c channels.h session.c]
52 setup x11 listen socket for just one connect if the client requests so.
53 (v2 only, but the openssh client does not support this feature).
50 54
5120011219 5520011219
52 - (stevesk) OpenBSD CVS sync X11 localhost display 56 - (stevesk) OpenBSD CVS sync X11 localhost display
@@ -7075,4 +7079,4 @@
7075 - Wrote replacements for strlcpy and mkdtemp 7079 - Wrote replacements for strlcpy and mkdtemp
7076 - Released 1.0pre1 7080 - Released 1.0pre1
7077 7081
7078$Id: ChangeLog,v 1.1703 2001/12/21 03:56:54 djm Exp $ 7082$Id: ChangeLog,v 1.1704 2001/12/21 03:58:35 djm Exp $
diff --git a/channels.c b/channels.c
index 63eb5bcff..340b10646 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: channels.c,v 1.148 2001/12/19 07:18:56 deraadt Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.149 2001/12/20 16:37:29 markus Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -263,6 +263,7 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
263 c->cb_arg = NULL; 263 c->cb_arg = NULL;
264 c->cb_event = 0; 264 c->cb_event = 0;
265 c->force_drain = 0; 265 c->force_drain = 0;
266 c->single_connection = 0;
266 c->detach_user = NULL; 267 c->detach_user = NULL;
267 c->input_filter = NULL; 268 c->input_filter = NULL;
268 debug("channel %d: new [%s]", found, remote_name); 269 debug("channel %d: new [%s]", found, remote_name);
@@ -1003,6 +1004,11 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset)
1003 debug("X11 connection requested."); 1004 debug("X11 connection requested.");
1004 addrlen = sizeof(addr); 1005 addrlen = sizeof(addr);
1005 newsock = accept(c->sock, &addr, &addrlen); 1006 newsock = accept(c->sock, &addr, &addrlen);
1007 if (c->single_connection) {
1008 debug("single_connection: closing X11 listener.");
1009 channel_close_fd(&c->sock);
1010 chan_mark_dead(c);
1011 }
1006 if (newsock < 0) { 1012 if (newsock < 0) {
1007 error("accept: %.100s", strerror(errno)); 1013 error("accept: %.100s", strerror(errno));
1008 return; 1014 return;
@@ -1029,8 +1035,8 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset)
1029 packet_start(SSH2_MSG_CHANNEL_OPEN); 1035 packet_start(SSH2_MSG_CHANNEL_OPEN);
1030 packet_put_cstring("x11"); 1036 packet_put_cstring("x11");
1031 packet_put_int(nc->self); 1037 packet_put_int(nc->self);
1032 packet_put_int(c->local_window_max); 1038 packet_put_int(nc->local_window_max);
1033 packet_put_int(c->local_maxpacket); 1039 packet_put_int(nc->local_maxpacket);
1034 /* originator ipaddr and port */ 1040 /* originator ipaddr and port */
1035 packet_put_cstring(remote_ipaddr); 1041 packet_put_cstring(remote_ipaddr);
1036 if (datafellows & SSH_BUG_X11FWD) { 1042 if (datafellows & SSH_BUG_X11FWD) {
@@ -2405,8 +2411,10 @@ channel_connect_to(const char *host, u_short port)
2405 * an error occurs. 2411 * an error occurs.
2406 */ 2412 */
2407int 2413int
2408x11_create_display_inet(int x11_display_offset, int gateway_ports) 2414x11_create_display_inet(int x11_display_offset, int gateway_ports,
2415 int single_connection)
2409{ 2416{
2417 Channel *nc = NULL;
2410 int display_number, sock; 2418 int display_number, sock;
2411 u_short port; 2419 u_short port;
2412 struct addrinfo hints, *ai, *aitop; 2420 struct addrinfo hints, *ai, *aitop;
@@ -2482,10 +2490,12 @@ x11_create_display_inet(int x11_display_offset, int gateway_ports)
2482 /* Allocate a channel for each socket. */ 2490 /* Allocate a channel for each socket. */
2483 for (n = 0; n < num_socks; n++) { 2491 for (n = 0; n < num_socks; n++) {
2484 sock = socks[n]; 2492 sock = socks[n];
2485 (void) channel_new("x11 listener", 2493 nc = channel_new("x11 listener",
2486 SSH_CHANNEL_X11_LISTENER, sock, sock, -1, 2494 SSH_CHANNEL_X11_LISTENER, sock, sock, -1,
2487 CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT, 2495 CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT,
2488 0, xstrdup("X11 inet listener"), 1); 2496 0, xstrdup("X11 inet listener"), 1);
2497 if (nc != NULL)
2498 nc->single_connection = single_connection;
2489 } 2499 }
2490 2500
2491 /* Return the display number for the DISPLAY environment variable. */ 2501 /* Return the display number for the DISPLAY environment variable. */
diff --git a/channels.h b/channels.h
index 840268fcf..e994aaeb6 100644
--- a/channels.h
+++ b/channels.h
@@ -32,7 +32,7 @@
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */ 34 */
35/* RCSID("$OpenBSD: channels.h,v 1.53 2001/11/29 21:10:51 stevesk Exp $"); */ 35/* RCSID("$OpenBSD: channels.h,v 1.54 2001/12/20 16:37:29 markus Exp $"); */
36 36
37#ifndef CHANNEL_H 37#ifndef CHANNEL_H
38#define CHANNEL_H 38#define CHANNEL_H
@@ -96,6 +96,7 @@ struct Channel {
96 int local_consumed; 96 int local_consumed;
97 int local_maxpacket; 97 int local_maxpacket;
98 int extended_usage; 98 int extended_usage;
99 int single_connection;
99 100
100 char *ctype; /* type */ 101 char *ctype; /* type */
101 102
@@ -197,9 +198,8 @@ channel_request_forwarding(const char *, u_short, const char *, u_short, int,
197/* x11 forwarding */ 198/* x11 forwarding */
198 199
199int x11_connect_display(void); 200int x11_connect_display(void);
200int x11_create_display_inet(int, int); 201int x11_create_display_inet(int, int, int);
201void x11_input_open(int, int, void *); 202void x11_input_open(int, int, void *);
202void x11_request_forwarding(void);
203void x11_request_forwarding_with_spoofing(int, const char *, const char *); 203void x11_request_forwarding_with_spoofing(int, const char *, const char *);
204void deny_input_open(int, int, void *); 204void deny_input_open(int, int, void *);
205 205
diff --git a/session.c b/session.c
index e4594e383..63ca37132 100644
--- a/session.c
+++ b/session.c
@@ -33,7 +33,7 @@
33 */ 33 */
34 34
35#include "includes.h" 35#include "includes.h"
36RCSID("$OpenBSD: session.c,v 1.113 2001/12/19 15:43:11 stevesk Exp $"); 36RCSID("$OpenBSD: session.c,v 1.114 2001/12/20 16:37:29 markus Exp $");
37 37
38#include "ssh.h" 38#include "ssh.h"
39#include "ssh1.h" 39#include "ssh1.h"
@@ -2066,7 +2066,7 @@ session_setup_x11fwd(Session *s)
2066 return 0; 2066 return 0;
2067 } 2067 }
2068 s->display_number = x11_create_display_inet(options.x11_display_offset, 2068 s->display_number = x11_create_display_inet(options.x11_display_offset,
2069 options.gateway_ports); 2069 options.gateway_ports, s->single_connection);
2070 if (s->display_number == -1) { 2070 if (s->display_number == -1) {
2071 debug("x11_create_display_inet failed."); 2071 debug("x11_create_display_inet failed.");
2072 return 0; 2072 return 0;