CVS commit: src/usr.sbin/inetd
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
Re: CVS commit: src/usr.sbin/inetd
On Tue, Oct 17, 2017 at 9:03 PM, Christos Zoulaswrote: > 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
In article <20171017071319.a4380f...@cvs.netbsd.org>, Ryota Ozakiwrote: >-=-=-=-=-=- > >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
Re: CVS commit: src/usr.sbin/inetd
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
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)