summaryrefslogtreecommitdiff
path: root/security/openssh/files/patch-ap
blob: d3c63bea162074ece1f1fe0683579a0bd17586c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
--- servconf.c.orig	Tue May  9 02:12:15 2000
+++ servconf.c	Fri May 12 07:13:13 2000
@@ -74,6 +74,8 @@
 	options->ciphers = NULL;
 	options->protocol = SSH_PROTO_UNKNOWN;
 	options->gateway_ports = -1;
+ 	options->connections_per_period = 0;
+ 	options->connections_period = 0;
 }
 
 void
@@ -172,7 +174,7 @@
 #ifdef SKEY
 	sSkeyAuthentication,
 #endif
-	sPasswordAuthentication, sListenAddress,
+	sPasswordAuthentication, sListenAddress, sConnectionsPerPeriod,
 	sPrintMotd, sIgnoreRhosts, sX11Forwarding, sX11DisplayOffset,
 	sStrictModes, sEmptyPasswd, sRandomSeedFile, sKeepAlives, sCheckMail,
 	sUseLogin, sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups,
@@ -231,6 +233,7 @@
 	{ "ciphers", sCiphers },
 	{ "protocol", sProtocol },
 	{ "gatewayports", sGatewayPorts },
+ 	{ "connectionsperperiod", sConnectionsPerPeriod },
 	{ NULL, 0 }
 };
 
@@ -340,7 +343,11 @@
 					filename, linenum);
 				exit(1);
 			}
-			value = atoi(cp);
+			if (sscanf(cp, " %d ", &value) != 1) {
+				fprintf(stderr, "%s line %d: invalid integer value.\n",
+					filename, linenum);
+				exit(1);
+			}
 			if (*intptr == -1)
 				*intptr = value;
 			break;
@@ -584,6 +591,21 @@
 					    filename, linenum);
 				options->deny_groups[options->num_deny_groups++] = xstrdup(cp);
 			}
+			break;
+
+		case sConnectionsPerPeriod:
+			cp = strtok(NULL, WHITESPACE);
+			if (cp == NULL)
+				fatal("%.200s line %d: missing (>= 0) number argument.\n",
+					filename, linenum);
+			if (sscanf(cp, " %u/%u ", &options->connections_per_period,
+			    &options->connections_period) != 2)
+				fatal("%.200s line %d: invalid numerical argument(s).\n",
+				    filename, linenum);
+			if (options->connections_per_period != 0 &&
+			    options->connections_period == 0)
+				fatal("%.200s line %d: invalid connections period.\n",
+				    filename, linenum);
 			break;
 
 		case sCiphers: