diff options
author | csgr <csgr@FreeBSD.org> | 1994-09-11 11:16:32 +0000 |
---|---|---|
committer | csgr <csgr@FreeBSD.org> | 1994-09-11 11:16:32 +0000 |
commit | f146ba5a9becb7d9adabd5ac495d9f758d2965b2 (patch) | |
tree | 16f9f63e3fa7314ad4ae34efad7277913e522aed /usr.sbin/inetd | |
parent | a8154dca28a80e6cb6165d299b4400c991f20da5 (diff) | |
download | FreeBSD-src-f146ba5a9becb7d9adabd5ac495d9f758d2965b2.zip FreeBSD-src-f146ba5a9becb7d9adabd5ac495d9f758d2965b2.tar.gz |
- increase TOOMANY, in line with 1.x
- add logging option from 1.x
Diffstat (limited to 'usr.sbin/inetd')
-rw-r--r-- | usr.sbin/inetd/inetd.8 | 12 | ||||
-rw-r--r-- | usr.sbin/inetd/inetd.c | 25 |
2 files changed, 34 insertions, 3 deletions
diff --git a/usr.sbin/inetd/inetd.8 b/usr.sbin/inetd/inetd.8 index 07392a1..cfb8b86 100644 --- a/usr.sbin/inetd/inetd.8 +++ b/usr.sbin/inetd/inetd.8 @@ -42,6 +42,7 @@ .Sh SYNOPSIS .Nm inetd .Op Fl d +.Op Fl l .Op Fl R Ar rate .Op Ar configuration file .Sh DESCRIPTION @@ -72,6 +73,8 @@ The options available for .Bl -tag -width Ds .It Fl d Turns on debugging. +.It Fl l +Turns on logging. .It Fl R Ar rate Specifies the maximum number of times a service can be invoked in one minute; the default is 1000. @@ -299,6 +302,15 @@ details of these services, consult the appropriate .Tn RFC from the Network Information Center. .Pp +When given the +.Fl l +option +.Nm Inetd +will log an entry to syslog each time an +.Xr accept 2 +is made, which notes the +service selected and the IP-number of the remote requestor. +.Pp The .Nm inetd program diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c index 11a880d..e3e79c6 100644 --- a/usr.sbin/inetd/inetd.c +++ b/usr.sbin/inetd/inetd.c @@ -125,7 +125,7 @@ static char RCSid[] = "$Id"; #include "pathnames.h" -#define TOOMANY 40 /* 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 */ @@ -133,6 +133,7 @@ static char RCSid[] = "$Id"; int debug = 0; +int log = 0; int nsock, maxsock; fd_set allsock; int options; @@ -249,6 +250,8 @@ main(argc, argv, envp) int tmpint, ch, dofork; pid_t pid; char buf[50]; + struct sockaddr_in peer; + int i; Argv = argv; if (envp == 0 || *envp == 0) @@ -259,12 +262,15 @@ main(argc, argv, envp) openlog("inetd", LOG_PID | LOG_NOWAIT, LOG_DAEMON); - while ((ch = getopt(argc, argv, "dR:")) != EOF) + while ((ch = getopt(argc, argv, "dlR:")) != EOF) switch(ch) { case 'd': debug = 1; options |= SO_DEBUG; break; + case 'l': + log = 1; + break; case 'R': { /* invocation rate */ char *p; @@ -280,7 +286,7 @@ main(argc, argv, envp) case '?': default: syslog(LOG_ERR, - "usage: inetd [-d] [-R rate] [conf-file]"); + "usage: inetd [-dl] [-R rate] [conf-file]"); exit(1); } argc -= optind; @@ -347,6 +353,19 @@ main(argc, argv, envp) sep->se_service); continue; } + if(log) { + i = sizeof peer; + if(getpeername(ctrl, (struct sockaddr *) + &peer, &i)) { + syslog(LOG_WARNING, + "getpeername(for %s): %m", + sep->se_service); + continue; + } + syslog(LOG_INFO,"%s from %s", + sep->se_service, + inet_ntoa(peer.sin_addr)); + } /* * Call tcpmux to find the real service to exec. */ |