summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/channels.c b/channels.c
index 3fe836aad..a84b487e5 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.346 2015/06/30 05:25:07 djm Exp $ */ 1/* $OpenBSD: channels.c,v 1.347 2015/07/01 02:26:31 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -161,6 +161,9 @@ static char *x11_saved_proto = NULL;
161static char *x11_saved_data = NULL; 161static char *x11_saved_data = NULL;
162static u_int x11_saved_data_len = 0; 162static u_int x11_saved_data_len = 0;
163 163
164/* Deadline after which all X11 connections are refused */
165static u_int x11_refuse_time;
166
164/* 167/*
165 * Fake X11 authentication data. This is what the server will be sending us; 168 * Fake X11 authentication data. This is what the server will be sending us;
166 * we should replace any occurrences of this by the real data. 169 * we should replace any occurrences of this by the real data.
@@ -912,6 +915,13 @@ x11_open_helper(Buffer *b)
912 u_char *ucp; 915 u_char *ucp;
913 u_int proto_len, data_len; 916 u_int proto_len, data_len;
914 917
918 /* Is this being called after the refusal deadline? */
919 if (x11_refuse_time != 0 && (u_int)monotime() >= x11_refuse_time) {
920 verbose("Rejected X11 connection after ForwardX11Timeout "
921 "expired");
922 return -1;
923 }
924
915 /* Check if the fixed size part of the packet is in buffer. */ 925 /* Check if the fixed size part of the packet is in buffer. */
916 if (buffer_len(b) < 12) 926 if (buffer_len(b) < 12)
917 return 0; 927 return 0;
@@ -1483,6 +1493,12 @@ channel_set_reuseaddr(int fd)
1483 error("setsockopt SO_REUSEADDR fd %d: %s", fd, strerror(errno)); 1493 error("setsockopt SO_REUSEADDR fd %d: %s", fd, strerror(errno));
1484} 1494}
1485 1495
1496void
1497channel_set_x11_refuse_time(u_int refuse_time)
1498{
1499 x11_refuse_time = refuse_time;
1500}
1501
1486/* 1502/*
1487 * This socket is listening for connections to a forwarded TCP/IP port. 1503 * This socket is listening for connections to a forwarded TCP/IP port.
1488 */ 1504 */