View | Details | Raw Unified | Return to bug 2580 | Differences between
and this patch

Collapse All | Expand All

(-)openssh-portable/channels.c (-6 / +7 lines)
Lines 148-156 Link Here
148
148
149
/* -- X11 forwarding */
149
/* -- X11 forwarding */
150
150
151
/* Maximum number of fake X11 displays to try. */
152
#define MAX_DISPLAYS  1000
153
154
/* Saved X11 local (client) display. */
151
/* Saved X11 local (client) display. */
155
static char *x11_saved_display = NULL;
152
static char *x11_saved_display = NULL;
156
153
Lines 3890-3896 Link Here
3890
 */
3887
 */
3891
int
3888
int
3892
x11_create_display_inet(int x11_display_offset, int x11_use_localhost,
3889
x11_create_display_inet(int x11_display_offset, int x11_use_localhost,
3893
    int single_connection, u_int *display_numberp, int **chanids)
3890
	int max_displays, int single_connection, u_int *display_numberp, 
3891
	int **chanids)
3894
{
3892
{
3895
	Channel *nc = NULL;
3893
	Channel *nc = NULL;
3896
	int display_number, sock;
3894
	int display_number, sock;
Lines 3902-3909 Link Here
3902
	if (chanids == NULL)
3900
	if (chanids == NULL)
3903
		return -1;
3901
		return -1;
3904
3902
3903
	/* Try max_displays ports starting at the range 6000+X11DisplayOffset */
3904
	max_displays = max_displays + x11_display_offset;
3905
3905
	for (display_number = x11_display_offset;
3906
	for (display_number = x11_display_offset;
3906
	    display_number < MAX_DISPLAYS;
3907
	    display_number < max_displays;
3907
	    display_number++) {
3908
	    display_number++) {
3908
		port = 6000 + display_number;
3909
		port = 6000 + display_number;
3909
		memset(&hints, 0, sizeof(hints));
3910
		memset(&hints, 0, sizeof(hints));
Lines 3957-3963 Link Here
3957
		if (num_socks > 0)
3958
		if (num_socks > 0)
3958
			break;
3959
			break;
3959
	}
3960
	}
3960
	if (display_number >= MAX_DISPLAYS) {
3961
	if (display_number >= max_displays) {
3961
		error("Failed to allocate internet-domain X11 display socket.");
3962
		error("Failed to allocate internet-domain X11 display socket.");
3962
		return -1;
3963
		return -1;
3963
	}
3964
	}
(-)openssh-portable/channels.h (-1 / +1 lines)
Lines 286-292 Link Here
286
286
287
void	 channel_set_x11_refuse_time(u_int);
287
void	 channel_set_x11_refuse_time(u_int);
288
int	 x11_connect_display(void);
288
int	 x11_connect_display(void);
289
int	 x11_create_display_inet(int, int, int, u_int *, int **);
289
int	 x11_create_display_inet(int, int, int, int, u_int *, int **);
290
int      x11_input_open(int, u_int32_t, void *);
290
int      x11_input_open(int, u_int32_t, void *);
291
void	 x11_request_forwarding_with_spoofing(int, const char *, const char *,
291
void	 x11_request_forwarding_with_spoofing(int, const char *, const char *,
292
	     const char *, int);
292
	     const char *, int);
(-)openssh-portable/servconf.c (-2 / +16 lines)
Lines 96-101 Link Here
96
	options->print_lastlog = -1;
96
	options->print_lastlog = -1;
97
	options->x11_forwarding = -1;
97
	options->x11_forwarding = -1;
98
	options->x11_display_offset = -1;
98
	options->x11_display_offset = -1;
99
	options->max_displays = -1;
99
	options->x11_use_localhost = -1;
100
	options->x11_use_localhost = -1;
100
	options->permit_tty = -1;
101
	options->permit_tty = -1;
101
	options->permit_user_rc = -1;
102
	options->permit_user_rc = -1;
Lines 327-332 Link Here
327
		options->max_authtries = DEFAULT_AUTH_FAIL_MAX;
328
		options->max_authtries = DEFAULT_AUTH_FAIL_MAX;
328
	if (options->max_sessions == -1)
329
	if (options->max_sessions == -1)
329
		options->max_sessions = DEFAULT_SESSIONS_MAX;
330
		options->max_sessions = DEFAULT_SESSIONS_MAX;
331
	if (options->max_displays == -1)
332
		options->max_displays = MAX_DISPLAYS;
330
	if (options->use_dns == -1)
333
	if (options->use_dns == -1)
331
		options->use_dns = 0;
334
		options->use_dns = 0;
332
	if (options->client_alive_interval == -1)
335
	if (options->client_alive_interval == -1)
Lines 429-435 Link Here
429
	sAuthorizedKeysCommand, sAuthorizedKeysCommandUser,
432
	sAuthorizedKeysCommand, sAuthorizedKeysCommandUser,
430
	sAuthenticationMethods, sHostKeyAgent, sPermitUserRC,
433
	sAuthenticationMethods, sHostKeyAgent, sPermitUserRC,
431
	sStreamLocalBindMask, sStreamLocalBindUnlink,
434
	sStreamLocalBindMask, sStreamLocalBindUnlink,
432
	sAllowStreamLocalForwarding, sFingerprintHash,
435
	sAllowStreamLocalForwarding, sFingerprintHash, sMaxDisplays,
433
	sDeprecated, sUnsupported
436
	sDeprecated, sUnsupported
434
} ServerOpCodes;
437
} ServerOpCodes;
435
438
Lines 572-577 Link Here
572
	{ "streamlocalbindunlink", sStreamLocalBindUnlink, SSHCFG_ALL },
575
	{ "streamlocalbindunlink", sStreamLocalBindUnlink, SSHCFG_ALL },
573
	{ "allowstreamlocalforwarding", sAllowStreamLocalForwarding, SSHCFG_ALL },
576
	{ "allowstreamlocalforwarding", sAllowStreamLocalForwarding, SSHCFG_ALL },
574
	{ "fingerprinthash", sFingerprintHash, SSHCFG_GLOBAL },
577
	{ "fingerprinthash", sFingerprintHash, SSHCFG_GLOBAL },
578
	{ "maxdisplays", sMaxDisplays, SSHCFG_GLOBAL },
575
	{ NULL, sBadOption, 0 }
579
	{ NULL, sBadOption, 0 }
576
};
580
};
577
581
Lines 1031-1037 Link Here
1031
			fatal("%s line %d: Badly formatted port number.",
1035
			fatal("%s line %d: Badly formatted port number.",
1032
			    filename, linenum);
1036
			    filename, linenum);
1033
		break;
1037
		break;
1034
1038
    case sMaxDisplays:
1039
		arg = strdelim(&cp);
1040
	    if (!arg || *arg == '\0')
1041
	        fatal("%s line %d: missing value.",filename, linenum);
1042
	    if ((options->max_displays = a2port(arg)) == -1) {
1043
	        error("Invalid MaxDisplays '%s'", arg);
1044
	       	return -1;
1045
	    }
1046
	  	break;
1035
	case sServerKeyBits:
1047
	case sServerKeyBits:
1036
		intptr = &options->server_key_bits;
1048
		intptr = &options->server_key_bits;
1037
 parse_int:
1049
 parse_int:
Lines 2001-2006 Link Here
2001
	M_CP_INTOPT(permit_tty);
2013
	M_CP_INTOPT(permit_tty);
2002
	M_CP_INTOPT(permit_user_rc);
2014
	M_CP_INTOPT(permit_user_rc);
2003
	M_CP_INTOPT(max_sessions);
2015
	M_CP_INTOPT(max_sessions);
2016
	M_CP_INTOPT(max_displays);
2004
	M_CP_INTOPT(max_authtries);
2017
	M_CP_INTOPT(max_authtries);
2005
	M_CP_INTOPT(ip_qos_interactive);
2018
	M_CP_INTOPT(ip_qos_interactive);
2006
	M_CP_INTOPT(ip_qos_bulk);
2019
	M_CP_INTOPT(ip_qos_bulk);
Lines 2254-2259 Link Here
2254
	dump_cfg_int(sX11DisplayOffset, o->x11_display_offset);
2267
	dump_cfg_int(sX11DisplayOffset, o->x11_display_offset);
2255
	dump_cfg_int(sMaxAuthTries, o->max_authtries);
2268
	dump_cfg_int(sMaxAuthTries, o->max_authtries);
2256
	dump_cfg_int(sMaxSessions, o->max_sessions);
2269
	dump_cfg_int(sMaxSessions, o->max_sessions);
2270
	dump_cfg_int(sMaxDisplays, o->max_displays);
2257
	dump_cfg_int(sClientAliveInterval, o->client_alive_interval);
2271
	dump_cfg_int(sClientAliveInterval, o->client_alive_interval);
2258
	dump_cfg_int(sClientAliveCountMax, o->client_alive_count_max);
2272
	dump_cfg_int(sClientAliveCountMax, o->client_alive_count_max);
2259
	dump_cfg_oct(sStreamLocalBindMask, o->fwd_opts.streamlocal_bind_mask);
2273
	dump_cfg_oct(sStreamLocalBindMask, o->fwd_opts.streamlocal_bind_mask);
(-)openssh-portable/servconf.h (+2 lines)
Lines 29-34 Link Here
29
#define MAX_MATCH_GROUPS	256	/* Max # of groups for Match. */
29
#define MAX_MATCH_GROUPS	256	/* Max # of groups for Match. */
30
#define MAX_AUTHKEYS_FILES	256	/* Max # of authorized_keys files. */
30
#define MAX_AUTHKEYS_FILES	256	/* Max # of authorized_keys files. */
31
#define MAX_AUTH_METHODS	256	/* Max # of AuthenticationMethods. */
31
#define MAX_AUTH_METHODS	256	/* Max # of AuthenticationMethods. */
32
#define MAX_DISPLAYS  		1000 /* Maximum number of fake X11 displays to try. */
32
33
33
/* permit_root_login */
34
/* permit_root_login */
34
#define	PERMIT_NOT_SET		-1
35
#define	PERMIT_NOT_SET		-1
Lines 154-159 Link Here
154
	int	max_startups;
155
	int	max_startups;
155
	int	max_authtries;
156
	int	max_authtries;
156
	int	max_sessions;
157
	int	max_sessions;
158
	int max_displays;
157
	char   *banner;			/* SSH-2 banner message */
159
	char   *banner;			/* SSH-2 banner message */
158
	int	use_dns;
160
	int	use_dns;
159
	int	client_alive_interval;	/*
161
	int	client_alive_interval;	/*
(-)openssh-portable/session.c (-2 / +3 lines)
Lines 2701-2708 Link Here
2701
		return 0;
2701
		return 0;
2702
	}
2702
	}
2703
	if (x11_create_display_inet(options.x11_display_offset,
2703
	if (x11_create_display_inet(options.x11_display_offset,
2704
	    options.x11_use_localhost, s->single_connection,
2704
	    options.x11_use_localhost, options.max_displays,
2705
	    &s->display_number, &s->x11_chanids) == -1) {
2705
	    s->single_connection, &s->display_number, 
2706
	    &s->x11_chanids) == -1) {
2706
		debug("x11_create_display_inet failed.");
2707
		debug("x11_create_display_inet failed.");
2707
		return 0;
2708
		return 0;
2708
	}
2709
	}

Return to bug 2580