diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-11-14 03:46:01 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-11-14 03:46:01 +0000 |
commit | 215a08b6cfac96751b4468f27fbb76683aafeb5e (patch) | |
tree | c7db5fa7b793d018dc2f5a2165cc92e0ac8022e2 /usr.sbin/inetd | |
parent | ee4a0a7eaaf463a7e79c651261a06bfd0bf71eb2 (diff) |
clone freebsd "-R rate"; default to 256 invocations/minute
Diffstat (limited to 'usr.sbin/inetd')
-rw-r--r-- | usr.sbin/inetd/inetd.8 | 6 | ||||
-rw-r--r-- | usr.sbin/inetd/inetd.c | 28 |
2 files changed, 27 insertions, 7 deletions
diff --git a/usr.sbin/inetd/inetd.8 b/usr.sbin/inetd/inetd.8 index 8d9fec96f8a..12341b84f23 100644 --- a/usr.sbin/inetd/inetd.8 +++ b/usr.sbin/inetd/inetd.8 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)inetd.8 6.7 (Berkeley) 3/16/91 -.\" $Id: inetd.8,v 1.5 1997/06/26 06:27:27 denny Exp $ +.\" $Id: inetd.8,v 1.6 1997/11/14 03:46:00 deraadt Exp $ .\" .Dd March 16, 1991 .Dt INETD 8 @@ -42,6 +42,7 @@ .Sh SYNOPSIS .Nm inetd .Op Fl d +.Op Fl R Ar rate .Op Ar configuration file .Sh DESCRIPTION .Nm Inetd @@ -65,6 +66,9 @@ The option available for .Bl -tag -width Ds .It Fl d Turns on debugging. +.It Fl R Ar rate +Specify the maximum number of times a service can be invoked +in one minute; the default is 256. .El .Pp Upon execution, diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c index ff6a6f1f5ba..38ba7629718 100644 --- a/usr.sbin/inetd/inetd.c +++ b/usr.sbin/inetd/inetd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inetd.c,v 1.41 1997/11/14 03:40:02 deraadt Exp $ */ +/* $OpenBSD: inetd.c,v 1.42 1997/11/14 03:46:00 deraadt Exp $ */ /* $NetBSD: inetd.c,v 1.11 1996/02/22 11:14:41 mycroft Exp $ */ /* * Copyright (c) 1983,1991 The Regents of the University of California. @@ -41,7 +41,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)inetd.c 5.30 (Berkeley) 6/3/91";*/ -static char rcsid[] = "$OpenBSD: inetd.c,v 1.41 1997/11/14 03:40:02 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: inetd.c,v 1.42 1997/11/14 03:46:00 deraadt Exp $"; #endif /* not lint */ /* @@ -167,7 +167,7 @@ static char rcsid[] = "$OpenBSD: inetd.c,v 1.41 1997/11/14 03:40:02 deraadt Exp #include <rpc/pmap_clnt.h> #include "pathnames.h" -#define TOOMANY 160 /* don't start more than TOOMANY */ +#define TOOMANY 256 /* don't start more than TOOMANY */ #define CNT_INTVL 60 /* servers in CNT_INTVL sec. */ #define RETRYTIME (60*10) /* retry after bind or server fail */ @@ -183,6 +183,7 @@ void goaway __P((int)); int debug = 0; int nsock, maxsock; fd_set allsock; +int toomany = TOOMANY; int options; int timingout; struct servent *sp; @@ -314,15 +315,30 @@ main(argc, argv, envp) progname = strrchr(argv[0], '/'); progname = progname ? progname + 1 : argv[0]; - while ((ch = getopt(argc, argv, "d")) != -1) + while ((ch = getopt(argc, argv, "dR:")) != -1) switch(ch) { case 'd': debug = 1; options |= SO_DEBUG; break; case '?': + case 'R': { /* invocation rate */ + char *p; + int val; + + val = strtoul(optarg, &p, 0); + if (val >= 1 && p == NULL) { + toomany = val; + break; + } + syslog(LOG_ERR, + "-R %s: bad value for service invocation rate", + optarg); + break; + } default: - fprintf(stderr, "usage: %s [-d] [conf]", progname); + fprintf(stderr, "usage: %s [-R rate] [-d] [conf]", + progname); exit(1); } argc -= optind; @@ -1195,7 +1211,7 @@ more: *s++ = '\0'; sep->se_max = atoi(s); } else - sep->se_max = TOOMANY; + sep->se_max = toomany; } sep->se_wait = strcmp(arg, "wait") == 0; sep->se_user = newstr(skip(&cp)); |