CVS commit: src/usr.sbin/inetd

2024-05-24 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri May 24 21:55:13 UTC 2024

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
s/SO_ACCEPTFITLER/SO_ACCEPTFILTER/.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.67 src/usr.sbin/inetd/inetd.8:1.68
--- src/usr.sbin/inetd/inetd.8:1.67	Tue Oct 12 22:47:18 2021
+++ src/usr.sbin/inetd/inetd.8	Fri May 24 21:55:13 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.67 2021/10/12 22:47:18 rillig Exp $
+.\"	$NetBSD: inetd.8,v 1.68 2024/05/24 21:55:13 andvar Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -481,7 +481,7 @@ An accept filter, equivalent to
 in positional notation (see
 .Xr accept_filter 9
 and
-.Dv SO_ACCEPTFITLER
+.Dv SO_ACCEPTFILTER
 in
 .Xr setsockopt 2 ) .
 .It Sy protocol



CVS commit: src/usr.sbin/inetd

2024-05-24 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri May 24 21:55:13 UTC 2024

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
s/SO_ACCEPTFITLER/SO_ACCEPTFILTER/.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2022-08-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 10 08:38:43 UTC 2022

Modified Files:
src/usr.sbin/inetd: Makefile

Log Message:
Remove RPC define


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/inetd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/Makefile
diff -u src/usr.sbin/inetd/Makefile:1.31 src/usr.sbin/inetd/Makefile:1.32
--- src/usr.sbin/inetd/Makefile:1.31	Tue Aug  9 23:35:38 2022
+++ src/usr.sbin/inetd/Makefile	Wed Aug 10 04:38:43 2022
@@ -1,5 +1,5 @@
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
-#	$NetBSD: Makefile,v 1.31 2022/08/10 03:35:38 dholland Exp $
+#	$NetBSD: Makefile,v 1.32 2022/08/10 08:38:43 christos Exp $
 
 .include 
 
@@ -15,9 +15,6 @@ WARNS=	6
 # Enables debug printouts when in debug mode
 CPPFLAGS+=-DDEBUG_ENABLE
 
-# Enables SunRPC support
-CPPFLAGS+=-DRPC
-
 CPPFLAGS+=-DLIBWRAP
 # Use LIBWRAP_INTERNAL for libwrap checking of inetd's `internal' services.
 #CPPFLAGS+=-DLIBWRAP_INTERNAL



CVS commit: src/usr.sbin/inetd

2022-08-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 10 08:38:43 UTC 2022

Modified Files:
src/usr.sbin/inetd: Makefile

Log Message:
Remove RPC define


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/inetd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2022-08-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 10 08:37:53 UTC 2022

Modified Files:
src/usr.sbin/inetd: inetd.c inetd.h parse.c

Log Message:
PR/56963: Mark Davies: inetd not configured for rpc
Move RPC includes to inetd.h


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/inetd/inetd.h
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/inetd/parse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.140 src/usr.sbin/inetd/inetd.c:1.141
--- src/usr.sbin/inetd/inetd.c:1.140	Tue Aug  9 23:35:38 2022
+++ src/usr.sbin/inetd/inetd.c	Wed Aug 10 04:37:53 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.140 2022/08/10 03:35:38 dholland Exp $	*/
+/*	$NetBSD: inetd.c,v 1.141 2022/08/10 08:37:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.140 2022/08/10 03:35:38 dholland Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.141 2022/08/10 08:37:53 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -193,14 +193,6 @@ __RCSID("$NetBSD: inetd.c,v 1.140 2022/0
 #include 
 #include 
 
-#include 
-
-#ifdef RPC
-#include 
-#include 
-#include 
-#endif
-
 #include 
 #include 
 #include 

Index: src/usr.sbin/inetd/inetd.h
diff -u src/usr.sbin/inetd/inetd.h:1.5 src/usr.sbin/inetd/inetd.h:1.6
--- src/usr.sbin/inetd/inetd.h:1.5	Tue Oct 12 18:51:28 2021
+++ src/usr.sbin/inetd/inetd.h	Wed Aug 10 04:37:53 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.h,v 1.5 2021/10/12 22:51:28 rillig Exp $	*/
+/*	$NetBSD: inetd.h,v 1.6 2022/08/10 08:37:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -73,6 +73,18 @@
 #include 
 #include 
 
+#ifndef NO_RPC
+#define RPC
+#endif
+
+#include 
+
+#ifdef RPC
+#include 
+#include 
+#include 
+#endif
+
 
 #include "pathnames.h"
 

Index: src/usr.sbin/inetd/parse.c
diff -u src/usr.sbin/inetd/parse.c:1.4 src/usr.sbin/inetd/parse.c:1.5
--- src/usr.sbin/inetd/parse.c:1.4	Tue Aug  9 23:35:38 2022
+++ src/usr.sbin/inetd/parse.c	Wed Aug 10 04:37:53 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.4 2022/08/10 03:35:38 dholland Exp $	*/
+/*	$NetBSD: parse.c,v 1.5 2022/08/10 08:37:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.4 2022/08/10 03:35:38 dholland Exp $");
+__RCSID("$NetBSD: parse.c,v 1.5 2022/08/10 08:37:53 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -91,10 +91,6 @@ __RCSID("$NetBSD: parse.c,v 1.4 2022/08/
 #include 
 #include 
 
-#ifdef RPC
-#include 
-#endif
-
 #include "inetd.h"
 
 static void	config(void);



CVS commit: src/usr.sbin/inetd

2022-08-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 10 08:37:53 UTC 2022

Modified Files:
src/usr.sbin/inetd: inetd.c inetd.h parse.c

Log Message:
PR/56963: Mark Davies: inetd not configured for rpc
Move RPC includes to inetd.h


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/inetd/inetd.h
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/inetd/parse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2022-08-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Aug 10 03:35:39 UTC 2022

Modified Files:
src/usr.sbin/inetd: Makefile inetd.c parse.c

Log Message:
PR bin/56963 Mark Davies: inetd not configured for rpc

Instead of using negative flags to turn on positive flags, set -DRPC
in the makefile. Corrects a problem where the SunRPC code in parse.c
was accidentally left disabled.

This is a prime example of why we don't like negative flags...


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/inetd/Makefile
cvs rdiff -u -r1.139 -r1.140 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/inetd/parse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/Makefile
diff -u src/usr.sbin/inetd/Makefile:1.30 src/usr.sbin/inetd/Makefile:1.31
--- src/usr.sbin/inetd/Makefile:1.30	Tue Oct 12 19:08:04 2021
+++ src/usr.sbin/inetd/Makefile	Wed Aug 10 03:35:38 2022
@@ -1,5 +1,5 @@
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
-#	$NetBSD: Makefile,v 1.30 2021/10/12 19:08:04 christos Exp $
+#	$NetBSD: Makefile,v 1.31 2022/08/10 03:35:38 dholland Exp $
 
 .include 
 
@@ -15,6 +15,9 @@ WARNS=	6
 # Enables debug printouts when in debug mode
 CPPFLAGS+=-DDEBUG_ENABLE
 
+# Enables SunRPC support
+CPPFLAGS+=-DRPC
+
 CPPFLAGS+=-DLIBWRAP
 # Use LIBWRAP_INTERNAL for libwrap checking of inetd's `internal' services.
 #CPPFLAGS+=-DLIBWRAP_INTERNAL

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.139 src/usr.sbin/inetd/inetd.c:1.140
--- src/usr.sbin/inetd/inetd.c:1.139	Sun Oct 17 04:14:49 2021
+++ src/usr.sbin/inetd/inetd.c	Wed Aug 10 03:35:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.139 2021/10/17 04:14:49 ryo Exp $	*/
+/*	$NetBSD: inetd.c,v 1.140 2022/08/10 03:35:38 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.139 2021/10/17 04:14:49 ryo Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.140 2022/08/10 03:35:38 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -193,11 +193,6 @@ __RCSID("$NetBSD: inetd.c,v 1.139 2021/1
 #include 
 #include 
 
-
-#ifndef NO_RPC
-#define RPC
-#endif
-
 #include 
 
 #ifdef RPC

Index: src/usr.sbin/inetd/parse.c
diff -u src/usr.sbin/inetd/parse.c:1.3 src/usr.sbin/inetd/parse.c:1.4
--- src/usr.sbin/inetd/parse.c:1.3	Sun May 22 11:27:37 2022
+++ src/usr.sbin/inetd/parse.c	Wed Aug 10 03:35:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.3 2022/05/22 11:27:37 andvar Exp $	*/
+/*	$NetBSD: parse.c,v 1.4 2022/08/10 03:35:38 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.3 2022/05/22 11:27:37 andvar Exp $");
+__RCSID("$NetBSD: parse.c,v 1.4 2022/08/10 03:35:38 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -91,6 +91,10 @@ __RCSID("$NetBSD: parse.c,v 1.3 2022/05/
 #include 
 #include 
 
+#ifdef RPC
+#include 
+#endif
+
 #include "inetd.h"
 
 static void	config(void);
@@ -321,7 +325,7 @@ config(void)
 if (sep->se_fd != -1)
 	register_rpc(sep);
 			} else
-#endif
+#endif /* RPC */
 			{
 if (sep->se_fd >= 0)
 	close_sep(sep);



CVS commit: src/usr.sbin/inetd

2022-08-09 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Aug 10 03:35:39 UTC 2022

Modified Files:
src/usr.sbin/inetd: Makefile inetd.c parse.c

Log Message:
PR bin/56963 Mark Davies: inetd not configured for rpc

Instead of using negative flags to turn on positive flags, set -DRPC
in the makefile. Corrects a problem where the SunRPC code in parse.c
was accidentally left disabled.

This is a prime example of why we don't like negative flags...


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/inetd/Makefile
cvs rdiff -u -r1.139 -r1.140 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/inetd/parse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2021-10-16 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sun Oct 17 04:14:49 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
To an alias address, or in a multihoming environment, the internal dgram
server may respond from a different address than the destination address
sent by the client.
To solve this problem, I introduce sendfromto() and recvfromto() so that
the server can reply from the correct address, i.e., the destination address
used in the request.

This change also has the aspect of a reference implementation using the
RECVDSTADDR and PKTINFO socket options.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.138 src/usr.sbin/inetd/inetd.c:1.139
--- src/usr.sbin/inetd/inetd.c:1.138	Tue Oct 12 22:51:28 2021
+++ src/usr.sbin/inetd/inetd.c	Sun Oct 17 04:14:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.138 2021/10/12 22:51:28 rillig Exp $	*/
+/*	$NetBSD: inetd.c,v 1.139 2021/10/17 04:14:49 ryo Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.138 2021/10/12 22:51:28 rillig Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.139 2021/10/17 04:14:49 ryo Exp $");
 #endif
 #endif /* not lint */
 
@@ -269,6 +269,11 @@ size_t		changes;
 
 struct servtab *servtab;
 
+static ssize_t	recvfromto(int, void * restrict, size_t, int,
+struct sockaddr * restrict, socklen_t * restrict,
+struct sockaddr * restrict, socklen_t * restrict);
+static ssize_t	sendfromto(int, const void *, size_t, int,
+const struct sockaddr *, socklen_t, const struct sockaddr *, socklen_t);
 static void	chargen_dg(int, struct servtab *);
 static void	chargen_stream(int, struct servtab *);
 static void	daytime_dg(int, struct servtab *);
@@ -809,6 +814,26 @@ setsockopt(fd, SOL_SOCKET, opt, , (so
 	if (sep->se_socktype == SOCK_STREAM)
 		listen(sep->se_fd, 10);
 
+	/* for internal dgram, setsockopt() is required for recvfromto() */
+	if (sep->se_socktype == SOCK_DGRAM && sep->se_bi != NULL) {
+		switch (sep->se_family) {
+		case AF_INET:
+			if (setsockopt(sep->se_fd, IPPROTO_IP,
+			IP_RECVDSTADDR, , sizeof(on)) < 0)
+syslog(LOG_ERR,
+"setsockopt (IP_RECVDSTADDR): %m");
+			break;
+#ifdef INET6
+		case AF_INET6:
+			if (setsockopt(sep->se_fd, IPPROTO_IPV6,
+			IPV6_RECVPKTINFO, , sizeof(on)) < 0)
+syslog(LOG_ERR,
+"setsockopt (IPV6_RECVPKTINFO): %m");
+			break;
+#endif
+		}
+	}
+
 	/* Set the accept filter, if specified. To be done after listen.*/
 	if (sep->se_accf.af_name[0] != 0 && setsockopt(sep->se_fd, SOL_SOCKET,
 	SO_ACCEPTFILTER, >se_accf,
@@ -955,6 +980,189 @@ bump_nofile(void)
 }
 
 /*
+ * In order to get the destination address (`to') with recvfromto(),
+ * IP_RECVDSTADDR or IP_RECVPKTINFO for AF_INET, or IPV6_RECVPKTINFO
+ * for AF_INET6, must be enabled with setsockopt(2).
+ *
+ * .sin_port and .sin6_port in 'to' are always stored as zero.
+ * If necessary, extract them using getsockname(2).
+ */
+static ssize_t
+recvfromto(int s, void * restrict buf, size_t len, int flags,
+struct sockaddr * restrict from, socklen_t * restrict fromlen,
+struct sockaddr * restrict to, socklen_t * restrict tolen)
+{
+	struct msghdr msg;
+	struct iovec vec;
+	struct cmsghdr *cmsg;
+	struct sockaddr_storage ss;
+	char cmsgbuf[1024];
+	ssize_t rc;
+
+	if (to == NULL)
+		return recvfrom(s, buf, len, flags, from, fromlen);
+
+	if (tolen == NULL || fromlen == NULL) {
+		errno = EFAULT;
+		return -1;
+	}
+
+	vec.iov_base = buf;
+	vec.iov_len = len;
+	msg.msg_name = from;
+	msg.msg_namelen = *fromlen;
+	msg.msg_iov = 
+	msg.msg_iovlen = 1;
+	msg.msg_control = cmsgbuf;
+	msg.msg_controllen = sizeof(cmsgbuf);
+
+	rc = recvmsg(s, , flags);
+	if (rc < 0)
+		return rc;
+	*fromlen = msg.msg_namelen;
+
+	memset(, 0, sizeof(ss));
+	for (cmsg = (struct cmsghdr *)CMSG_FIRSTHDR(); cmsg != NULL;
+	cmsg = (struct cmsghdr *)CMSG_NXTHDR(, cmsg)) {
+		if (cmsg->cmsg_level == IPPROTO_IP &&
+		cmsg->cmsg_type == IP_RECVDSTADDR) {
+			struct in_addr *dst = (struct in_addr *)CMSG_DATA(cmsg);
+			struct sockaddr_in *sin = (struct sockaddr_in *)
+
+			sin->sin_len = sizeof(*sin);
+			sin->sin_family = AF_INET;
+			sin->sin_addr = *dst;
+			break;
+		}
+		if (cmsg->cmsg_level == IPPROTO_IP &&
+		cmsg->cmsg_type == IP_PKTINFO) {
+			struct in_pktinfo *pi =
+			(struct in_pktinfo *)CMSG_DATA(cmsg);
+			struct sockaddr_in *sin = (struct sockaddr_in *)
+
+			sin->sin_len = sizeof(*sin);
+			sin->sin_family = AF_INET;
+			sin->sin_addr = pi->ipi_addr;
+			break;
+		}
+#ifdef INET6
+		if (cmsg->cmsg_level == IPPROTO_IPV6 &&
+		cmsg->cmsg_type == IPV6_PKTINFO) {
+			

CVS commit: src/usr.sbin/inetd

2021-10-16 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sun Oct 17 04:14:49 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
To an alias address, or in a multihoming environment, the internal dgram
server may respond from a different address than the destination address
sent by the client.
To solve this problem, I introduce sendfromto() and recvfromto() so that
the server can reply from the correct address, i.e., the destination address
used in the request.

This change also has the aspect of a reference implementation using the
RECVDSTADDR and PKTINFO socket options.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:51:28 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c inetd.h parse.c ratelimit.c

Log Message:
inetd: remove trailing whitespace, add space after 'if' and 'for'

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/inetd/inetd.h
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/inetd/parse.c \
src/usr.sbin/inetd/ratelimit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.137 src/usr.sbin/inetd/inetd.c:1.138
--- src/usr.sbin/inetd/inetd.c:1.137	Tue Oct 12 19:08:04 2021
+++ src/usr.sbin/inetd/inetd.c	Tue Oct 12 22:51:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.137 2021/10/12 19:08:04 christos Exp $	*/
+/*	$NetBSD: inetd.c,v 1.138 2021/10/12 22:51:28 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.137 2021/10/12 19:08:04 christos Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.138 2021/10/12 22:51:28 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -1399,7 +1399,7 @@ allocchange(void)
 bool
 try_biltin(struct servtab *sep)
 {
-	for(size_t i = 0; i < __arraycount(biltins); i++) {
+	for (size_t i = 0; i < __arraycount(biltins); i++) {
 		if (biltins[i].bi_socktype == sep->se_socktype &&
 		strcmp(biltins[i].bi_service, sep->se_service) == 0) {
 			sep->se_bi = [i];

Index: src/usr.sbin/inetd/inetd.h
diff -u src/usr.sbin/inetd/inetd.h:1.4 src/usr.sbin/inetd/inetd.h:1.5
--- src/usr.sbin/inetd/inetd.h:1.4	Tue Oct 12 19:08:04 2021
+++ src/usr.sbin/inetd/inetd.h	Tue Oct 12 22:51:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.h,v 1.4 2021/10/12 19:08:04 christos Exp $	*/
+/*	$NetBSD: inetd.h,v 1.5 2021/10/12 22:51:28 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -197,8 +197,8 @@ struct rl_ip_node {
 		/* align for efficient comparison in rl_try_get, could use 8 instead */
 		struct in6_addr	ipv6_addr __attribute__((aligned(16)));
 #endif
-		/* 
-		 * other_addr is used for other address types besides the 
+		/*
+		 * other_addr is used for other address types besides the
 		 * special cases (IPv4/IPv6), using getnameinfo.
 		 */
 		struct {
@@ -208,13 +208,13 @@ struct rl_ip_node {
 			char other_addr[];
 		};
 	};
-	/* 
+	/*
 	 * Do not declare further members after union, offsetof is used to
 	 * determine malloc size.
 	 */
 };
 
-/* 
+/*
  * From inetd.c
  */
 
@@ -262,7 +262,7 @@ extern char	*defhost;
 extern char	*policy;
 
 /*
- * From ratelimit.c 
+ * From ratelimit.c
  */
 
 int	rl_process(struct servtab *, int);

Index: src/usr.sbin/inetd/parse.c
diff -u src/usr.sbin/inetd/parse.c:1.1 src/usr.sbin/inetd/parse.c:1.2
--- src/usr.sbin/inetd/parse.c:1.1	Tue Oct 12 19:08:04 2021
+++ src/usr.sbin/inetd/parse.c	Tue Oct 12 22:51:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.1 2021/10/12 19:08:04 christos Exp $	*/
+/*	$NetBSD: parse.c,v 1.2 2021/10/12 22:51:28 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.1 2021/10/12 19:08:04 christos Exp $");
+__RCSID("$NetBSD: parse.c,v 1.2 2021/10/12 22:51:28 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -453,11 +453,11 @@ more:
 		goto more;
 	}
 
-	if(arg[0] == '.') {
+	if (arg[0] == '.') {
 		if (strcmp([1], "include") == 0) {
 			/* include directive */
 			arg = skip();
-			if(arg == NULL) {
+			if (arg == NULL) {
 LOG_TOO_FEW_ARGS();
 return NULL;
 			}
@@ -736,7 +736,7 @@ do { \
 
 	/* Parse user:group token */
 	arg = skip();
-	if(arg == NULL) {
+	if (arg == NULL) {
 		LOG_TOO_FEW_ARGS();
 		freeconfig(sep);
 		goto more;
Index: src/usr.sbin/inetd/ratelimit.c
diff -u src/usr.sbin/inetd/ratelimit.c:1.1 src/usr.sbin/inetd/ratelimit.c:1.2
--- src/usr.sbin/inetd/ratelimit.c:1.1	Tue Oct 12 19:08:04 2021
+++ src/usr.sbin/inetd/ratelimit.c	Tue Oct 12 22:51:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ratelimit.c,v 1.1 2021/10/12 19:08:04 christos Exp $	*/
+/*	$NetBSD: ratelimit.c,v 1.2 2021/10/12 22:51:28 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: ratelimit.c,v 1.1 2021/10/12 19:08:04 christos Exp $");
+__RCSID("$NetBSD: ratelimit.c,v 1.2 2021/10/12 22:51:28 rillig Exp $");
 
 #include 
 
@@ -89,7 +89,7 @@ rl_process(struct servtab *sep, int ctrl
 		sep->se_time = now;
 	}
 
-	if(!rl_process_service_max(sep, ctrl, ) 
+	if (!rl_process_service_max(sep, ctrl, )
 	|| !rl_process_ip_max(sep, ctrl, )) {
 		return -1;
 	}
@@ -225,7 +225,7 @@ 

CVS commit: src/usr.sbin/inetd

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:51:28 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c inetd.h parse.c ratelimit.c

Log Message:
inetd: remove trailing whitespace, add space after 'if' and 'for'

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/inetd/inetd.h
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/inetd/parse.c \
src/usr.sbin/inetd/ratelimit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:47:18 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
inetd.8: remove trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.66 src/usr.sbin/inetd/inetd.8:1.67
--- src/usr.sbin/inetd/inetd.8:1.66	Tue Oct 12 22:42:01 2021
+++ src/usr.sbin/inetd/inetd.8	Tue Oct 12 22:47:18 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.66 2021/10/12 22:42:01 rillig Exp $
+.\"	$NetBSD: inetd.8,v 1.67 2021/10/12 22:47:18 rillig Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -113,17 +113,17 @@ the
 .Fl d
 option is also given on the command line.
 .Pp
-Services can be specified using the legacy `positional' notation or the 
+Services can be specified using the legacy `positional' notation or the
 `key-values' notation described in the sections
 .Sx Positional Notation
-and 
+and
 .Sx Key-Values Notation
 below.
 .Ss Positional Notation
 There must be an entry for each field of the configuration
 file, with entries for each field separated by a tab or
 a space.
-Comments are denoted by a ``#'' at the beginning of a line (see subsection 
+Comments are denoted by a ``#'' at the beginning of a line (see subsection
 .Sx Key-Values Notation
 for defining comments in key-values definitions).
 There must be an entry for each field (except for one
@@ -160,7 +160,7 @@ Note that restricted listen addresses ar
 UNIX-domain services, and are not supported for
 .Em Sun-RPC
 services.
-All 
+All
 .Em Sun-RPC
 services always listen on all interfaces.
 .Pp
@@ -205,7 +205,7 @@ parameter is the path name to listen on.
 The
 .Em service-spec
 parameter must not begin with a dot.
-See 
+See
 .Sx Directives .
 .Pp
 The
@@ -400,49 +400,49 @@ It is possible to quote an argument usin
 This allows you to have, e.g., spaces in paths and parameters.
 .Ss Key-Values Notation
 In key-values notation, keys are separated from their associated values by `=',
-values are separated by whitespace, and key-values options are separated by 
+values are separated by whitespace, and key-values options are separated by
 commas.
 A service definition is terminated by a semicolon.
 Multiple definitions may exist on a single line (and a line may
 end with a positional definition.
 A key-values definition has the following form:
 .Bd -filled -offset indent
-[listen-addr:]service-spec {on|off}  = [value1], 
+[listen-addr:]service-spec {on|off}  = [value1],
  = [value1] [value2] ...,  =, ...;
 .Ed
 .Pp
 Values may be in quotes, and support the following escape sequences.
 .Bl -hang -width "\xXX" -offset indent
-.It Sy \e\e 
+.It Sy \e\e
 Backslash.
-.It Sy \en 
+.It Sy \en
 Line feed.
-.It Sy \et 
+.It Sy \et
 Tab.
-.It Sy \er 
+.It Sy \er
 Carriage return.
-.It Sy \e' 
+.It Sy \e'
 Single quote.
-.It Sy \e" 
+.It Sy \e"
 Double quote.
-.It Sy \exXX 
+.It Sy \exXX
 Hexadecimal byte value, replace XX.
 .El
 .Pp
-.Em [listen-addr:]service-spec 
-has the same form as in positional notation. If 
+.Em [listen-addr:]service-spec
+has the same form as in positional notation. If
 .Em service-spec
 is followed by
 .Em on
 then the service definition is active by default.
 If
 .Em service-spec
-is followed by 
+is followed by
 .Em off
 then the service definition is parsed and errors are output to
 the system log, but the service is not active and no sockets are created.
 .Pp
-Comments that exist between the initial on/off directive 
+Comments that exist between the initial on/off directive
 and the closing semicolon may begin in any column and may exist on the same line
 as non-comment text.
 Note: editor syntax highlighting may be misleading!
@@ -450,12 +450,12 @@ Note: editor syntax highlighting may be 
 Syntax and semantic error detection is performed on a best-effort basis.
 If an error with a service definition is easily detectable, it will
 log the error using
-.Xr syslog 3 
-and continue reading the configuration file if possible, skipping the erroneous 
-definition or file. 
-Otherwise, it is up to the user to write definitions that conform to the 
+.Xr syslog 3
+and continue reading the configuration file if possible, skipping the erroneous
+definition or file.
+Otherwise, it is up to the user to write definitions that conform to the
 documentation.
-Errors may be worded differently depending on the ordering of 
+Errors may be worded differently depending on the ordering of
 options in the service definition.
 .Pp
 The following are the available values for
@@ -466,33 +466,33 @@ Set the listen address for this service.
 This can be an IPv4 or IPv6 address or a hostname.
 .It Sy socktype
 Equivalent to
-.Em socket-type 
+.Em socket-type
 in positional notation.
 .Em socktype
-is 

CVS commit: src/usr.sbin/inetd

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:47:18 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
inetd.8: remove trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:42:01 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
inetd.8: new sentence, new line; minor formatting issues


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.65 src/usr.sbin/inetd/inetd.8:1.66
--- src/usr.sbin/inetd/inetd.8:1.65	Tue Oct 12 19:08:04 2021
+++ src/usr.sbin/inetd/inetd.8	Tue Oct 12 22:42:01 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.65 2021/10/12 19:08:04 christos Exp $
+.\"	$NetBSD: inetd.8,v 1.66 2021/10/12 22:42:01 rillig Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -92,9 +92,13 @@ The options available for
 .Nm :
 .Bl -tag -width Ds
 .It Fl d
-Turns on debugging and runs inetd in the foreground.
+Turns on debugging and runs
+.Nm
+in the foreground.
 .It Fl f
-Runs inetd in the foreground.
+Runs
+.Nm
+in the foreground.
 .It Fl l
 Turns on libwrap connection logging.
 .El
@@ -508,10 +512,10 @@ The value 
 .Li yes
 or
 .Li no .
-Equivalent to 
-.Em wait/nowait 
+Equivalent to
+.Em wait/nowait
 in positional notation.
-This option is automatically determined for internal 
+This option is automatically determined for internal
 services, and is mandatory for all others.
 .It Sy service_max
 Equivalent to
@@ -521,12 +525,14 @@ Defaults to 40 if not specified.
 .It Sy ip_max
 Specifies the maximum number of server instances that may be spawned from
 .Nm
-within an interval of 60 seconds for a given IP address. Other address types 
-may also work if supported by
-.Xr getnameinfo 3
-, test thoroughly using -d. For example, connections from unnamed Unix sockets
-do not work, but connections from named Unix sockets may work. However, there is
-no way to only accept named Unix sockets.
+within an interval of 60 seconds for a given IP address.
+Other address types may also work if supported by
+.Xr getnameinfo 3 ,
+test thoroughly using
+.Fl d .
+For example, connections from unnamed Unix sockets
+do not work, but connections from named Unix sockets may work.
+However, there is no way to only accept named Unix sockets.
 .It Sy user
 The user to run the program as.
 Equivalent to



CVS commit: src/usr.sbin/inetd

2021-10-12 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 12 22:42:01 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
inetd.8: new sentence, new line; minor formatting issues


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2021-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct 12 19:08:04 UTC 2021

Modified Files:
src/usr.sbin/inetd: Makefile inetd.8 inetd.c inetd.h parse_v2.c
Added Files:
src/usr.sbin/inetd: parse.c ratelimit.c

Log Message:
PR/56448: Solomon Ritzow: Various improvements.

Rate limiting code has been moved to ratelimit.c. I renamed
clear_ip_list to rl_clear_ip_list and broke the code up into more
functions. I have also made the per-IP rate limiting allocation more
efficient. IP addresses are now stored in their network format instead
of a string from getnameinfo (see inetd.h struct rl_ip_node). malloc
calls use only the space needed by the structure by using offsetof on
union members (I suppose this can be a bit dangerous if not done
correctly...). Per-IP rate limiting still supports textual comparison
using getnameinfo for address families other than AF_INET and AF_INET6, but I
don't think there are any that are actually compatible or used by inetd (I
haven't tested UNIX sockets with a remote bound to another file, but I did test
using IPv6 with the textual format by commenting out the IPv6 specific
code, and it works properly). Still potentially handy for the future.
The IP node list (se_rl_ip_list) now uses the  SLIST macros
instead of a custom list. I've broken rl_process up into helper functions
for each type of rate limiting and created a separate function for
address stringification, for use with printouts from the -d flag. I
tried to reduce stack memory use by moving printing code involving
string buffers into separate functions. I haven't tested rl_ipv6_eq on
a 32-bit system.

The code for the positional syntax has also been moved to parse.c.
Function try_biltin has been added to remove parse.c:parse_server's
dependency on the biltin structure definition.

File inetd.h has been updated with the proper function prototypes, and
the servtab structure has been update with the new IP node SLIST. I also
moved things around a bit. The way we (a peer and myself)
formatted inetd.h previously was somewhat confusing. Function and global
variable prototypes are now organized by the source file they are
defined in.

I also added a -f flag that I saw in another problem report
(https://gnats.netbsd.org/12823) that I thought could be useful. It
runs inetd in the foreground but without debug printouts or SO_DEBUG.
I'm not completely sure about the line "if (foreground) setsid()" that
I changed from "if (debug) setsid()".


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/inetd/Makefile
cvs rdiff -u -r1.64 -r1.65 src/usr.sbin/inetd/inetd.8
cvs rdiff -u -r1.136 -r1.137 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/inetd/inetd.h
cvs rdiff -u -r0 -r1.1 src/usr.sbin/inetd/parse.c \
src/usr.sbin/inetd/ratelimit.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/inetd/parse_v2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/Makefile
diff -u src/usr.sbin/inetd/Makefile:1.29 src/usr.sbin/inetd/Makefile:1.30
--- src/usr.sbin/inetd/Makefile:1.29	Fri Sep  3 16:24:28 2021
+++ src/usr.sbin/inetd/Makefile	Tue Oct 12 15:08:04 2021
@@ -1,12 +1,12 @@
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
-#	$NetBSD: Makefile,v 1.29 2021/09/03 20:24:28 rillig Exp $
+#	$NetBSD: Makefile,v 1.30 2021/10/12 19:08:04 christos Exp $
 
 .include 
 
 USE_FORT?= yes	# network server
 
 PROG=	inetd
-SRCS=	inetd.c parse_v2.c
+SRCS=	inetd.c parse.c parse_v2.c ratelimit.c
 MAN=	inetd.8
 MLINKS=	inetd.8 inetd.conf.5
 WARNS=	6

Index: src/usr.sbin/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.64 src/usr.sbin/inetd/inetd.8:1.65
--- src/usr.sbin/inetd/inetd.8:1.64	Tue Aug 31 07:16:00 2021
+++ src/usr.sbin/inetd/inetd.8	Tue Oct 12 15:08:04 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.64 2021/08/31 11:16:00 wiz Exp $
+.\"	$NetBSD: inetd.8,v 1.65 2021/10/12 19:08:04 christos Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -57,7 +57,7 @@
 .\"
 .\" from: @(#)inetd.8   8.4 (Berkeley) 6/1/94
 .\"
-.Dd August 29, 2021
+.Dd October 12, 2021
 .Dt INETD 8
 .Os
 .Sh NAME
@@ -92,7 +92,9 @@ The options available for
 .Nm :
 .Bl -tag -width Ds
 .It Fl d
-Turns on debugging.
+Turns on debugging and runs inetd in the foreground.
+.It Fl f
+Runs inetd in the foreground.
 .It Fl l
 Turns on libwrap connection logging.
 .El
@@ -519,7 +521,12 @@ Defaults to 40 if not specified.
 .It Sy ip_max
 Specifies the maximum number of server instances that may be spawned from
 .Nm
-within an interval of 60 seconds for a given IP address.
+within an interval of 60 seconds for a given IP address. Other address types 
+may also work if supported by
+.Xr getnameinfo 3
+, test thoroughly using -d. For example, connections from unnamed Unix sockets
+do not work, but connections from named Unix sockets may work. However, there is
+no way to only accept named Unix 

CVS commit: src/usr.sbin/inetd

2021-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Oct 12 19:08:04 UTC 2021

Modified Files:
src/usr.sbin/inetd: Makefile inetd.8 inetd.c inetd.h parse_v2.c
Added Files:
src/usr.sbin/inetd: parse.c ratelimit.c

Log Message:
PR/56448: Solomon Ritzow: Various improvements.

Rate limiting code has been moved to ratelimit.c. I renamed
clear_ip_list to rl_clear_ip_list and broke the code up into more
functions. I have also made the per-IP rate limiting allocation more
efficient. IP addresses are now stored in their network format instead
of a string from getnameinfo (see inetd.h struct rl_ip_node). malloc
calls use only the space needed by the structure by using offsetof on
union members (I suppose this can be a bit dangerous if not done
correctly...). Per-IP rate limiting still supports textual comparison
using getnameinfo for address families other than AF_INET and AF_INET6, but I
don't think there are any that are actually compatible or used by inetd (I
haven't tested UNIX sockets with a remote bound to another file, but I did test
using IPv6 with the textual format by commenting out the IPv6 specific
code, and it works properly). Still potentially handy for the future.
The IP node list (se_rl_ip_list) now uses the  SLIST macros
instead of a custom list. I've broken rl_process up into helper functions
for each type of rate limiting and created a separate function for
address stringification, for use with printouts from the -d flag. I
tried to reduce stack memory use by moving printing code involving
string buffers into separate functions. I haven't tested rl_ipv6_eq on
a 32-bit system.

The code for the positional syntax has also been moved to parse.c.
Function try_biltin has been added to remove parse.c:parse_server's
dependency on the biltin structure definition.

File inetd.h has been updated with the proper function prototypes, and
the servtab structure has been update with the new IP node SLIST. I also
moved things around a bit. The way we (a peer and myself)
formatted inetd.h previously was somewhat confusing. Function and global
variable prototypes are now organized by the source file they are
defined in.

I also added a -f flag that I saw in another problem report
(https://gnats.netbsd.org/12823) that I thought could be useful. It
runs inetd in the foreground but without debug printouts or SO_DEBUG.
I'm not completely sure about the line "if (foreground) setsid()" that
I changed from "if (debug) setsid()".


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/inetd/Makefile
cvs rdiff -u -r1.64 -r1.65 src/usr.sbin/inetd/inetd.8
cvs rdiff -u -r1.136 -r1.137 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/inetd/inetd.h
cvs rdiff -u -r0 -r1.1 src/usr.sbin/inetd/parse.c \
src/usr.sbin/inetd/ratelimit.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/inetd/parse_v2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2021-09-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep  3 21:02:04 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c ipsec.c

Log Message:
inetd: remove redundant tests before calling isspace


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/inetd/ipsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.135 src/usr.sbin/inetd/inetd.c:1.136
--- src/usr.sbin/inetd/inetd.c:1.135	Fri Sep  3 20:41:19 2021
+++ src/usr.sbin/inetd/inetd.c	Fri Sep  3 21:02:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.135 2021/09/03 20:41:19 rillig Exp $	*/
+/*	$NetBSD: inetd.c,v 1.136 2021/09/03 21:02:04 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.135 2021/09/03 20:41:19 rillig Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.136 2021/09/03 21:02:04 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -1234,7 +1234,7 @@ more:
 		/* lines starting with #@ is not a comment, but the policy */
 		if (cp[1] == '@') {
 			char *p;
-			for (p = cp + 2; p && *p && isspace((unsigned char)*p); p++)
+			for (p = cp + 2; isspace((unsigned char)*p); p++)
 ;
 			if (*p == '\0') {
 if (policy)

Index: src/usr.sbin/inetd/ipsec.c
diff -u src/usr.sbin/inetd/ipsec.c:1.7 src/usr.sbin/inetd/ipsec.c:1.8
--- src/usr.sbin/inetd/ipsec.c:1.7	Fri Sep  3 20:24:28 2021
+++ src/usr.sbin/inetd/ipsec.c	Fri Sep  3 21:02:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.7 2021/09/03 20:24:28 rillig Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.8 2021/09/03 21:02:04 rillig Exp $	*/
 
 /*
  * Copyright (C) 1999 WIDE Project.
@@ -69,7 +69,7 @@ ipsecsetup(int af, int fd, const char *p
 		p = strtok(p, ";");
 		if (p == NULL)
 			break;
-		while (*p && isspace((unsigned char)*p))
+		while (isspace((unsigned char)*p))
 			p++;
 		if (*p == '\0') {
 			p = NULL;
@@ -103,7 +103,7 @@ ipsecsetup_test(const char *policy)
 		p = strtok(p, ";");
 		if (p == NULL)
 			break;
-		while (*p && isspace((unsigned char)*p))
+		while (isspace((unsigned char)*p))
 			p++;
 		if (*p == '\0') {
 			p = NULL;



CVS commit: src/usr.sbin/inetd

2021-09-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep  3 21:02:04 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c ipsec.c

Log Message:
inetd: remove redundant tests before calling isspace


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/inetd/ipsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2021-09-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep  3 20:41:19 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
inetd: remove redundant null check before free

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.134 src/usr.sbin/inetd/inetd.c:1.135
--- src/usr.sbin/inetd/inetd.c:1.134	Fri Sep  3 20:24:28 2021
+++ src/usr.sbin/inetd/inetd.c	Fri Sep  3 20:41:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.134 2021/09/03 20:24:28 rillig Exp $	*/
+/*	$NetBSD: inetd.c,v 1.135 2021/09/03 20:41:19 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.134 2021/09/03 20:24:28 rillig Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.135 2021/09/03 20:41:19 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -1600,24 +1600,16 @@ freeconfig(struct servtab *cp)
 {
 	int i;
 
-	if (cp->se_hostaddr)
-		free(cp->se_hostaddr);
-	if (cp->se_service)
-		free(cp->se_service);
-	if (cp->se_proto)
-		free(cp->se_proto);
-	if (cp->se_user)
-		free(cp->se_user);
-	if(cp->se_group)
-		free(cp->se_group);
-	if (cp->se_server)
-		free(cp->se_server);
+	free(cp->se_hostaddr);
+	free(cp->se_service);
+	free(cp->se_proto);
+	free(cp->se_user);
+	free(cp->se_group);
+	free(cp->se_server);
 	for (i = 0; i < MAXARGV; i++)
-		if (cp->se_argv[i])
-			free(cp->se_argv[i]);
+		free(cp->se_argv[i]);
 #ifdef IPSEC
-	if (cp->se_policy)
-		free(cp->se_policy);
+	free(cp->se_policy);
 #endif
 }
 
@@ -2505,7 +2497,7 @@ include_configs(char *pattern)
 	/* Put new_file at the top of the config stack */
 	file_list_head = _file;
 	read_glob_configs(pattern);
-	free((void *)new_file.abs);
+	free(new_file.abs);
 	/* Pop new_file off the stack */
 	file_list_head = new_file.next;
 



CVS commit: src/usr.sbin/inetd

2021-09-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep  3 20:41:19 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
inetd: remove redundant null check before free

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2021-09-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep  3 20:24:28 UTC 2021

Modified Files:
src/usr.sbin/inetd: Makefile inetd.c inetd.h ipsec.c parse_v2.c

Log Message:
inetd: prepare for lint's strict bool mode

Lint's strict bool mode considers bool incompatible with the other
scalar types.  This makes the type of expressions more visible in the
code.  In particular, conditions of the form '!strcmp(...)' are no
longer allowed, they have to be written as 'strcmp(...) == 0'.

The operator '!' cannot be used with sep->se_wait since that has type
pid_t, not bool.

No change to the resulting binary.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/inetd/Makefile
cvs rdiff -u -r1.133 -r1.134 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/inetd/inetd.h
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/inetd/ipsec.c
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/inetd/parse_v2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/Makefile
diff -u src/usr.sbin/inetd/Makefile:1.28 src/usr.sbin/inetd/Makefile:1.29
--- src/usr.sbin/inetd/Makefile:1.28	Mon Aug 30 18:21:11 2021
+++ src/usr.sbin/inetd/Makefile	Fri Sep  3 20:24:28 2021
@@ -1,5 +1,5 @@
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
-#	$NetBSD: Makefile,v 1.28 2021/08/30 18:21:11 rillig Exp $
+#	$NetBSD: Makefile,v 1.29 2021/09/03 20:24:28 rillig Exp $
 
 .include 
 
@@ -10,6 +10,7 @@ SRCS=	inetd.c parse_v2.c
 MAN=	inetd.8
 MLINKS=	inetd.8 inetd.conf.5
 WARNS=	6
+#LINTFLAGS+=	-T
 
 # Enables debug printouts when in debug mode
 CPPFLAGS+=-DDEBUG_ENABLE

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.133 src/usr.sbin/inetd/inetd.c:1.134
--- src/usr.sbin/inetd/inetd.c:1.133	Fri Sep  3 19:33:51 2021
+++ src/usr.sbin/inetd/inetd.c	Fri Sep  3 20:24:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.133 2021/09/03 19:33:51 rillig Exp $	*/
+/*	$NetBSD: inetd.c,v 1.134 2021/09/03 20:24:28 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.133 2021/09/03 19:33:51 rillig Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.134 2021/09/03 20:24:28 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -337,28 +337,28 @@ struct biltin {
 	/* function which performs it */
 } biltins[] = {
 	/* Echo received data */
-	{ "echo",	SOCK_STREAM,	1, 0,	echo_stream },
-	{ "echo",	SOCK_DGRAM,	0, 0,	echo_dg },
+	{ "echo",	SOCK_STREAM,	true, false,	echo_stream },
+	{ "echo",	SOCK_DGRAM,	false, false,	echo_dg },
 
 	/* Internet /dev/null */
-	{ "discard",	SOCK_STREAM,	1, 0,	discard_stream },
-	{ "discard",	SOCK_DGRAM,	0, 0,	discard_dg },
+	{ "discard",	SOCK_STREAM,	true, false,	discard_stream },
+	{ "discard",	SOCK_DGRAM,	false, false,	discard_dg },
 
 	/* Return 32 bit time since 1970 */
-	{ "time",	SOCK_STREAM,	0, 0,	machtime_stream },
-	{ "time",	SOCK_DGRAM,	0, 0,	machtime_dg },
+	{ "time",	SOCK_STREAM,	false, false,	machtime_stream },
+	{ "time",	SOCK_DGRAM,	false, false,	machtime_dg },
 
 	/* Return human-readable time */
-	{ "daytime",	SOCK_STREAM,	0, 0,	daytime_stream },
-	{ "daytime",	SOCK_DGRAM,	0, 0,	daytime_dg },
+	{ "daytime",	SOCK_STREAM,	false, false,	daytime_stream },
+	{ "daytime",	SOCK_DGRAM,	false, false,	daytime_dg },
 
 	/* Familiar character generator */
-	{ "chargen",	SOCK_STREAM,	1, 0,	chargen_stream },
-	{ "chargen",	SOCK_DGRAM,	0, 0,	chargen_dg },
+	{ "chargen",	SOCK_STREAM,	true, false,	chargen_stream },
+	{ "chargen",	SOCK_DGRAM,	false, false,	chargen_dg },
 
-	{ "tcpmux",	SOCK_STREAM,	1, 0,	tcpmux },
+	{ "tcpmux",	SOCK_STREAM,	true, false,	tcpmux },
 
-	{ NULL, 0, 0, 0, NULL }
+	{ NULL, 0, false, false, NULL }
 };
 
 /* list of "bad" ports. I.e. ports that are most obviously used for
@@ -389,12 +389,12 @@ main(int argc, char *argv[])
 	   )) != -1)
 		switch(ch) {
 		case 'd':
-			debug = 1;
+			debug = true;
 			options |= SO_DEBUG;
 			break;
 #ifdef LIBWRAP
 		case 'l':
-			lflag = 1;
+			lflag = true;
 			break;
 #endif
 		case '?':
@@ -448,7 +448,7 @@ main(int argc, char *argv[])
 		struct servtab	*sep;
 
 		if (reload) {
-			reload = 0;
+			reload = false;
 			config_root();
 		}
 
@@ -469,7 +469,7 @@ main(int argc, char *argv[])
 	goaway();
 	break;
 case SIGHUP:
-	reload = 1;
+	reload = true;
 	break;
 }
 continue;
@@ -481,7 +481,7 @@ main(int argc, char *argv[])
 			if ((int)ev->ident != sep->se_fd)
 continue;
 			DPRINTF(SERV_FMT ": service requested" , SERV_PARAMS(sep));
-			if (!sep->se_wait && sep->se_socktype == SOCK_STREAM) {
+			if (sep->se_wait == 0 && sep->se_socktype == SOCK_STREAM) {
 /* XXX here do the libwrap check-before-accept*/
 ctrl = accept(sep->se_fd, NULL, NULL);
 DPRINTF(SERV_FMT ": accept, ctrl fd %d",
@@ -508,9 +508,9 @@ 

CVS commit: src/usr.sbin/inetd

2021-09-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep  3 20:24:28 UTC 2021

Modified Files:
src/usr.sbin/inetd: Makefile inetd.c inetd.h ipsec.c parse_v2.c

Log Message:
inetd: prepare for lint's strict bool mode

Lint's strict bool mode considers bool incompatible with the other
scalar types.  This makes the type of expressions more visible in the
code.  In particular, conditions of the form '!strcmp(...)' are no
longer allowed, they have to be written as 'strcmp(...) == 0'.

The operator '!' cannot be used with sep->se_wait since that has type
pid_t, not bool.

No change to the resulting binary.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/inetd/Makefile
cvs rdiff -u -r1.133 -r1.134 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/inetd/inetd.h
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/inetd/ipsec.c
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/inetd/parse_v2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2021-09-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep  3 19:33:51 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
inetd: normalize indentation and alignment in comments


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.132 src/usr.sbin/inetd/inetd.c:1.133
--- src/usr.sbin/inetd/inetd.c:1.132	Tue Aug 31 19:34:42 2021
+++ src/usr.sbin/inetd/inetd.c	Fri Sep  3 19:33:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.132 2021/08/31 19:34:42 rillig Exp $	*/
+/*	$NetBSD: inetd.c,v 1.133 2021/09/03 19:33:51 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.132 2021/08/31 19:34:42 rillig Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.133 2021/09/03 19:33:51 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -104,7 +104,7 @@ __RCSID("$NetBSD: inetd.c,v 1.132 2021/0
  *	server program arguments	maximum of MAXARGV (64)
  *
  * For RPC services
- *  service name/versionmust be in /etc/rpc
+ *	service name/version		must be in /etc/rpc
  *	socket type			stream/dgram/raw/rdm/seqpacket
  *	protocol			must be in /etc/protocols
  *	wait/nowait[:max]		single-threaded/multi-threaded
@@ -2715,11 +2715,11 @@ rl_process(struct servtab *sep, int ctrl
 			rl_reset(sep, now);
 		} else {
 			syslog(LOG_ERR,
-SERV_FMT ": max spawn rate (%zu in %ji seconds) "
-"already met, closing until end of timeout in "
+			SERV_FMT ": max spawn rate (%zu in %ji seconds) "
+			"already met, closing until end of timeout in "
 			"%ju seconds",
-SERV_PARAMS(sep),
-sep->se_service_max,
+			SERV_PARAMS(sep),
+			sep->se_service_max,
 			(intmax_t)CNT_INTVL,
 			(uintmax_t)RETRYTIME);
 



CVS commit: src/usr.sbin/inetd

2021-09-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Sep  3 19:33:51 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
inetd: normalize indentation and alignment in comments


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/usr.sbin/inetd

2021-08-31 Thread Roland Illig
Am 31.08.2021 um 18:29 schrieb Tobias Nygren:
> -   SWAP(int, cp->se_type, sep->se_type);
> +   SWAP(enum service_type, cp->se_type, sep->se_type);

Thanks for the note, I just fixed it.

I left out the 'enum' since there is a typedef for it.

Roland


CVS commit: src/usr.sbin/inetd

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 19:34:42 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
inetd: fix Clang build

error: implicit conversion changes signedness: 'service_type' to 'int'


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.131 src/usr.sbin/inetd/inetd.c:1.132
--- src/usr.sbin/inetd/inetd.c:1.131	Mon Aug 30 18:21:11 2021
+++ src/usr.sbin/inetd/inetd.c	Tue Aug 31 19:34:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.131 2021/08/30 18:21:11 rillig Exp $	*/
+/*	$NetBSD: inetd.c,v 1.132 2021/08/31 19:34:42 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.131 2021/08/30 18:21:11 rillig Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.132 2021/08/31 19:34:42 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -760,7 +760,7 @@ config(void)
 #ifdef IPSEC
 			SWAP(char *, sep->se_policy, cp->se_policy);
 #endif
-			SWAP(int, cp->se_type, sep->se_type);
+			SWAP(service_type, cp->se_type, sep->se_type);
 			SWAP(size_t, cp->se_service_max, sep->se_service_max);
 			SWAP(size_t, cp->se_ip_max, sep->se_ip_max);
 #undef SWAP



CVS commit: src/usr.sbin/inetd

2021-08-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug 31 19:34:42 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
inetd: fix Clang build

error: implicit conversion changes signedness: 'service_type' to 'int'


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/usr.sbin/inetd

2021-08-31 Thread Tobias Nygren
On Mon, 30 Aug 2021 18:21:11 +
Roland Illig  wrote:

> Module Name:  src
> Committed By: rillig
> Date: Mon Aug 30 18:21:11 UTC 2021
> 
> Modified Files:
>   src/usr.sbin/inetd: Makefile inetd.c parse_v2.c
> 
> Log Message:
> inetd: raise WARNS from 5 to 6

clang complains:

/work/src/usr.sbin/inetd/inetd.c:763:18: error: implicit conversion changes 
signedness: 'service_type' (aka 'enum service_type') to 'int' 
[-Werror,-Wsign-conversion]
SWAP(int, cp->se_type, sep->se_type);
~~^~

Works for me:

--- inetd.c 30 Aug 2021 18:21:11 -  1.131
+++ inetd.c 31 Aug 2021 16:26:45 -
@@ -760,7 +760,7 @@ config(void)
 #ifdef IPSEC
SWAP(char *, sep->se_policy, cp->se_policy);
 #endif
-   SWAP(int, cp->se_type, sep->se_type);
+   SWAP(enum service_type, cp->se_type, sep->se_type);
SWAP(size_t, cp->se_service_max, sep->se_service_max);
SWAP(size_t, cp->se_ip_max, sep->se_ip_max);


CVS commit: src/usr.sbin/inetd

2021-08-31 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Aug 31 11:16:00 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
Use Dq.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.63 src/usr.sbin/inetd/inetd.8:1.64
--- src/usr.sbin/inetd/inetd.8:1.63	Mon Aug 30 16:10:34 2021
+++ src/usr.sbin/inetd/inetd.8	Tue Aug 31 11:16:00 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.63 2021/08/30 16:10:34 wiz Exp $
+.\"	$NetBSD: inetd.8,v 1.64 2021/08/31 11:16:00 wiz Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -545,8 +545,9 @@ By convention, the first argument should
 .It Sy ipsec
 An IPsec policy string.
 Defaults to the global default setting.
-If specified without a value (i.e. "ipsec=,"), IPsec will be disabled
-for this service.
+If specified without a value (i.e.,
+.Dq ipsec=, ) ,
+IPsec will be disabled for this service.
 See the
 .Sx Directives
 section for details.



CVS commit: src/usr.sbin/inetd

2021-08-31 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Aug 31 11:16:00 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
Use Dq.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2021-08-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Aug 30 18:21:11 UTC 2021

Modified Files:
src/usr.sbin/inetd: Makefile inetd.c parse_v2.c

Log Message:
inetd: raise WARNS from 5 to 6

The necessary fixes include:
* explicit integer conversions, to get rid of mixed signedness
* function prototypes for parameterless functions

While here:
* add space after comma
* add space after 'if'
* place the '{' of a function definition on a separate line
* rename variables 'bits' and 'temp' to 'hi' and 'lo'
* in parse_quote, prefer expressions over assignments
* make hex_to_bits static

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/inetd/Makefile
cvs rdiff -u -r1.130 -r1.131 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/inetd/parse_v2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/Makefile
diff -u src/usr.sbin/inetd/Makefile:1.27 src/usr.sbin/inetd/Makefile:1.28
--- src/usr.sbin/inetd/Makefile:1.27	Sun Aug 29 11:43:48 2021
+++ src/usr.sbin/inetd/Makefile	Mon Aug 30 18:21:11 2021
@@ -1,5 +1,5 @@
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
-#	$NetBSD: Makefile,v 1.27 2021/08/29 11:43:48 christos Exp $
+#	$NetBSD: Makefile,v 1.28 2021/08/30 18:21:11 rillig Exp $
 
 .include 
 
@@ -9,6 +9,7 @@ PROG=	inetd
 SRCS=	inetd.c parse_v2.c
 MAN=	inetd.8
 MLINKS=	inetd.8 inetd.conf.5
+WARNS=	6
 
 # Enables debug printouts when in debug mode
 CPPFLAGS+=-DDEBUG_ENABLE

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.130 src/usr.sbin/inetd/inetd.c:1.131
--- src/usr.sbin/inetd/inetd.c:1.130	Mon Aug 30 17:32:23 2021
+++ src/usr.sbin/inetd/inetd.c	Mon Aug 30 18:21:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.130 2021/08/30 17:32:23 rillig Exp $	*/
+/*	$NetBSD: inetd.c,v 1.131 2021/08/30 18:21:11 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.130 2021/08/30 17:32:23 rillig Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.131 2021/08/30 18:21:11 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -801,7 +801,7 @@ config(void)
 			strlcpy(sep->se_ctrladdr_un.sun_path,
 			sep->se_service, n + 1);
 			sep->se_ctrladdr_un.sun_family = AF_LOCAL;
-			sep->se_ctrladdr_size = (int)(n +
+			sep->se_ctrladdr_size = (socklen_t)(n +
 			sizeof(sep->se_ctrladdr_un) -
 			sizeof(sep->se_ctrladdr_un.sun_path));
 			if (!ISMUX(sep))
@@ -1825,12 +1825,12 @@ initring(void)
 
 	for (i = 0; i <= 128; ++i)
 		if (isprint(i))
-			*endring++ = i;
+			*endring++ = (char)i;
 }
 
 /* ARGSUSED */
 static void
-chargen_stream(int s,struct servtab *sep)	/* Character generator */
+chargen_stream(int s, struct servtab *sep)	/* Character generator */
 {
 	size_t len;
 	char *rs, text[LINESIZ+2];
@@ -1845,7 +1845,7 @@ chargen_stream(int s,struct servtab *sep
 	text[LINESIZ] = '\r';
 	text[LINESIZ + 1] = '\n';
 	for (rs = ring;;) {
-		if ((len = endring - rs) >= LINESIZ)
+		if ((len = (size_t)(endring - rs)) >= LINESIZ)
 			memmove(text, rs, LINESIZ);
 		else {
 			memmove(text, rs, len);
@@ -1882,7 +1882,7 @@ chargen_dg(int s, struct servtab *sep)		
 	if (!port_good_dg(sa))
 		return;
 
-	if ((len = endring - rs) >= LINESIZ)
+	if ((len = (size_t)(endring - rs)) >= LINESIZ)
 		memmove(text, rs, LINESIZ);
 	else {
 		memmove(text, rs, len);
@@ -1958,7 +1958,7 @@ daytime_stream(int s,struct servtab *sep
 	clk = time((time_t *) 0);
 
 	len = snprintf(buffer, sizeof buffer, "%.24s\r\n", ctime());
-	(void) write(s, buffer, len);
+	(void) write(s, buffer, (size_t)len);
 }
 
 /* ARGSUSED */
@@ -1982,7 +1982,7 @@ daytime_dg(int s, struct servtab *sep)
 	if (!port_good_dg(sa))
 		return;
 	len = snprintf(buffer, sizeof buffer, "%.24s\r\n", ctime());
-	(void) sendto(s, buffer, len, 0, sa, size);
+	(void) sendto(s, buffer, (size_t)len, 0, sa, size);
 }
 
 #ifdef DEBUG_ENABLE
@@ -2052,7 +2052,7 @@ get_line(int fd,	char *buf, int len)
 	ssize_t n;
 
 	do {
-		n = read(fd, buf, len-count);
+		n = read(fd, buf, (size_t)(len - count));
 		if (n == 0)
 			return (count);
 		if (n < 0)
@@ -2240,7 +2240,7 @@ allocchange(void)
 }
 
 static void
-config_root()
+config_root(void)
 {
 	struct servtab *sep;
 	/* Uncheck services */
@@ -2438,7 +2438,8 @@ parse_accept_filter(char *arg, struct se
 }
 
 void
-parse_socktype(char* arg, struct servtab* sep) {
+parse_socktype(char* arg, struct servtab* sep)
+{
 	/* stream socket may have an accept filter, only check first chars */
 	if (strncmp(arg, "stream", sizeof("stream") - 1) == 0)
 		sep->se_socktype = SOCK_STREAM;
@@ -2455,7 +2456,8 @@ parse_socktype(char* arg, struct servtab
 }
 
 static struct servtab
-init_servtab() {
+init_servtab(void)
+{
 	/* This does not set every field to default. See enter() as well */
 	

CVS commit: src/usr.sbin/inetd

2021-08-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Aug 30 18:21:11 UTC 2021

Modified Files:
src/usr.sbin/inetd: Makefile inetd.c parse_v2.c

Log Message:
inetd: raise WARNS from 5 to 6

The necessary fixes include:
* explicit integer conversions, to get rid of mixed signedness
* function prototypes for parameterless functions

While here:
* add space after comma
* add space after 'if'
* place the '{' of a function definition on a separate line
* rename variables 'bits' and 'temp' to 'hi' and 'lo'
* in parse_quote, prefer expressions over assignments
* make hex_to_bits static

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/inetd/Makefile
cvs rdiff -u -r1.130 -r1.131 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/inetd/parse_v2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2021-08-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Aug 30 17:32:23 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c inetd.h ipsec.c ipsec.h parse_v2.c

Log Message:
inetd: remove trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/inetd/inetd.h
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/inetd/ipsec.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/inetd/ipsec.h \
src/usr.sbin/inetd/parse_v2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.129 src/usr.sbin/inetd/inetd.c:1.130
--- src/usr.sbin/inetd/inetd.c:1.129	Mon Aug 30 08:21:12 2021
+++ src/usr.sbin/inetd/inetd.c	Mon Aug 30 17:32:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.129 2021/08/30 08:21:12 mlelstv Exp $	*/
+/*	$NetBSD: inetd.c,v 1.130 2021/08/30 17:32:23 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.129 2021/08/30 08:21:12 mlelstv Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.130 2021/08/30 17:32:23 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -484,7 +484,7 @@ main(int argc, char *argv[])
 			if (!sep->se_wait && sep->se_socktype == SOCK_STREAM) {
 /* XXX here do the libwrap check-before-accept*/
 ctrl = accept(sep->se_fd, NULL, NULL);
-DPRINTF(SERV_FMT ": accept, ctrl fd %d", 
+DPRINTF(SERV_FMT ": accept, ctrl fd %d",
 SERV_PARAMS(sep), ctrl);
 if (ctrl < 0) {
 	if (errno != EINTR)
@@ -644,7 +644,7 @@ run_service(int ctrl, struct servtab *se
 		} else if (sep->se_group) {
 			(void) setgid((gid_t)grp->gr_gid);
 		}
-		DPRINTF("%d execl %s", 
+		DPRINTF("%d execl %s",
 		getpid(), sep->se_server);
 		/* Set our control descriptor to not close-on-exec... */
 		if (fcntl(ctrl, F_SETFD, 0) < 0)
@@ -705,21 +705,21 @@ reapchild(void)
 
 size_t	line_number;
 
-/* 
+/*
  * Recursively merge loaded service definitions with any defined
- * in the current or included config files. 
+ * in the current or included config files.
  */
 static void
 config(void)
 {
 	struct servtab *sep, *cp;
 	/*
-	 * Current position in line, used with key-values notation, 
-	 * saves cp across getconfigent calls. 
+	 * Current position in line, used with key-values notation,
+	 * saves cp across getconfigent calls.
 	 */
 	char *current_pos;
 	size_t n;
-	
+
 	/* open config file from beginning */
 	fconfig = fopen(CONFIG, "r");
 	if(fconfig == NULL) {
@@ -729,7 +729,7 @@ config(void)
 
 	/* First call to nextline will advance line_number to 1 */
 	line_number = 0;
-	
+
 	/* Start parsing at the beginning of the first line */
 	current_pos = nextline(fconfig);
 
@@ -782,9 +782,9 @@ config(void)
 		}
 		sep->se_checked = 1;
 
-		/* 
+		/*
 		 * Remainder of config(void) checks validity of servtab options
-		 * and sets up the service by setting up sockets (in setup(servtab)). 
+		 * and sets up the service by setting up sockets (in setup(servtab)).
 		 */
 		switch (sep->se_family) {
 		case AF_LOCAL:
@@ -842,7 +842,7 @@ config(void)
 			if (isrpcservice(sep) || ISMUX(sep))
 port = "0";
 			else
-port = sep->se_service;		
+port = sep->se_service;
 			error = getaddrinfo(host, port, , );
 			if (error) {
 if (error == EAI_SERVICE) {
@@ -886,7 +886,7 @@ config(void)
 	rp = getrpcbyname(sep->se_service);
 	if (rp == 0) {
 		syslog(LOG_ERR,
-		SERV_FMT 
+		SERV_FMT
 		": unknown service",
 		SERV_PARAMS(sep));
 		sep->se_checked = 0;
@@ -943,7 +943,7 @@ goaway(void)
 	for (sep = servtab; sep != NULL; sep = sep->se_next) {
 		if (sep->se_fd == -1)
 			continue;
-		
+
 		switch (sep->se_family) {
 		case AF_LOCAL:
 			(void)unlink(sep->se_service);
@@ -972,7 +972,7 @@ setup(struct servtab *sep)
 	struct kevent	*ev;
 
 	if ((sep->se_fd = socket(sep->se_family, sep->se_socktype, 0)) < 0) {
-		DPRINTF("socket failed on " SERV_FMT ": %s", 
+		DPRINTF("socket failed on " SERV_FMT ": %s",
 		SERV_PARAMS(sep), strerror(errno));
 		syslog(LOG_ERR, "%s/%s: socket: %m",
 		sep->se_service, sep->se_proto);
@@ -1067,7 +1067,7 @@ setsockopt(fd, SOL_SOCKET, opt, , (so
  */
 static void
 close_sep(struct servtab *sep)
-{	
+{
 
 	if (sep->se_fd >= 0) {
 		(void) close(sep->se_fd);
@@ -1201,25 +1201,25 @@ static struct servtab *
 getconfigent(char **current_pos)
 {
 	struct servtab *sep = 
-	int argc, val; 
+	int argc, val;
 	char *cp, *cp0, *arg, *buf0, *buf1, *sz0, *sz1;
 	static char TCPMUX_TOKEN[] = "tcpmux/";
 #define MUX_LEN		(sizeof(TCPMUX_TOKEN)-1)
 	char *hostdelim;
 
-	/* 
-	 * Pre-condition: current_pos points into line, 
+	/*
+	 * Pre-condition: current_pos points into line,
 	 * line contains config line. Continue 

CVS commit: src/usr.sbin/inetd

2021-08-30 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon Aug 30 17:32:23 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c inetd.h ipsec.c ipsec.h parse_v2.c

Log Message:
inetd: remove trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/usr.sbin/inetd/inetd.c
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/inetd/inetd.h
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/inetd/ipsec.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/inetd/ipsec.h \
src/usr.sbin/inetd/parse_v2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2021-08-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Aug 30 16:10:34 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
Wording and formatting improvements.
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.62 src/usr.sbin/inetd/inetd.8:1.63
--- src/usr.sbin/inetd/inetd.8:1.62	Sun Aug 29 09:54:18 2021
+++ src/usr.sbin/inetd/inetd.8	Mon Aug 30 16:10:34 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.62 2021/08/29 09:54:18 christos Exp $
+.\"	$NetBSD: inetd.8,v 1.63 2021/08/30 16:10:34 wiz Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -106,21 +106,23 @@ The path given for this configuration fi
 the
 .Fl d
 option is also given on the command line.
-
+.Pp
 Services can be specified using the legacy `positional' notation or the 
-`key-values' notation described in the sections "Positional Notation" and 
-"Key-Values Notation" below.
-
+`key-values' notation described in the sections
+.Sx Positional Notation
+and 
+.Sx Key-Values Notation
+below.
 .Ss Positional Notation
-
 There must be an entry for each field of the configuration
 file, with entries for each field separated by a tab or
 a space.
 Comments are denoted by a ``#'' at the beginning of a line (see subsection 
-"Key-Values Notation" for defining comments in key-values definitions).
+.Sx Key-Values Notation
+for defining comments in key-values definitions).
 There must be an entry for each field (except for one
-special case, described below). A positional definition is terminated by a 
-newline.
+special case, described below).
+A positional definition is terminated by a newline.
 The fields of the configuration file are as follows:
 .Pp
 .Bd -unfilled -offset indent -compact
@@ -133,18 +135,19 @@ server-program
 server program arguments
 .Ed
 .Pp
-The 
+The
 .Em listen-addr
-specifies the local address
+parameter specifies the local address
 .Nm
 should use when listening.
 The single character
 .Dq \&*
 means
 .Dv INADDR_ANY :
-all local addresses. The
+all local addresses.
+The
 .Em listen-addr
-may be a host name, which will be resolved once, when the service
+parameter may be a host name, which will be resolved once, when the service
 definition is read from the config file.
 .Pp
 Note that restricted listen addresses are meaningless and ignored for
@@ -157,10 +160,10 @@ services always listen on all interfaces
 .Pp
 The form of the
 .Em service-spec
-varies with the service type.
+parameter varies with the service type.
 For Internet services, the
 .Em service-spec
-can be either the name of a service from
+parameter can be either the name of a service from
 .Pa /etc/services
 or a decimal port number.
 For
@@ -175,7 +178,7 @@ For
 .Em Sun-RPC
 based services, the
 .Em service-spec
-has the form
+parameter has the form
 .Em service-name Ns Li / Ns Em version .
 The service name must be a valid RPC service name from
 the file
@@ -186,21 +189,22 @@ on the right of the
 .Dq /
 is the RPC version number.
 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 \- e.g.
+A range is bounded by the low version to the high version, e.g.
 .Dq rusers/1-3 .
 .Pp
 For UNIX-domain (local) services, the
 .Em service-spec
-is the path name to listen on.
+parameter is the path name to listen on.
 .Pp
 The
 .Em service-spec
-must not begin with a dot. See 
+parameter must not begin with a dot.
+See 
 .Sx Directives .
 .Pp
 The
 .Em socket-type
-should be one of
+parameter should be one of
 .Dq stream ,
 .Dq dgram ,
 .Dq raw ,
@@ -215,8 +219,7 @@ Optionally, for Internet services, an ac
 .Xr accept_filter 9 )
 can be specified by appending a colon to
 .Em socket-type ,
-followed by
-the name of the desired accept filter.
+followed by the name of the desired accept filter.
 In this case
 .Nm
 will not see new connections for the specified service until the accept
@@ -226,7 +229,7 @@ filter decides they are ready to be hand
 .Pp
 The
 .Em protocol
-must be a valid protocol as given in
+parameter must be a valid protocol as given in
 .Pa /etc/protocols
 or (for UNIX-domain services) the string
 .Dq unix .
@@ -389,15 +392,14 @@ word
 should take the place of this entry.
 It is possible to quote an argument using either single or double quotes.
 This allows you to have, e.g., spaces in paths and parameters.
-
 .Ss Key-Values Notation
-
 In key-values notation, keys are separated from their associated values by `=',
 values are separated by whitespace, and key-values options are separated by 
-commas. A service definition is terminated by a semicolon. Multiple definitions 
-may exist on a single line (and a line may end with a positional definition. 
+commas.

CVS commit: src/usr.sbin/inetd

2021-08-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Aug 30 16:10:34 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
Wording and formatting improvements.
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2021-08-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Aug 30 08:21:12 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
Fix reverted logic when parsing server program.
Compare pointer with NULL not 0.


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.128 src/usr.sbin/inetd/inetd.c:1.129
--- src/usr.sbin/inetd/inetd.c:1.128	Sun Aug 29 11:43:25 2021
+++ src/usr.sbin/inetd/inetd.c	Mon Aug 30 08:21:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.128 2021/08/29 11:43:25 christos Exp $	*/
+/*	$NetBSD: inetd.c,v 1.129 2021/08/30 08:21:12 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.128 2021/08/29 11:43:25 christos Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.129 2021/08/30 08:21:12 mlelstv Exp $");
 #endif
 #endif /* not lint */
 
@@ -2388,7 +2388,7 @@ parse_wait(struct servtab *sep, int wait
 int
 parse_server(struct servtab *sep, const char *arg){
 	sep->se_server = newstr(arg);
-	if (strcmp(sep->se_server, "internal") == 0) {
+	if (strcmp(sep->se_server, "internal") != 0) {
 		sep->se_bi = NULL;
 		return 0;
 	}
@@ -2398,7 +2398,7 @@ parse_server(struct servtab *sep, const 
 		if (bi->bi_socktype == sep->se_socktype &&
 		strcmp(bi->bi_service, sep->se_service) == 0)
 			break;
-	if (bi->bi_service == 0) {
+	if (bi->bi_service == NULL) {
 		ERR("Internal service %s unknown",
 		sep->se_service);
 		return -1;



CVS commit: src/usr.sbin/inetd

2021-08-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Aug 30 08:21:12 UTC 2021

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
Fix reverted logic when parsing server program.
Compare pointer with NULL not 0.


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2021-08-30 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Mon Aug 30 06:27:49 UTC 2021

Modified Files:
src/usr.sbin/inetd: parse_v2.c

Log Message:
Summary: char is unsigned on arm, so use int when -1 indicates error

hex_to_bits() returns -1 on error, so declare it int, and do the same
for the variables that hold intermediate values returned by it.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/inetd/parse_v2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/parse_v2.c
diff -u src/usr.sbin/inetd/parse_v2.c:1.1 src/usr.sbin/inetd/parse_v2.c:1.2
--- src/usr.sbin/inetd/parse_v2.c:1.1	Sun Aug 29 09:54:18 2021
+++ src/usr.sbin/inetd/parse_v2.c	Mon Aug 30 06:27:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse_v2.c,v 1.1 2021/08/29 09:54:18 christos Exp $	*/
+/*	$NetBSD: parse_v2.c,v 1.2 2021/08/30 06:27:49 tih Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: parse_v2.c,v 1.1 2021/08/29 09:54:18 christos Exp $");
+__RCSID("$NetBSD: parse_v2.c,v 1.2 2021/08/30 06:27:49 tih Exp $");
 
 #include 
 #include 
@@ -95,7 +95,7 @@ static int	size_to_bytes(char *);
 static bool infer_protocol_ip_version(struct servtab *);
 static bool	setup_internal(struct servtab *);
 static void	try_infer_socktype(struct servtab *);
-char hex_to_bits(char);
+int hex_to_bits(char);
 #ifdef IPSEC
 static void	setup_ipsec(struct servtab *);
 #endif
@@ -405,7 +405,7 @@ parse_quotes(char **cpp)
 			cp++;
 			switch (*cp) {
 			case 'x': {
-char temp, bits;
+int temp, bits;
 if (((bits = hex_to_bits(*(cp + 1))) == -1) 
 || ((temp = hex_to_bits(*(cp + 2))) == -1)) {
 	ERR("Invalid hexcode sequence '%.4s'", 
@@ -459,7 +459,7 @@ parse_quotes(char **cpp)
 	return true;
 }
 
-char
+int
 hex_to_bits(char in)
 {
 	switch(in) {



CVS commit: src/usr.sbin/inetd

2021-08-30 Thread Tom Ivar Helbekkmo
Module Name:src
Committed By:   tih
Date:   Mon Aug 30 06:27:49 UTC 2021

Modified Files:
src/usr.sbin/inetd: parse_v2.c

Log Message:
Summary: char is unsigned on arm, so use int when -1 indicates error

hex_to_bits() returns -1 on error, so declare it int, and do the same
for the variables that hold intermediate values returned by it.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/inetd/parse_v2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2021-08-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 29 11:43:48 UTC 2021

Modified Files:
src/usr.sbin/inetd: Makefile

Log Message:
remove -m32 accidentally committed


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/inetd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/Makefile
diff -u src/usr.sbin/inetd/Makefile:1.26 src/usr.sbin/inetd/Makefile:1.27
--- src/usr.sbin/inetd/Makefile:1.26	Sun Aug 29 07:43:25 2021
+++ src/usr.sbin/inetd/Makefile	Sun Aug 29 07:43:48 2021
@@ -1,10 +1,8 @@
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
-#	$NetBSD: Makefile,v 1.26 2021/08/29 11:43:25 christos Exp $
+#	$NetBSD: Makefile,v 1.27 2021/08/29 11:43:48 christos Exp $
 
 .include 
 
-COPTS+=-m32
-
 USE_FORT?= yes	# network server
 
 PROG=	inetd



CVS commit: src/usr.sbin/inetd

2021-08-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 29 11:43:48 UTC 2021

Modified Files:
src/usr.sbin/inetd: Makefile

Log Message:
remove -m32 accidentally committed


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/inetd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2021-08-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 29 11:43:25 UTC 2021

Modified Files:
src/usr.sbin/inetd: Makefile inetd.c

Log Message:
fix printf formats (intmax -> j)


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/inetd/Makefile
cvs rdiff -u -r1.127 -r1.128 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/Makefile
diff -u src/usr.sbin/inetd/Makefile:1.25 src/usr.sbin/inetd/Makefile:1.26
--- src/usr.sbin/inetd/Makefile:1.25	Sun Aug 29 05:54:18 2021
+++ src/usr.sbin/inetd/Makefile	Sun Aug 29 07:43:25 2021
@@ -1,8 +1,10 @@
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
-#	$NetBSD: Makefile,v 1.25 2021/08/29 09:54:18 christos Exp $
+#	$NetBSD: Makefile,v 1.26 2021/08/29 11:43:25 christos Exp $
 
 .include 
 
+COPTS+=-m32
+
 USE_FORT?= yes	# network server
 
 PROG=	inetd

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.127 src/usr.sbin/inetd/inetd.c:1.128
--- src/usr.sbin/inetd/inetd.c:1.127	Sun Aug 29 05:54:18 2021
+++ src/usr.sbin/inetd/inetd.c	Sun Aug 29 07:43:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.127 2021/08/29 09:54:18 christos Exp $	*/
+/*	$NetBSD: inetd.c,v 1.128 2021/08/29 11:43:25 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.127 2021/08/29 09:54:18 christos Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.128 2021/08/29 11:43:25 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -2713,9 +2713,9 @@ rl_process(struct servtab *sep, int ctrl
 			rl_reset(sep, now);
 		} else {
 			syslog(LOG_ERR,
-SERV_FMT ": max spawn rate (%zu in %zi seconds) "
+SERV_FMT ": max spawn rate (%zu in %ji seconds) "
 "already met, closing until end of timeout in "
-			"%zu seconds",
+			"%ju seconds",
 SERV_PARAMS(sep),
 sep->se_service_max,
 			(intmax_t)CNT_INTVL,
@@ -2770,7 +2770,7 @@ rl_process(struct servtab *sep, int ctrl
 	 */
 	syslog(LOG_ERR, SERV_FMT
 	": max ip spawn rate (%zu in " 
-	"%zi seconds) for "
+	"%ji seconds) for "
 	"%." TOSTRING(NI_MAXHOST) "s "
 	"already met; service not started",
 	SERV_PARAMS(sep),
@@ -2941,7 +2941,7 @@ rl_add(struct servtab *sep, char* ip)
 static void
 rl_reset(struct servtab *sep, time_t now)
 {
-	DPRINTF(SERV_FMT ": %zi seconds passed; resetting rate limiting ", 
+	DPRINTF(SERV_FMT ": %ji seconds passed; resetting rate limiting ", 
 	SERV_PARAMS(sep), (intmax_t)(now - sep->se_time));
 
 	sep->se_count = 0;



CVS commit: src/usr.sbin/inetd

2021-08-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 29 11:43:25 UTC 2021

Modified Files:
src/usr.sbin/inetd: Makefile inetd.c

Log Message:
fix printf formats (intmax -> j)


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/inetd/Makefile
cvs rdiff -u -r1.127 -r1.128 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2019-02-03 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Feb  3 12:02:22 UTC 2019

Modified Files:
src/usr.sbin/inetd: ipsec.c

Log Message:
- don't compare pointer with \0.  in this case, *pointer is wanted,
  not \0 -> NULL, as we just tested pointer, and this is wanting to
  be the standard "is this string NULL or nul?" idiom.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/inetd/ipsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/ipsec.c
diff -u src/usr.sbin/inetd/ipsec.c:1.4 src/usr.sbin/inetd/ipsec.c:1.5
--- src/usr.sbin/inetd/ipsec.c:1.4	Wed Jan  4 16:09:43 2012
+++ src/usr.sbin/inetd/ipsec.c	Sun Feb  3 12:02:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.4 2012/01/04 16:09:43 drochner Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.5 2019/02/03 12:02:22 mrg Exp $	*/
 
 /*
  * Copyright (C) 1999 WIDE Project.
@@ -58,7 +58,7 @@ ipsecsetup(int af, int fd, const char *p
 	char *p0, *p;
 	int error;
 
-	if (!policy || policy == '\0')
+	if (!policy || *policy == '\0')
 		p0 = p = strdup("in entrust; out entrust");
 	else
 		p0 = p = strdup(policy);



CVS commit: src/usr.sbin/inetd

2019-02-03 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Feb  3 12:02:22 UTC 2019

Modified Files:
src/usr.sbin/inetd: ipsec.c

Log Message:
- don't compare pointer with \0.  in this case, *pointer is wanted,
  not \0 -> NULL, as we just tested pointer, and this is wanting to
  be the standard "is this string NULL or nul?" idiom.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/inetd/ipsec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2017-11-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 28 11:51:11 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
Bump MAXARGV from 20 to 64 - with bozohttpd and all config on the command
line it is easy to hit the (silent) limit.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.124 src/usr.sbin/inetd/inetd.c:1.125
--- src/usr.sbin/inetd/inetd.c:1.124	Tue Oct 17 07:13:19 2017
+++ src/usr.sbin/inetd/inetd.c	Tue Nov 28 11:51:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.124 2017/10/17 07:13:19 ozaki-r Exp $	*/
+/*	$NetBSD: inetd.c,v 1.125 2017/11/28 11:51:11 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.124 2017/10/17 07:13:19 ozaki-r Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.125 2017/11/28 11:51:11 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -101,7 +101,7 @@ __RCSID("$NetBSD: inetd.c,v 1.124 2017/1
  *	wait/nowait[:max]		single-threaded/multi-threaded, max #
  *	user[:group]			user/group to run daemon as
  *	server program			full path name
- *	server program arguments	maximum of MAXARGS (20)
+ *	server program arguments	maximum of MAXARGV (64)
  *
  * For RPC services
  *  service name/versionmust be in /etc/rpc
@@ -110,7 +110,7 @@ __RCSID("$NetBSD: inetd.c,v 1.124 2017/1
  *	wait/nowait[:max]		single-threaded/multi-threaded
  *	user[:group]			user to run daemon as
  *	server program			full path name
- *	server program arguments	maximum of MAXARGS (20)
+ *	server program arguments	maximum of MAXARGV (64)
  *
  * For non-RPC services, the "service name" can be of the form
  * hostaddress:servicename, in which case the hostaddress is used
@@ -298,7 +298,7 @@ struct	servtab {
 	char	*se_group;		/* group name to run as */
 	struct	biltin *se_bi;		/* if built-in, description */
 	char	*se_server;		/* server program */
-#define	MAXARGV 20
+#define	MAXARGV 64
 	char	*se_argv[MAXARGV+1];	/* program arguments */
 #ifdef IPSEC
 	char	*se_policy;		/* IPsec poilcy string */



CVS commit: src/usr.sbin/inetd

2017-11-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 28 11:51:11 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
Bump MAXARGV from 20 to 64 - with bozohttpd and all config on the command
line it is easy to hit the (silent) limit.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/usr.sbin/inetd

2017-10-18 Thread Ryota Ozaki
On Tue, Oct 17, 2017 at 9:03 PM, Christos Zoulas  wrote:
> In article <20171017071319.a4380f...@cvs.netbsd.org>,
> Ryota Ozaki  wrote:
>>-=-=-=-=-=-
>>
>>Module Name:   src
>>Committed By:  ozaki-r
>>Date:  Tue Oct 17 07:13:19 UTC 2017
>>
>>Modified Files:
>>   src/usr.sbin/inetd: inetd.c
>>
>>Log Message:
>>Don't setup SPs if no policy sepecifier is specified
>>
>>We expect that SPs are set up iff some policy sepecifier(s) are specified.
>
> Why not just flip the order ?
>
> if (policy != NULL && ipsecfoo(...) < 0) {
> }

I just wanted to pull ipsecsetup out from the conditional statement.

  ozaki-r


Re: CVS commit: src/usr.sbin/inetd

2017-10-17 Thread Christos Zoulas
In article <20171017071319.a4380f...@cvs.netbsd.org>,
Ryota Ozaki  wrote:
>-=-=-=-=-=-
>
>Module Name:   src
>Committed By:  ozaki-r
>Date:  Tue Oct 17 07:13:19 UTC 2017
>
>Modified Files:
>   src/usr.sbin/inetd: inetd.c
>
>Log Message:
>Don't setup SPs if no policy sepecifier is specified
>
>We expect that SPs are set up iff some policy sepecifier(s) are specified.

Why not just flip the order ?

if (policy != NULL && ipsecfoo(...) < 0) {
}

christos



CVS commit: src/usr.sbin/inetd

2017-10-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Oct 17 07:13:19 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
Don't setup SPs if no policy sepecifier is specified

We expect that SPs are set up iff some policy sepecifier(s) are specified.

Found on investigating an issue reported by Robert Swindells


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.123 src/usr.sbin/inetd/inetd.c:1.124
--- src/usr.sbin/inetd/inetd.c:1.123	Wed Feb 15 02:48:31 2017
+++ src/usr.sbin/inetd/inetd.c	Tue Oct 17 07:13:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.123 2017/02/15 02:48:31 elric Exp $	*/
+/*	$NetBSD: inetd.c,v 1.124 2017/10/17 07:13:19 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.123 2017/02/15 02:48:31 elric Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.124 2017/10/17 07:13:19 ozaki-r Exp $");
 #endif
 #endif /* not lint */
 
@@ -1088,13 +1088,16 @@ setsockopt(fd, SOL_SOCKET, opt, , (so
 	}
 #endif
 #ifdef IPSEC
-	if (ipsecsetup(sep->se_family, sep->se_fd, sep->se_policy) < 0 &&
-	sep->se_policy) {
-		syslog(LOG_ERR, "%s/%s: ipsec setup failed",
-		sep->se_service, sep->se_proto);
-		(void)close(sep->se_fd);
-		sep->se_fd = -1;
-		return;
+	/* Avoid setting a policy if a policy specifier doesn't exist. */
+	if (sep->se_policy != NULL) {
+		int e = ipsecsetup(sep->se_family, sep->se_fd, sep->se_policy);
+		if (e < 0) {
+			syslog(LOG_ERR, "%s/%s: ipsec setup failed",
+			sep->se_service, sep->se_proto);
+			(void)close(sep->se_fd);
+			sep->se_fd = -1;
+			return;
+		}
 	}
 #endif
 



CVS commit: src/usr.sbin/inetd

2017-10-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Oct 17 07:13:19 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
Don't setup SPs if no policy sepecifier is specified

We expect that SPs are set up iff some policy sepecifier(s) are specified.

Found on investigating an issue reported by Robert Swindells


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2017-07-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Jul 20 07:42:54 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
Simplify.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2017-07-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Jul 20 07:42:54 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
Simplify.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.60 src/usr.sbin/inetd/inetd.8:1.61
--- src/usr.sbin/inetd/inetd.8:1.60	Wed Jul 19 16:37:17 2017
+++ src/usr.sbin/inetd/inetd.8	Thu Jul 20 07:42:54 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.60 2017/07/19 16:37:17 dholland Exp $
+.\"	$NetBSD: inetd.8,v 1.61 2017/07/20 07:42:54 wiz Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -141,8 +141,7 @@ containing just
 a
 .Em listen-addr
 followed by a colon.
-The default (compatible with historical configuration files) is \&*
-.Ns .
+The default (compatible with historical configuration files) is \&*.
 To return to this behavior after configuring some services with
 specific listen addresses, give \&* explicitly.
 .Pp



CVS commit: src/usr.sbin/inetd

2017-07-19 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Jul 19 16:37:17 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
Rework previous (and the text it modified) for clarity.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.59 src/usr.sbin/inetd/inetd.8:1.60
--- src/usr.sbin/inetd/inetd.8:1.59	Sun Jul 16 21:19:38 2017
+++ src/usr.sbin/inetd/inetd.8	Wed Jul 19 16:37:17 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.59 2017/07/16 21:19:38 wiz Exp $
+.\"	$NetBSD: inetd.8,v 1.60 2017/07/19 16:37:17 dholland Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -57,7 +57,7 @@
 .\"
 .\" from: @(#)inetd.8   8.4 (Berkeley) 6/1/94
 .\"
-.Dd July 16, 2017
+.Dd July 19, 2017
 .Dt INETD 8
 .Os
 .Sh NAME
@@ -115,8 +115,8 @@ special case, described below).
 The fields of the configuration file are as follows:
 .Pp
 .Bd -unfilled -offset indent -compact
-[addr:]service-name/port-number
-socket-type[:accept_filter]
+[listen-addr:]service-spec
+socket-type[:accept-filter]
 protocol[,sndbuf=size][,rcvbuf=size]
 wait/nowait[:max]
 user[:group]
@@ -124,82 +124,74 @@ server-program
 server program arguments
 .Ed
 .Pp
-To specify an
-.Em Sun-RPC
-based service, the entry would contain these fields:
-.Pp
-.Bd -unfilled -offset indent -compact
-service-name/version
-socket-type
-rpc/protocol[,sndbuf=size][,rcvbuf=size]
-wait/nowait[:max]
-user[:group]
-server-program
-server program arguments
-.Ed
-.Pp
-To specify a UNIX-domain (local) socket, the entry would contain
-these fields:
-.Pp
-.Bd -unfilled -offset indent -compact
-path
-socket-type
-unix[,sndbuf=size][,rcvbuf=size]
-wait/nowait[:max]
-user[:group]
-server-program
-server program arguments
-.Ed
-.Pp
-For Internet services, the first field of the line may also have a host
-address specifier prefixed to it, separated from the service name or port
-number by a colon.
-If this is done, the string before the colon in the
-first field indicates what local address
+The 
+.Em listen-addr
+specifies the local address
 .Nm
-should use when listening for that service, or the single character
+should use when listening.
+The single character
 .Dq \&*
-to indicate
-.Dv INADDR_ANY ,
-meaning
-.Sq all local addresses .
-To avoid repeating an address that occurs frequently, a line with a
-host address specifier and colon, but no further fields, causes the
-host address specifier to be remembered and used for all further lines
-with no explicit host specifier (until another such line or the end of
-the file).
-A line
-.Dl *:
-is implicitly provided at the top of the file; thus, traditional
-configuration files (which have no host address specifiers) will be
-interpreted in the traditional manner, with all services listened for
-on all local addresses.
+means
+.Dv INADDR_ANY :
+all local addresses.
+To avoid the need to repeat listen addresses over and over again,
+listen addresses are inherited from line to line, and the listen
+address can be changed without defining a service by including a line
+containing just
+a
+.Em listen-addr
+followed by a colon.
+The default (compatible with historical configuration files) is \&*
+.Ns .
+To return to this behavior after configuring some services with
+specific listen addresses, give \&* explicitly.
 .Pp
-The
-.Em service-name/port-number
-entry is the name of a valid service in
-the file
-.Pa /etc/services .
-Or an alternate port number.
+Note that restricted listen addresses are meaningless and ignored for
+UNIX-domain services, and are not supported for
+.Em Sun-RPC
+services.
+All 
+.Em Sun-RPC
+services always listen on all interfaces.
+.Pp
+The form of the
+.Em service-spec
+varies with the service type.
+For Internet services, the
+.Em service-spec
+can be either the name of a service from
+.Pa /etc/services
+or a decimal port number.
 For
 .Dq internal
-services (discussed below), the service
-name
+services (discussed below), the service name
 .Em must
 be the official name of the service (that is, the first entry in
-.Pa /etc/services ) .
-When used to specify a
+.Pa /etc/services )
+and not an alias for it.
+.Pp
+For
 .Em Sun-RPC
-based service, this field is a valid RPC service name in
+based services, the
+.Em service-spec
+has the form
+.Em service-name Ns Li / Ns Em version .
+The service name must be a valid RPC service name from
 the file
 .Pa /etc/rpc .
-The part on the right of the
+The
+.Em version
+on the right of the
 .Dq /
 is the RPC version number.
 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 \-
+A range is bounded by the low version to the high version \- e.g.
 .Dq rusers/1-3 .
 .Pp
+For UNIX-domain (local) 

CVS commit: src/usr.sbin/inetd

2017-07-19 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Wed Jul 19 16:37:17 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
Rework previous (and the text it modified) for clarity.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2017-07-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Jul 16 21:19:38 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2017-07-16 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Jul 16 21:19:38 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.58 src/usr.sbin/inetd/inetd.8:1.59
--- src/usr.sbin/inetd/inetd.8:1.58	Sun Jul 16 21:05:19 2017
+++ src/usr.sbin/inetd/inetd.8	Sun Jul 16 21:19:38 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.58 2017/07/16 21:05:19 christos Exp $
+.\"	$NetBSD: inetd.8,v 1.59 2017/07/16 21:19:38 wiz Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -153,7 +153,8 @@ server program arguments
 .Pp
 For Internet services, the first field of the line may also have a host
 address specifier prefixed to it, separated from the service name or port
-number by a colon. If this is done, the string before the colon in the
+number by a colon.
+If this is done, the string before the colon in the
 first field indicates what local address
 .Nm
 should use when listening for that service, or the single character
@@ -179,7 +180,8 @@ The
 entry is the name of a valid service in
 the file
 .Pa /etc/services .
-Or an alternate port number. For
+Or an alternate port number.
+For
 .Dq internal
 services (discussed below), the service
 name



CVS commit: src/usr.sbin/inetd

2017-07-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 16 21:05:19 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
PR/52412: Edgar Pettijohn: Describe the service/port syntax.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.57 src/usr.sbin/inetd/inetd.8:1.58
--- src/usr.sbin/inetd/inetd.8:1.57	Mon Apr 25 18:12:05 2011
+++ src/usr.sbin/inetd/inetd.8	Sun Jul 16 17:05:19 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: inetd.8,v 1.57 2011/04/25 22:12:05 wiz Exp $
+.\"	$NetBSD: inetd.8,v 1.58 2017/07/16 21:05:19 christos Exp $
 .\"
 .\" Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -57,7 +57,7 @@
 .\"
 .\" from: @(#)inetd.8   8.4 (Berkeley) 6/1/94
 .\"
-.Dd August 27, 2008
+.Dd July 16, 2017
 .Dt INETD 8
 .Os
 .Sh NAME
@@ -115,7 +115,7 @@ special case, described below).
 The fields of the configuration file are as follows:
 .Pp
 .Bd -unfilled -offset indent -compact
-[addr:]service-name
+[addr:]service-name/port-number
 socket-type[:accept_filter]
 protocol[,sndbuf=size][,rcvbuf=size]
 wait/nowait[:max]
@@ -152,9 +152,9 @@ server program arguments
 .Ed
 .Pp
 For Internet services, the first field of the line may also have a host
-address specifier prefixed to it, separated from the service name by a colon.
-If this is done, the string before the colon in the first field
-indicates what local address
+address specifier prefixed to it, separated from the service name or port
+number by a colon. If this is done, the string before the colon in the
+first field indicates what local address
 .Nm
 should use when listening for that service, or the single character
 .Dq \&*
@@ -175,11 +175,11 @@ interpreted in the traditional manner, w
 on all local addresses.
 .Pp
 The
-.Em service-name
+.Em service-name/port-number
 entry is the name of a valid service in
 the file
 .Pa /etc/services .
-For
+Or an alternate port number. For
 .Dq internal
 services (discussed below), the service
 name



CVS commit: src/usr.sbin/inetd

2017-07-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul 16 21:05:19 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
PR/52412: Edgar Pettijohn: Describe the service/port syntax.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2017-02-14 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Wed Feb 15 02:48:31 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
Increase buffer size reported to strlcpy() to be one larger than the
length of the string we copy in so that there is space for the '\0'.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2017-02-14 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Wed Feb 15 02:48:31 UTC 2017

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
Increase buffer size reported to strlcpy() to be one larger than the
length of the string we copy in so that there is space for the '\0'.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.122 src/usr.sbin/inetd/inetd.c:1.123
--- src/usr.sbin/inetd/inetd.c:1.122	Sat Apr  5 23:36:10 2014
+++ src/usr.sbin/inetd/inetd.c	Wed Feb 15 02:48:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.122 2014/04/05 23:36:10 khorben Exp $	*/
+/*	$NetBSD: inetd.c,v 1.123 2017/02/15 02:48:31 elric Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)inetd.c	8.4 (Berkeley) 4/13/94";
 #else
-__RCSID("$NetBSD: inetd.c,v 1.122 2014/04/05 23:36:10 khorben Exp $");
+__RCSID("$NetBSD: inetd.c,v 1.123 2017/02/15 02:48:31 elric Exp $");
 #endif
 #endif /* not lint */
 
@@ -850,7 +850,7 @@ config(void)
 			}
 			(void)unlink(sep->se_service);
 			strlcpy(sep->se_ctrladdr_un.sun_path,
-			sep->se_service, n);
+			sep->se_service, n + 1);
 			sep->se_ctrladdr_un.sun_family = AF_LOCAL;
 			sep->se_ctrladdr_size = (int)(n +
 			sizeof(sep->se_ctrladdr_un) -



CVS commit: src/usr.sbin/inetd

2014-04-05 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sat Apr  5 23:36:10 UTC 2014

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
Use base 10 when logging the exit status or exit signal for sub-processes,
instead of hexadecimal.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2012-12-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec 13 19:38:41 UTC 2012

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
PR/47318: Henning Petersen: Replace (r)index with str(r)chr in inetd.c
And while here strncpy with strlcpy


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.120 src/usr.sbin/inetd/inetd.c:1.121
--- src/usr.sbin/inetd/inetd.c:1.120	Wed Jan  4 11:09:43 2012
+++ src/usr.sbin/inetd/inetd.c	Thu Dec 13 14:38:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.120 2012/01/04 16:09:43 drochner Exp $	*/
+/*	$NetBSD: inetd.c,v 1.121 2012/12/13 19:38:40 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ __COPYRIGHT(@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = @(#)inetd.c	8.4 (Berkeley) 4/13/94;
 #else
-__RCSID($NetBSD: inetd.c,v 1.120 2012/01/04 16:09:43 drochner Exp $);
+__RCSID($NetBSD: inetd.c,v 1.121 2012/12/13 19:38:40 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -842,14 +842,14 @@ config(void)
 			if (sep-se_fd != -1)
 break;
 			n = strlen(sep-se_service);
-			if (n  sizeof(sep-se_ctrladdr_un.sun_path)) {
+			if (n = sizeof(sep-se_ctrladdr_un.sun_path)) {
 syslog(LOG_ERR, %s: address too long,
 sep-se_service);
 sep-se_checked = 0;
 continue;
 			}
 			(void)unlink(sep-se_service);
-			strncpy(sep-se_ctrladdr_un.sun_path,
+			strlcpy(sep-se_ctrladdr_un.sun_path,
 			sep-se_service, n);
 			sep-se_ctrladdr_un.sun_family = AF_LOCAL;
 			sep-se_ctrladdr_size = (int)(n +
@@ -1367,22 +1367,22 @@ more:
 		sep-se_socktype = SOCK_STREAM;
 
 		/* one and only one accept filter */
-		accf = index(arg, ':');	
+		accf = strchr(arg, ':');	
 		if (accf) {
-			if (accf != rindex(arg, ':') ||	/* more than one */
+			if (accf != strrchr(arg, ':') ||/* more than one */
 			*(accf + 1) == '\0') {	/* nothing beyond */
 sep-se_socktype = -1;
 			} else {
 accf++;			/* skip delimiter */
-strncpy(sep-se_accf.af_name, accf,
+strlcpy(sep-se_accf.af_name, accf,
 	sizeof(sep-se_accf.af_name));
-accf_arg = index(accf, ',');
+accf_arg = strchr(accf, ',');
 if (accf_arg) {	/* zero or one arg, no more */
-	if ((rindex(accf, ',') != accf_arg)) {
+	if (strrchr(accf, ',') != accf_arg) {
 		sep-se_socktype = -1;
 	} else {
 		accf_arg++;
-		strncpy(sep-se_accf.af_arg,
+		strlcpy(sep-se_accf.af_arg,
 			accf_arg,
 			sizeof(sep-se_accf.af_arg));
 	}



CVS commit: src/usr.sbin/inetd

2012-12-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec 13 19:38:41 UTC 2012

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
PR/47318: Henning Petersen: Replace (r)index with str(r)chr in inetd.c
And while here strncpy with strlcpy


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2011-04-25 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Apr 25 22:12:06 UTC 2011

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
Use more markup.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.56 src/usr.sbin/inetd/inetd.8:1.57
--- src/usr.sbin/inetd/inetd.8:1.56	Sat Oct 24 12:23:47 2009
+++ src/usr.sbin/inetd/inetd.8	Mon Apr 25 22:12:05 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: inetd.8,v 1.56 2009/10/24 12:23:47 reed Exp $
+.\	$NetBSD: inetd.8,v 1.57 2011/04/25 22:12:05 wiz Exp $
 .\
 .\ Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -330,8 +330,11 @@
 defaults to 40.
 If it reaches this maximum spawn rate,
 .Nm
-will log the problem (via the syslogger using the LOG_DAEMON
-facility and LOG_ERR level)
+will log the problem (via the syslogger using the
+.Dv LOG_DAEMON
+facility and
+.Dv LOG_ERR
+level)
 and stop handling the specific service for ten minutes.
 .Pp
 Stream servers are usually marked as



CVS commit: src/usr.sbin/inetd

2011-04-25 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Apr 25 22:12:06 UTC 2011

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
Use more markup.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2010-12-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Dec 15 13:13:28 UTC 2010

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
Nuke conditionally compiled MULOG stuff.  Itojun wanted to do it
already 8 years ago when he fixed the compilation last time, and
again it hasn't been buildable in years.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.116 src/usr.sbin/inetd/inetd.c:1.117
--- src/usr.sbin/inetd/inetd.c:1.116	Thu Mar 25 16:36:00 2010
+++ src/usr.sbin/inetd/inetd.c	Wed Dec 15 13:13:28 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.116 2010/03/25 16:36:00 dholland Exp $	*/
+/*	$NetBSD: inetd.c,v 1.117 2010/12/15 13:13:28 pooka Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
 #if 0
 static char sccsid[] = @(#)inetd.c	8.4 (Berkeley) 4/13/94;
 #else
-__RCSID($NetBSD: inetd.c,v 1.116 2010/03/25 16:36:00 dholland Exp $);
+__RCSID($NetBSD: inetd.c,v 1.117 2010/12/15 13:13:28 pooka Exp $);
 #endif
 #endif /* not lint */
 
@@ -325,10 +325,6 @@
 	int	se_max;			/* max # of instances of this service */
 	int	se_count;		/* number started since se_time */
 	struct	timeval se_time;	/* start of se_count */
-#ifdef MULOG
-	int	se_log;
-#define MULOG_RFC931	0x4000
-#endif
 	struct	servtab *se_next;
 } *servtab;
 
@@ -383,11 +379,6 @@
 static struct kevent *	allocchange(void);
 static int	get_line(int, char *, int);
 static void	spawn(struct servtab *, int);
-#ifdef MULOG
-static void	dolog(struct servtab *, int);
-static void	timeout(int);
-static char*rfc931_name(struct sockaddr *, int);
-#endif
 
 struct biltin {
 	const char *bi_service;		/* internally provided service name */
@@ -736,10 +727,6 @@
 		if (debug)
 			fprintf(stderr, %d execl %s\n,
 			getpid(), sep-se_server);
-#ifdef MULOG
-		if (sep-se_log)
-			dolog(sep, ctrl);
-#endif
 		/* Set our control descriptor to not close-on-exec... */
 		if (fcntl(ctrl, F_SETFD, 0)  0)
 			syslog(LOG_ERR, fcntl (%d, F_SETFD, 0): %m, ctrl);
@@ -1332,33 +1319,6 @@
 #endif
 		if (*cp == '#' || *cp == '\0')
 			continue;
-#ifdef MULOG
-		/* Avoid use of `skip' if there is a danger of it looking
-		 * at continuation lines.
-		 */
-		do {
-			cp++;
-		} while (*cp == ' ' || *cp == '\t');
-		if (*cp == '\0')
-			continue;
-		if ((arg = skip(cp)) == NULL)
-			continue;
-		if (strcmp(arg, DOMAIN))
-			continue;
-		if (curdom)
-			free(curdom);
-		curdom = NULL;
-		while (*cp == ' ' || *cp == '\t')
-			cp++;
-		if (*cp == '\0')
-			continue;
-		arg = cp;
-		while (*cp  *cp != ' '  *cp != '\t')
-			cp++;
-		if (*cp != '\0')
-			*cp++ = '\0';
-		curdom = newstr(arg);
-#endif
 		break;
 	}
 	if (cp == NULL)
@@ -1667,36 +1627,6 @@
 		sep-se_bi = NULL;
 	argc = 0;
 	for (arg = skip(cp); cp; arg = skip(cp)) {
-#if MULOG
-		char *colon;
-
-		if (argc == 0  (colon = strrchr(arg, ':'))) {
-			while (arg  colon) {
-int	x;
-char	*ccp;
-
-switch (*arg++) {
-case 'l':
-	x = 1;
-	if (isdigit(*arg)) {
-		x = strtol(arg, ccp, 0);
-		if (ccp == arg)
-			break;
-		arg = ccp;
-	}
-	sep-se_log = ~MULOG_RFC931;
-	sep-se_log |= x;
-	break;
-case 'a':
-	sep-se_log |= MULOG_RFC931;
-	break;
-default:
-	break;
-}
-			}
-			arg = colon + 1;
-		}
-#endif
 		if (argc  MAXARGV)
 			sep-se_argv[argc++] = newstr(arg);
 	}
@@ -2243,246 +2173,6 @@
 	_exit(1);
 }
 
-#ifdef MULOG
-void
-dolog(struct servtab *sep, int ctrl)
-{
-	struct sockaddr_storage	ss;
-	struct sockaddr		*sa = (struct sockaddr *)ss;
-	socklen_t		len = sizeof(ss);
-	char			*host, *dp, buf[BUFSIZ], abuf[BUFSIZ];
-	int			connected = 1;
-
-	switch (sep-se_family) {
-	case AF_INET:
-#ifdef INET6
-	case AF_INET6:
-#endif
-		break;
-	default:
-		return;
-	}
-
-	if (getpeername(ctrl, sa, len)  0) {
-		if (errno != ENOTCONN) {
-			syslog(LOG_ERR, getpeername: %m);
-			return;
-		}
-		if (recvfrom(ctrl, buf, sizeof(buf), MSG_PEEK, sa, len)  0) {
-			syslog(LOG_ERR, recvfrom: %m);
-			return;
-		}
-		connected = 0;
-	}
-	switch (sa-sa_family) {
-	case AF_INET:
-#ifdef INET6
-	case AF_INET6:
-#endif
-		break;
-	default:
-		syslog(LOG_ERR, unexpected address family %u, sa-sa_family);
-		return;
-	}
-
-	if (getnameinfo(sa, len, buf, sizeof(buf), NULL, 0, 0) != 0)
-		strlcpy(buf, ?, sizeof(buf));
-	host = buf;
-
-	switch (sep-se_log  ~MULOG_RFC931) {
-	case 0:
-		return;
-	case 1:
-		if (curdom == NULL || *curdom == '\0')
-			break;
-		dp = host + strlen(host) - strlen(curdom);
-		if (dp  host)
-			break;
-		if (debug)
-			fprintf(stderr, check \%s\ against curdom \%s\\n,
-			host, curdom);
-		if (strcasecmp(dp, curdom) == 0)
-			return;
-		break;
-	case 2:
-	default:
-		break;
-	}
-
-	openlog(, LOG_NOWAIT, MULOG);
-
-	sockaddr_snprintf(abuf, 

CVS commit: src/usr.sbin/inetd

2010-12-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Dec 15 15:36:16 UTC 2010

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
RLIMIT_NOFILE stabilized in NetBSD 17 years ago, so it's safe now
to remove the #ifdef's from around code which uses it.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.117 src/usr.sbin/inetd/inetd.c:1.118
--- src/usr.sbin/inetd/inetd.c:1.117	Wed Dec 15 13:13:28 2010
+++ src/usr.sbin/inetd/inetd.c	Wed Dec 15 15:36:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.117 2010/12/15 13:13:28 pooka Exp $	*/
+/*	$NetBSD: inetd.c,v 1.118 2010/12/15 15:36:15 pooka Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
 #if 0
 static char sccsid[] = @(#)inetd.c	8.4 (Berkeley) 4/13/94;
 #else
-__RCSID($NetBSD: inetd.c,v 1.117 2010/12/15 13:13:28 pooka Exp $);
+__RCSID($NetBSD: inetd.c,v 1.118 2010/12/15 15:36:15 pooka Exp $);
 #endif
 #endif /* not lint */
 
@@ -194,10 +194,6 @@
 #include sys/resource.h
 #include sys/event.h
 
-#ifndef RLIMIT_NOFILE
-#define RLIMIT_NOFILE	RLIMIT_OFILE
-#endif
-
 #ifndef NO_RPC
 #define RPC
 #endif
@@ -279,9 +275,7 @@
 #define FD_MARGIN	(8)
 rlim_t		rlim_ofile_cur = OPEN_MAX;
 
-#ifdef RLIMIT_NOFILE
 struct rlimit	rlim_ofile;
-#endif
 
 struct kevent	changebuf[64];
 size_t		changes;
@@ -470,7 +464,6 @@
 		return (EXIT_FAILURE);
 	}
 
-#ifdef RLIMIT_NOFILE
 	if (getrlimit(RLIMIT_NOFILE, rlim_ofile)  0) {
 		syslog(LOG_ERR, getrlimit: %m);
 	} else {
@@ -478,7 +471,6 @@
 		if (rlim_ofile_cur == RLIM_INFINITY)	/* ! */
 			rlim_ofile_cur = OPEN_MAX;
 	}
-#endif
 
 	for (n = 0; n  (int)A_CNT(my_signals); n++) {
 		int	signum;
@@ -738,11 +730,9 @@
 		}
 		dup2(0, 1);
 		dup2(0, 2);
-#ifdef RLIMIT_NOFILE
 		if (rlim_ofile.rlim_cur != rlim_ofile_cur 
 		setrlimit(RLIMIT_NOFILE, rlim_ofile)  0)
 			syslog(LOG_ERR, setrlimit: %m);
-#endif
 		execv(sep-se_server, sep-se_argv);
 		syslog(LOG_ERR, cannot execute %s: %m, sep-se_server);
 	reject:
@@ -1776,10 +1766,7 @@
 static void
 bump_nofile(void)
 {
-#ifdef RLIMIT_NOFILE
-
 #define FD_CHUNK	32
-
 	struct rlimit rl;
 
 	if (getrlimit(RLIMIT_NOFILE, rl)  0) {
@@ -1801,11 +1788,6 @@
 
 	rlim_ofile_cur = rl.rlim_cur;
 	return;
-
-#else
-	syslog(LOG_ERR, bump_nofile: cannot extend file limit);
-	return;
-#endif
 }
 
 /*



CVS commit: src/usr.sbin/inetd

2010-12-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Dec 15 13:13:28 UTC 2010

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
Nuke conditionally compiled MULOG stuff.  Itojun wanted to do it
already 8 years ago when he fixed the compilation last time, and
again it hasn't been buildable in years.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/inetd

2010-03-25 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Thu Mar 25 16:36:00 UTC 2010

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
Avoid SIGSEGV in forked child process for (some?) instant-disconnect clients.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.115 src/usr.sbin/inetd/inetd.c:1.116
--- src/usr.sbin/inetd/inetd.c:1.115	Thu Oct 22 22:50:35 2009
+++ src/usr.sbin/inetd/inetd.c	Thu Mar 25 16:36:00 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.115 2009/10/22 22:50:35 tsarna Exp $	*/
+/*	$NetBSD: inetd.c,v 1.116 2010/03/25 16:36:00 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
 #if 0
 static char sccsid[] = @(#)inetd.c	8.4 (Berkeley) 4/13/94;
 #else
-__RCSID($NetBSD: inetd.c,v 1.115 2009/10/22 22:50:35 tsarna Exp $);
+__RCSID($NetBSD: inetd.c,v 1.116 2010/03/25 16:36:00 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -671,8 +671,12 @@
 ntohs(sep-se_ctrladdr_in.sin_port));
 			}
 			service = buf;
-			sockaddr_snprintf(abuf, sizeof(abuf), %a,
-			req.client-sin);
+			if (req.client-sin) {
+sockaddr_snprintf(abuf, sizeof(abuf), %a,
+req.client-sin);
+			} else {
+strcpy(abuf, (null));
+			}
 		}
 		if (denied) {
 			syslog(deny_severity,



CVS commit: src/usr.sbin/inetd

2009-10-24 Thread Jeremy C. Reed
Module Name:src
Committed By:   reed
Date:   Sat Oct 24 12:23:47 UTC 2009

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
Change manpage reference from talkd to ntalkd.
(Man link does exist, but no binary.)


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.55 src/usr.sbin/inetd/inetd.8:1.56
--- src/usr.sbin/inetd/inetd.8:1.55	Thu Oct 22 22:50:35 2009
+++ src/usr.sbin/inetd/inetd.8	Sat Oct 24 12:23:47 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: inetd.8,v 1.55 2009/10/22 22:50:35 tsarna Exp $
+.\	$NetBSD: inetd.8,v 1.56 2009/10/24 12:23:47 reed Exp $
 .\
 .\ Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -303,7 +303,7 @@
 .Xr comsat 8
 .Pq Xr biff 1
 and
-.Xr talkd 8
+.Xr ntalkd 8
 are both examples of the latter type of
 datagram server.
 .Xr tftpd 8



Re: CVS commit: src/usr.sbin/inetd

2009-10-22 Thread Ty Sarna

On Oct 22, 2009, at 12:34 PM, Jochen Kunz wrote:


Add mDNS Service Directory support to inetd(8).
inetd(8) can now advertize services in the mDNS-SD.
(Per service configuration option in inetd.conf(5).)


Thanks for coordinating with me. :-(

I think the problem is more complicated than you realize. I appreciate  
that you gave quite some thought to some of the implementation issues  
(handling interface restrictions, marking the mdnsd socket CLOEXEC),  
but you seem to have missed other issues entirely (service name  
support, TXT records, etc). The feature as-is is of limited utility.


Re: CVS commit: src/usr.sbin/inetd

2009-10-22 Thread Alan Barrett
On Thu, 22 Oct 2009, Jochen Kunz wrote:
 Modified Files:
   src/usr.sbin/inetd: Makefile inetd.8 inetd.c
 
 Log Message:
 Add mDNS Service Directory support to inetd(8).
 inetd(8) can now advertize services in the mDNS-SD.
 (Per service configuration option in inetd.conf(5).)

Where was this discussed?  In particular, any syntax changes in
inetd.conf should be discussed before implementation.

--apb (Alan Barrett)


CVS commit: src/usr.sbin/inetd

2009-10-22 Thread Jochen Kunz
Module Name:src
Committed By:   jkunz
Date:   Thu Oct 22 16:34:27 UTC 2009

Modified Files:
src/usr.sbin/inetd: Makefile inetd.8 inetd.c

Log Message:
Add mDNS Service Directory support to inetd(8).
inetd(8) can now advertize services in the mDNS-SD.
(Per service configuration option in inetd.conf(5).)


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/inetd/Makefile
cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/inetd/inetd.8
cvs rdiff -u -r1.113 -r1.114 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/Makefile
diff -u src/usr.sbin/inetd/Makefile:1.21 src/usr.sbin/inetd/Makefile:1.22
--- src/usr.sbin/inetd/Makefile:1.21	Mon May 28 12:06:35 2007
+++ src/usr.sbin/inetd/Makefile	Thu Oct 22 16:34:27 2009
@@ -1,5 +1,5 @@
 #	from: @(#)Makefile	8.1 (Berkeley) 6/6/93
-#	$NetBSD: Makefile,v 1.21 2007/05/28 12:06:35 tls Exp $
+#	$NetBSD: Makefile,v 1.22 2009/10/22 16:34:27 jkunz Exp $
 
 .include bsd.own.mk
 
@@ -20,6 +20,12 @@
 CPPFLAGS+=-DINET6
 .endif
 
+.if (${MKMDNS} != no)
+CPPFLAGS+=-DMDNS
+LDADD+= -ldns_sd
+DPADD+=	${LIBDNS_SD}
+.endif
+
 CPPFLAGS+=-DIPSEC
 SRCS+=	ipsec.c
 LDADD+= -lipsec

Index: src/usr.sbin/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.52 src/usr.sbin/inetd/inetd.8:1.53
--- src/usr.sbin/inetd/inetd.8:1.52	Tue Jul 14 08:24:15 2009
+++ src/usr.sbin/inetd/inetd.8	Thu Oct 22 16:34:27 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: inetd.8,v 1.52 2009/07/14 08:24:15 wiz Exp $
+.\	$NetBSD: inetd.8,v 1.53 2009/10/22 16:34:27 jkunz Exp $
 .\
 .\ Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -118,7 +118,7 @@
 [addr:]service-name
 socket-type[:accept_filter]
 protocol[,sndbuf=size][,rcvbuf=size]
-wait/nowait[:max]
+[mdns,]wait/nowait[:max]
 user[:group]
 server-program
 server program arguments
@@ -132,7 +132,7 @@
 service-name/version
 socket-type
 rpc/protocol[,sndbuf=size][,rcvbuf=size]
-wait/nowait[:max]
+[mdns,]wait/nowait[:max]
 user[:group]
 server-program
 server program arguments
@@ -145,7 +145,7 @@
 path
 socket-type
 unix[,sndbuf=size][,rcvbuf=size]
-wait/nowait[:max]
+[mdns,]wait/nowait[:max]
 user[:group]
 server-program
 server program arguments
@@ -279,6 +279,16 @@
 Socket buffer sizes may be specified for all
 services and protocols except for tcpmux services.
 .Pp
+If the
+.Em mdns
+option is present then
+.Nm
+advertises the service in the mDNS Service Directory.
+.Xr mdnsd 8
+needs to run for this to work. Note that mDNS does not distinguish IPv4 and
+IPv6. If a service is enabled for IPv6 only and IPv4 addresses are configured
+on the affected interface, the service will be advertized for IPv4 and IPv6.
+.Pp
 The
 .Em wait/nowait
 entry is used to tell

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.113 src/usr.sbin/inetd/inetd.c:1.114
--- src/usr.sbin/inetd/inetd.c:1.113	Mon Jul 13 19:05:41 2009
+++ src/usr.sbin/inetd/inetd.c	Thu Oct 22 16:34:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.113 2009/07/13 19:05:41 roy Exp $	*/
+/*	$NetBSD: inetd.c,v 1.114 2009/10/22 16:34:27 jkunz Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
 #if 0
 static char sccsid[] = @(#)inetd.c	8.4 (Berkeley) 4/13/94;
 #else
-__RCSID($NetBSD: inetd.c,v 1.113 2009/07/13 19:05:41 roy Exp $);
+__RCSID($NetBSD: inetd.c,v 1.114 2009/10/22 16:34:27 jkunz Exp $);
 #endif
 #endif /* not lint */
 
@@ -98,7 +98,8 @@
  *	socket type[:accf[,arg]]	stream/dgram/raw/rdm/seqpacket,
 	only stream can name an accept filter
  *	protocol			must be in /etc/protocols
- *	wait/nowait[:max]		single-threaded/multi-threaded, max #
+ *	[mdns,]wait/nowait[:max]	single-threaded/multi-threaded, max #
+ *	if mdns register service in mDNS-SD
  *	user[:group]			user/group to run daemon as
  *	server program			full path name
  *	server program arguments	maximum of MAXARGS (20)
@@ -107,7 +108,8 @@
  *  service name/versionmust be in /etc/rpc
  *	socket type			stream/dgram/raw/rdm/seqpacket
  *	protocol			must be in /etc/protocols
- *	wait/nowait[:max]		single-threaded/multi-threaded
+ *	[mdns,]wait/nowait[:max]	single-threaded/multi-threaded
+ *	if mdns register service in mDNS-SD
  *	user[:group]			user to run daemon as
  *	server program			full path name
  *	server program arguments	maximum of MAXARGS (20)
@@ -255,6 +257,10 @@
 int deny_severity = LIBWRAP_DENY_FACILITY|LIBWRAP_DENY_SEVERITY;
 #endif
 
+#ifdef MDNS
+#include dns_sd.h
+#endif /* MDNS */
+
 #define	TOOMANY		40		/* 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 */
@@ -320,6 +326,7 @@
 	} se_un;			/* bound address */
 #define se_ctrladdr	se_un.se_un_ctrladdr
 #define se_ctrladdr_in	se_un.se_un_ctrladdr_in
+#define se_ctrladdr_in6	se_un.se_un_ctrladdr_in6
 #define se_ctrladdr_un	

CVS commit: src/usr.sbin/inetd

2009-10-22 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Oct 22 21:43:28 UTC 2009

Modified Files:
src/usr.sbin/inetd: inetd.8

Log Message:
Bump date for mDNS support.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/inetd/inetd.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.8
diff -u src/usr.sbin/inetd/inetd.8:1.53 src/usr.sbin/inetd/inetd.8:1.54
--- src/usr.sbin/inetd/inetd.8:1.53	Thu Oct 22 16:34:27 2009
+++ src/usr.sbin/inetd/inetd.8	Thu Oct 22 21:43:28 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: inetd.8,v 1.53 2009/10/22 16:34:27 jkunz Exp $
+.\	$NetBSD: inetd.8,v 1.54 2009/10/22 21:43:28 wiz Exp $
 .\
 .\ Copyright (c) 1998 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -57,7 +57,7 @@
 .\
 .\ from: @(#)inetd.8   8.4 (Berkeley) 6/1/94
 .\
-.Dd August 27, 2008
+.Dd October 22, 2009
 .Dt INETD 8
 .Os
 .Sh NAME
@@ -285,8 +285,9 @@
 .Nm
 advertises the service in the mDNS Service Directory.
 .Xr mdnsd 8
-needs to run for this to work. Note that mDNS does not distinguish IPv4 and
-IPv6. If a service is enabled for IPv6 only and IPv4 addresses are configured
+needs to run for this to work.
+Note that mDNS does not distinguish IPv4 and IPv6.
+If a service is enabled for IPv6 only and IPv4 addresses are configured
 on the affected interface, the service will be advertized for IPv4 and IPv6.
 .Pp
 The



CVS commit: src/usr.sbin/inetd

2009-05-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 23 03:24:51 UTC 2009

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
print the proper client address (ryo shimizu)


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.111 src/usr.sbin/inetd/inetd.c:1.112
--- src/usr.sbin/inetd/inetd.c:1.111	Wed Apr 15 04:38:37 2009
+++ src/usr.sbin/inetd/inetd.c	Fri May 22 23:24:51 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.111 2009/04/15 08:38:37 lukem Exp $	*/
+/*	$NetBSD: inetd.c,v 1.112 2009/05/23 03:24:51 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
 #if 0
 static char sccsid[] = @(#)inetd.c	8.4 (Berkeley) 4/13/94;
 #else
-__RCSID($NetBSD: inetd.c,v 1.111 2009/04/15 08:38:37 lukem Exp $);
+__RCSID($NetBSD: inetd.c,v 1.112 2009/05/23 03:24:51 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -672,7 +672,7 @@
 			}
 			service = buf;
 			sockaddr_snprintf(abuf, sizeof(abuf), %a,
-			sep-se_ctrladdr);
+			req.client-sin);
 		}
 		if (denied) {
 			syslog(deny_severity,



CVS commit: src/usr.sbin/inetd

2009-04-15 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Wed Apr 15 08:38:37 UTC 2009

Modified Files:
src/usr.sbin/inetd: inetd.c

Log Message:
Fix -Wsign-compare issue


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/usr.sbin/inetd/inetd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/inetd/inetd.c
diff -u src/usr.sbin/inetd/inetd.c:1.110 src/usr.sbin/inetd/inetd.c:1.111
--- src/usr.sbin/inetd/inetd.c:1.110	Thu Jan  8 21:37:20 2009
+++ src/usr.sbin/inetd/inetd.c	Wed Apr 15 08:38:37 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: inetd.c,v 1.110 2009/01/08 21:37:20 christos Exp $	*/
+/*	$NetBSD: inetd.c,v 1.111 2009/04/15 08:38:37 lukem Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
 #if 0
 static char sccsid[] = @(#)inetd.c	8.4 (Berkeley) 4/13/94;
 #else
-__RCSID($NetBSD: inetd.c,v 1.110 2009/01/08 21:37:20 christos Exp $);
+__RCSID($NetBSD: inetd.c,v 1.111 2009/04/15 08:38:37 lukem Exp $);
 #endif
 #endif /* not lint */
 
@@ -1147,7 +1147,7 @@
 	(intptr_t)sep);
 	if (sep-se_fd  maxsock) {
 		maxsock = sep-se_fd;
-		if (maxsock  rlim_ofile_cur - FD_MARGIN)
+		if (maxsock  (int)(rlim_ofile_cur - FD_MARGIN))
 			bump_nofile();
 	}
 	if (debug)