aboutsummaryrefslogtreecommitdiff
path: root/crypto/openssh/servconf.c
diff options
context:
space:
mode:
authorMark Murray <markm@FreeBSD.org>2000-02-24 15:29:42 +0000
committerMark Murray <markm@FreeBSD.org>2000-02-24 15:29:42 +0000
commit42f71286cde4107ce6327244cc3c6442c5dc66a6 (patch)
treea55af7a5ec62a463f1847bf01916eba0477b9385 /crypto/openssh/servconf.c
parent8e3e42fe0766741af3f33bfb7d3b26594991bd07 (diff)
downloadsrc-42f71286cde4107ce6327244cc3c6442c5dc66a6.tar.gz
src-42f71286cde4107ce6327244cc3c6442c5dc66a6.zip
Add the patches fom ports (QV: ports/security/openssh/patches/patch-*)
Notes
Notes: svn path=/head/; revision=57432
Diffstat (limited to 'crypto/openssh/servconf.c')
-rw-r--r--crypto/openssh/servconf.c76
1 files changed, 43 insertions, 33 deletions
diff --git a/crypto/openssh/servconf.c b/crypto/openssh/servconf.c
index eb1b20e72d81..6ae36e639be7 100644
--- a/crypto/openssh/servconf.c
+++ b/crypto/openssh/servconf.c
@@ -9,6 +9,7 @@
*
* Created: Mon Aug 21 15:48:58 1995 ylo
*
+ * $FreeBSD$
*/
#include "includes.h"
@@ -67,6 +68,8 @@ initialize_server_options(ServerOptions *options)
options->num_deny_users = 0;
options->num_allow_groups = 0;
options->num_deny_groups = 0;
+ options->connections_per_period = 0;
+ options->connections_period = 0;
}
void
@@ -159,7 +162,7 @@ typedef enum {
sPrintMotd, sIgnoreRhosts, sX11Forwarding, sX11DisplayOffset,
sStrictModes, sEmptyPasswd, sRandomSeedFile, sKeepAlives, sCheckMail,
sUseLogin, sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups,
- sIgnoreUserKnownHosts
+ sIgnoreUserKnownHosts, sConnectionsPerPeriod
} ServerOpCodes;
/* Textual representation of the tokens. */
@@ -207,6 +210,7 @@ static struct {
{ "denyusers", sDenyUsers },
{ "allowgroups", sAllowGroups },
{ "denygroups", sDenyGroups },
+ { "connectionsperperiod", sConnectionsPerPeriod },
{ NULL, 0 }
};
@@ -316,7 +320,11 @@ parse_int:
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;
@@ -506,63 +514,65 @@ parse_flag:
case sAllowUsers:
while ((cp = strtok(NULL, WHITESPACE))) {
- if (options->num_allow_users >= MAX_ALLOW_USERS) {
- fprintf(stderr, "%s line %d: too many allow users.\n",
- filename, linenum);
- exit(1);
- }
+ if (options->num_allow_users >= MAX_ALLOW_USERS)
+ fatal("%.200s line %d: too many allow users.\n", filename,
+ linenum);
options->allow_users[options->num_allow_users++] = xstrdup(cp);
}
break;
case sDenyUsers:
while ((cp = strtok(NULL, WHITESPACE))) {
- if (options->num_deny_users >= MAX_DENY_USERS) {
- fprintf(stderr, "%s line %d: too many deny users.\n",
- filename, linenum);
- exit(1);
- }
+ if (options->num_deny_users >= MAX_DENY_USERS)
+ fatal("%.200s line %d: too many deny users.\n", filename,
+ linenum);
options->deny_users[options->num_deny_users++] = xstrdup(cp);
}
break;
case sAllowGroups:
while ((cp = strtok(NULL, WHITESPACE))) {
- if (options->num_allow_groups >= MAX_ALLOW_GROUPS) {
- fprintf(stderr, "%s line %d: too many allow groups.\n",
- filename, linenum);
- exit(1);
- }
+ if (options->num_allow_groups >= MAX_ALLOW_GROUPS)
+ fatal("%.200s line %d: too many allow groups.\n", filename,
+ linenum);
options->allow_groups[options->num_allow_groups++] = xstrdup(cp);
}
break;
case sDenyGroups:
while ((cp = strtok(NULL, WHITESPACE))) {
- if (options->num_deny_groups >= MAX_DENY_GROUPS) {
- fprintf(stderr, "%s line %d: too many deny groups.\n",
- filename, linenum);
- exit(1);
- }
+ if (options->num_deny_groups >= MAX_DENY_GROUPS)
+ fatal("%.200s line %d: too many deny groups.\n", 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;
+
default:
- fprintf(stderr, "%s line %d: Missing handler for opcode %s (%d)\n",
+ fatal("%.200s line %d: Missing handler for opcode %s (%d)\n",
filename, linenum, cp, opcode);
- exit(1);
- }
- if (strtok(NULL, WHITESPACE) != NULL) {
- fprintf(stderr, "%s line %d: garbage at end of line.\n",
- filename, linenum);
- exit(1);
}
+ if (strtok(NULL, WHITESPACE) != NULL)
+ fatal("%.200s line %d: garbage at end of line.\n", filename,
+ linenum);
}
fclose(f);
- if (bad_options > 0) {
- fprintf(stderr, "%s: terminating, %d bad configuration options\n",
+ if (bad_options > 0)
+ fatal("%.200s: terminating, %d bad configuration options\n",
filename, bad_options);
- exit(1);
- }
}