diff options
author | dwmalone <dwmalone@FreeBSD.org> | 2000-08-03 15:45:38 +0000 |
---|---|---|
committer | dwmalone <dwmalone@FreeBSD.org> | 2000-08-03 15:45:38 +0000 |
commit | f36f8d5bae2c807884f6707c6d3b169c3e868e85 (patch) | |
tree | 2f66ed57f139993cd0aa9de4e3a40c0c7ad6fde4 /usr.sbin/inetd | |
parent | 66d22fe285ca84420182a8dae0bba6b6fa3d4bf0 (diff) | |
download | FreeBSD-src-f36f8d5bae2c807884f6707c6d3b169c3e868e85.zip FreeBSD-src-f36f8d5bae2c807884f6707c6d3b169c3e868e85.tar.gz |
Explain "-c" option more exactly and state the default in the man
page.
Add ability to run "inetd -R 0" to disable the default connection
per minute limit of 256 connections. Document this in man page.
Don't use maxchild as a boolean - instead check if it is greater
than zero.
Reviewed by: sheldonh
Based on a patch by: Alexander Langer <alex@big.endian.de>
Diffstat (limited to 'usr.sbin/inetd')
-rw-r--r-- | usr.sbin/inetd/inetd.8 | 5 | ||||
-rw-r--r-- | usr.sbin/inetd/inetd.c | 16 |
2 files changed, 13 insertions, 8 deletions
diff --git a/usr.sbin/inetd/inetd.8 b/usr.sbin/inetd/inetd.8 index 1552722..c10f9cd 100644 --- a/usr.sbin/inetd/inetd.8 +++ b/usr.sbin/inetd/inetd.8 @@ -89,7 +89,9 @@ section for more information on TCP Wrappers support. Turn on TCP Wrapping for internal services which are built in to .Nm inetd . .It Fl c Ar maximum -Specify the default maximum number of services that can be invoked. +Specify the default maximum number of +simultaneous invocations of each service; +the default is unlimited. May be overridden on a per-service basis with the "max-child" parameter. .It Fl C Ar rate @@ -100,6 +102,7 @@ May be overridden on a per-service basis with the .It Fl R Ar rate Specify the maximum number of times a service can be invoked in one minute; the default is 256. +A rate of 0 allows an unlimited number of invocations. .It Fl a Specify a specific IP address to bind to. Alternatively, a hostname can be specified, diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c index 8b7d05a..3df747d 100644 --- a/usr.sbin/inetd/inetd.c +++ b/usr.sbin/inetd/inetd.c @@ -191,7 +191,9 @@ static const char rcsid[] = < 0 = no limit */ #endif +#ifndef TOOMANY #define TOOMANY 256 /* don't start more than TOOMANY */ +#endif #define CNT_INTVL 60 /* servers in CNT_INTVL sec. */ #define RETRYTIME (60*10) /* retry after bind or server fail */ #define MAX_MAXCHLD 32767 /* max allowable max children */ @@ -247,7 +249,7 @@ getvalue(arg, value, whine) char *p; tmp = strtol(arg, &p, 0); - if (tmp < 1 || *p) { + if (tmp < 0 || *p) { syslog(LOG_ERR, whine, arg); return 1; /* failure */ } @@ -590,7 +592,7 @@ main(argc, argv, envp) if (dofork) { if (sep->se_count++ == 0) (void)gettimeofday(&sep->se_time, (struct timezone *)NULL); - else if (sep->se_count >= toomany) { + else if (toomany > 0 && sep->se_count >= toomany) { struct timeval now; (void)gettimeofday(&now, (struct timezone *)NULL); @@ -795,6 +797,8 @@ void flag_signal(c) void addchild(struct servtab *sep, pid_t pid) { + if (sep->se_maxchild <= 0) + return; #ifdef SANITY_CHECK if (sep->se_numchild >= sep->se_maxchild) { syslog(LOG_ERR, "%s: %d >= %d", @@ -802,8 +806,6 @@ addchild(struct servtab *sep, pid_t pid) exit(EX_SOFTWARE); } #endif - if (sep->se_maxchild == 0) - return; sep->se_pids[sep->se_numchild++] = pid; if (sep->se_numchild == sep->se_maxchild) disable(sep); @@ -906,7 +908,7 @@ void config() sep->se_reset = 1; } /* copy over outstanding child pids */ - if (sep->se_maxchild && new->se_maxchild) { + if (sep->se_maxchild > 0 && new->se_maxchild > 0) { new->se_numchild = sep->se_numchild; if (new->se_numchild > new->se_maxchild) new->se_numchild = new->se_maxchild; @@ -919,7 +921,7 @@ void config() sep->se_maxcpm = new->se_maxcpm; /* might need to turn on or off service now */ if (sep->se_fd >= 0) { - if (sep->se_maxchild + if (sep->se_maxchild > 0 && sep->se_numchild == sep->se_maxchild) { if (FD_ISSET(sep->se_fd, &allsock)) disable(sep); @@ -1718,7 +1720,7 @@ more: else sep->se_maxchild = 1; } - if (sep->se_maxchild) { + if (sep->se_maxchild > 0) { sep->se_pids = malloc(sep->se_maxchild * sizeof(*sep->se_pids)); if (sep->se_pids == NULL) { syslog(LOG_ERR, "malloc: %m"); |