View | Details | Raw Unified | Return to bug 1332
Collapse All | Expand All

(-)openssh-4.6p1/readconf.c (+39 lines)
Lines 130-135 Link Here
130
	oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly,
130
	oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly,
131
	oSendEnv, oControlPath, oControlMaster, oHashKnownHosts,
131
	oSendEnv, oControlPath, oControlMaster, oHashKnownHosts,
132
	oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand,
132
	oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand,
133
	oReceiveBufferSize,
133
	oDeprecated, oUnsupported
134
	oDeprecated, oUnsupported
134
} OpCodes;
135
} OpCodes;
135
136
Lines 226-231 Link Here
226
	{ "tunneldevice", oTunnelDevice },
227
	{ "tunneldevice", oTunnelDevice },
227
	{ "localcommand", oLocalCommand },
228
	{ "localcommand", oLocalCommand },
228
	{ "permitlocalcommand", oPermitLocalCommand },
229
	{ "permitlocalcommand", oPermitLocalCommand },
230
	{ "receivebuffersize", oReceiveBufferSize },
229
	{ NULL, oBadOption }
231
	{ NULL, oBadOption }
230
};
232
};
231
233
Lines 915-920 Link Here
915
		intptr = &options->permit_local_command;
917
		intptr = &options->permit_local_command;
916
		goto parse_flag;
918
		goto parse_flag;
917
919
920
	case oReceiveBufferSize:
921
		intptr = &options->receive_buffer_size;
922
		arg = strdelim(&s);
923
		if (!arg || *arg == '\0')
924
			fatal("%.200s line %d: Missing argument.", filename, linenum);
925
		if (arg[0] < '0' || arg[0] > '9')
926
			fatal("%.200s line %d: Bad number.", filename, linenum);
927
		orig = val64 = strtoll(arg, &endofnumber, 10);
928
		if (arg == endofnumber)
929
			fatal("%.200s line %d: Bad number.", filename, linenum);
930
		switch (toupper(*endofnumber)) {
931
		case '\0':
932
			scale = 1;
933
			break;
934
		case 'K':
935
			scale = 1<<10;
936
			break;
937
		case 'M':
938
			scale = 1<<20;
939
			break;
940
		default:
941
			fatal("%.200s line %d: Invalid ReceiveBufferSize suffix",
942
			    filename, linenum);
943
		}
944
		val64 *= scale;
945
		/* detect integer wrap and too-large limits */
946
		if ((val64 / scale) != orig || val64 > INT_MAX)
947
			fatal("%.200s line %d: ReceiveBufferSize too large",
948
			    filename, linenum);
949
		if (*activep && *intptr == -1)
950
			*intptr = (int)val64;
951
		break;
952
918
	case oDeprecated:
953
	case oDeprecated:
919
		debug("%s line %d: Deprecated option \"%s\"",
954
		debug("%s line %d: Deprecated option \"%s\"",
920
		    filename, linenum, keyword);
955
		    filename, linenum, keyword);
Lines 1065-1070 Link Here
1065
	options->tun_remote = -1;
1100
	options->tun_remote = -1;
1066
	options->local_command = NULL;
1101
	options->local_command = NULL;
1067
	options->permit_local_command = -1;
1102
	options->permit_local_command = -1;
1103
	options->receive_buffer_size = -1;
1068
}
1104
}
1069
1105
1070
/*
1106
/*
Lines 1199-1210 Link Here
1199
		options->tun_remote = SSH_TUNID_ANY;
1235
		options->tun_remote = SSH_TUNID_ANY;
1200
	if (options->permit_local_command == -1)
1236
	if (options->permit_local_command == -1)
1201
		options->permit_local_command = 0;
1237
		options->permit_local_command = 0;
1238
	if (options->receive_buffer_size == -1)
1239
		options->receive_buffer_size = 0;
1202
	/* options->local_command should not be set by default */
1240
	/* options->local_command should not be set by default */
1203
	/* options->proxy_command should not be set by default */
1241
	/* options->proxy_command should not be set by default */
1204
	/* options->user will be set in the main program if appropriate */
1242
	/* options->user will be set in the main program if appropriate */
1205
	/* options->hostname will be set in the main program if appropriate */
1243
	/* options->hostname will be set in the main program if appropriate */
1206
	/* options->host_key_alias should not be set by default */
1244
	/* options->host_key_alias should not be set by default */
1207
	/* options->preferred_authentications will be set in ssh */
1245
	/* options->preferred_authentications will be set in ssh */
1246
	/* options->receive_buffer_size should not be set by default */
1208
}
1247
}
1209
1248
1210
/*
1249
/*
(-)openssh-4.6p1/readconf.h (+1 lines)
Lines 120-125 Link Here
120
120
121
	char	*local_command;
121
	char	*local_command;
122
	int	permit_local_command;
122
	int	permit_local_command;
123
	int	receive_buffer_size;
123
124
124
}       Options;
125
}       Options;
125
126
(-)openssh-4.6p1/ssh.1 (+1 lines)
Lines 479-484 Link Here
479
.It Protocol
479
.It Protocol
480
.It ProxyCommand
480
.It ProxyCommand
481
.It PubkeyAuthentication
481
.It PubkeyAuthentication
482
.It ReceiveBufferSize
482
.It RekeyLimit
483
.It RekeyLimit
483
.It RemoteForward
484
.It RemoteForward
484
.It RhostsRSAAuthentication
485
.It RhostsRSAAuthentication
(-)openssh-4.6p1/ssh_config.5 (+10 lines)
Lines 753-758 Link Here
753
The default is
753
The default is
754
.Dq yes .
754
.Dq yes .
755
This option applies to protocol version 2 only.
755
This option applies to protocol version 2 only.
756
.It Cm ReceiveBufferSize
757
Specifies the requested size for the TCP receive buffer.
758
The argument is the number of bytes, with an optional suffix of
759
.Sq K
760
or
761
.Sq M
762
to indicate Kilobytes or Megabytes, respectively.
763
If the requested value is less than the current TCP receive buffer,
764
the buffer is unchanged.
765
The default value is zero.
756
.It Cm RekeyLimit
766
.It Cm RekeyLimit
757
Specifies the maximum amount of data that may be transmitted before the
767
Specifies the maximum amount of data that may be transmitted before the
758
session key is renegotiated.
768
session key is renegotiated.
(-)openssh-4.6p1/sshconnect.c (+14 lines)
Lines 304-309 Link Here
304
	int gaierr;
304
	int gaierr;
305
	int on = 1;
305
	int on = 1;
306
	int sock = -1, attempt;
306
	int sock = -1, attempt;
307
	int rcvbuf = INT_MAX;
308
	socklen_t size = sizeof(rcvbuf);
307
	char ntop[NI_MAXHOST], strport[NI_MAXSERV];
309
	char ntop[NI_MAXHOST], strport[NI_MAXSERV];
308
	struct addrinfo hints, *ai, *aitop;
310
	struct addrinfo hints, *ai, *aitop;
309
311
Lines 383-388 Link Here
383
	    setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void *)&on,
385
	    setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void *)&on,
384
	    sizeof(on)) < 0)
386
	    sizeof(on)) < 0)
385
		error("setsockopt SO_KEEPALIVE: %.100s", strerror(errno));
387
		error("setsockopt SO_KEEPALIVE: %.100s", strerror(errno));
388
389
	/* Conditionally set SO_RCVBUF if requested. */
390
	getsockopt(sock, SOL_SOCKET, SO_RCVBUF, &rcvbuf, &size);
391
	if (rcvbuf < options.receive_buffer_size) {
392
		rcvbuf = options.receive_buffer_size;
393
		if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void *)&rcvbuf,
394
		    sizeof(rcvbuf)) < 0) {
395
			error("setsockopt SO_RCVBUF: %.100s", strerror(errno));
396
		} else {
397
			debug("Set TCP receive buffer to %d bytes", rcvbuf);
398
		}
399
	}
386
400
387
	/* Set the connection. */
401
	/* Set the connection. */
388
	packet_set_connection(sock, sock);
402
	packet_set_connection(sock, sock);

Return to bug 1332