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/inetd.c | |
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/inetd.c')
-rw-r--r-- | usr.sbin/inetd/inetd.c | 16 |
1 files changed, 9 insertions, 7 deletions
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"); |