Commit 637642e6 authored by Marco d'Itri's avatar Marco d'Itri

Imported Upstream version 0.20091229

parent 578b42ab
2009-12-29 11:25 sobrado
* inetd.8: replace a few remaining UNIX terms with .Ux macros; this
diff completes the changes from Oct 22.
2009-11-02 21:03 otto
* inetd.c: we have closefrom(2), so use it; ok deraadt@ tedu@
2009-10-28 00:59 deraadt
* inetd.c: rcsid[] and sccsid[] and copyright[] are essentially
unmaintained (and unmaintainable). these days, people use
source. these id's do not provide any benefit, and do hurt the
small install media (the 33,000 line diff is essentially
mechanical) ok with the idea millert, ok dms
2008-07-28 17:42 claudio
* inetd.c: Do not use __progname in inetd as it is not portable.
Instead hardcode it to "inetd" in the few locations that print
out the program name. requested and OK deraadt@
2008-07-27 12:06 claudio
* inetd.c: Use __progname instead of hand rolled version using
argv[0]. Diff from Gleydson Soares gsoares at gmail dot com OK
millert@
2008-06-28 12:54 sobrado
* inetd.8, inetd.c: add an underscore to argument name.
2008-06-04 20:11 miod
* inetd.c: adderss -> address
2008-01-25 14:52 espie
* inetd.c: validate argv, okay otto@, henning@
......
.\" $OpenBSD: inetd.8,v 1.31 2008/01/06 13:49:42 jmc Exp $
.\" $OpenBSD: inetd.8,v 1.33 2008/06/28 10:54:45 sobrado Exp $
.\" Copyright (c) 1985, 1991 The Regents of the University of California.
.\" All rights reserved.
.\"
......@@ -28,7 +28,7 @@
.\"
.\" from: @(#)inetd.8 6.7 (Berkeley) 3/16/91
.\"
.Dd $Mdocdate: January 6 2008 $
.Dd $Mdocdate: December 29 2009 $
.Dt INETD 8
.Os
.Sh NAME
......@@ -39,7 +39,7 @@
.Nm inetd
.Op Fl d
.Op Fl R Ar rate
.Op Ar configuration file
.Op Ar configuration_file
.Sh DESCRIPTION
.Nm inetd
should be run at boot time by
......@@ -168,8 +168,8 @@ This can simply be a single numeric argument or a range of versions.
A range is bounded by the low version to the high version -
.Dq rusers/1-3 .
For
.Ux
domain sockets this field specifies the path name of the socket.
.Ux Ns -domain
sockets this field specifies the path name of the socket.
.Pp
The
.Em socket type
......@@ -211,8 +211,7 @@ A
of
.Dq unix
is used to specify a socket in the
.Ux
domain.
.Ux Ns -domain .
.Pp
The
.Em wait/nowait
......
/* $OpenBSD: inetd.c,v 1.125 2008/01/05 09:53:42 jmc Exp $ */
/* $OpenBSD: inetd.c,v 1.131 2009/10/27 23:59:51 deraadt Exp $ */
/*
* Copyright (c) 1983,1991 The Regents of the University of California.
......@@ -29,17 +29,6 @@
* SUCH DAMAGE.
*/
#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1983 Regents of the University of California.\n\
All rights reserved.\n";
#endif /* not lint */
#ifndef lint
/*static const char sccsid[] = "from: @(#)inetd.c 5.30 (Berkeley) 6/3/91";*/
static const char rcsid[] = "$OpenBSD: inetd.c,v 1.125 2008/01/05 09:53:42 jmc Exp $";
#endif /* not lint */
/*
* Inetd - Internet super-server
*
......@@ -300,7 +289,6 @@ int dg_broadcast(struct in_addr *in);
#define NUMINT (sizeof(intab) / sizeof(struct inent))
char *CONFIG = _PATH_INETDCONF;
char *progname;
void
fd_grow(fd_set **fdsp, int *bytes, int fd)
......@@ -332,10 +320,7 @@ main(int argc, char *argv[])
struct servtab *sep;
extern char *optarg;
extern int optind;
progname = strrchr(argv[0], '/');
progname = progname ? progname + 1 : argv[0];
while ((ch = getopt(argc, argv, "dR:")) != -1)
switch (ch) {
case 'd':
......@@ -359,8 +344,7 @@ main(int argc, char *argv[])
case '?':
default:
fprintf(stderr,
"usage: %s [-d] [-R rate] [configuration file]\n",
progname);
"usage: inetd [-d] [-R rate] [configuration_file]\n");
exit(1);
}
argc -= optind;
......@@ -372,13 +356,11 @@ main(int argc, char *argv[])
if (argc > 0)
CONFIG = argv[0];
if (CONFIG == NULL) {
fprintf(stderr, "%s: non-root must specify a config file\n",
progname);
fprintf(stderr, "inetd: non-root must specify a config file\n");
exit(1);
}
if (argc > 1) {
fprintf(stderr, "%s: more than one argument specified\n",
progname);
fprintf(stderr, "inetd: more than one argument specified\n");
exit(1);
}
......@@ -396,7 +378,7 @@ main(int argc, char *argv[])
setgroups(1, &gid);
}
openlog(progname, LOG_PID | LOG_NOWAIT, LOG_DAEMON);
openlog("inetd", LOG_PID | LOG_NOWAIT, LOG_DAEMON);
logpid();
if (getrlimit(RLIMIT_NOFILE, &rlim_nofile) < 0) {
......@@ -571,7 +553,7 @@ dg_badinput(struct sockaddr *sa)
if (IN6_IS_ADDR_MULTICAST(in6) || IN6_IS_ADDR_UNSPECIFIED(in6))
goto bad;
/*
* OpenBSD does not support IPv4 mapped adderss (RFC2553
* OpenBSD does not support IPv4 mapped address (RFC2553
* inbound behavior) at all. We should drop it.
*/
if (IN6_IS_ADDR_V4MAPPED(in6))
......@@ -1995,8 +1977,7 @@ spawn(struct servtab *sep, int ctrl)
dup2(STDIN_FILENO, STDOUT_FILENO);
dup2(STDIN_FILENO, STDERR_FILENO);
closelog();
for (tmpint = rlim_nofile_cur-1; --tmpint > 2; )
(void)close(tmpint);
closefrom(3);
sigaction(SIGPIPE, &sapipe, NULL);
execv(sep->se_server, sep->se_argv);
if (sep->se_socktype != SOCK_STREAM)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment