From owner-svn-src-stable-12@freebsd.org Mon Jan 13 18:18:25 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5000D1E6F2D; Mon, 13 Jan 2020 18:18:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47xMKF1Ky7z3yXy; Mon, 13 Jan 2020 18:18:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2908A8B1C; Mon, 13 Jan 2020 18:18:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00DIIOwg010507; Mon, 13 Jan 2020 18:18:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00DIIOM4010506; Mon, 13 Jan 2020 18:18:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202001131818.00DIIOM4010506@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 13 Jan 2020 18:18:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r356690 - in stable: 11/usr.sbin/inetd 12/usr.sbin/inetd X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/usr.sbin/inetd 12/usr.sbin/inetd X-SVN-Commit-Revision: 356690 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jan 2020 18:18:25 -0000 Author: kevans Date: Mon Jan 13 18:18:24 2020 New Revision: 356690 URL: https://svnweb.freebsd.org/changeset/base/356690 Log: MFC r356601-r356602: inetd fixes for WITHOUT_* knobs r356601: inetd: free WITHOUT_INET6_SUPPORT build of warnings If inetd is compiled without inet6 support, we need to error out on rpc+inet6 services rather than attempting to call into rpc bits with an uninitialized netid. v4bind is only used with INET6 support, so move it under the proper #ifdefs with v6bind. Reported by: Pavel Timofeev r356602: inetd: two more nits Use __COPYRIGHT for copyright to simply either embed it via .ident or have it properly marked __unused Move an ipsec reference to IPSEC Modified: stable/12/usr.sbin/inetd/inetd.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.sbin/inetd/inetd.c Directory Properties: stable/11/ (props changed) Modified: stable/12/usr.sbin/inetd/inetd.c ============================================================================== --- stable/12/usr.sbin/inetd/inetd.c Mon Jan 13 18:16:57 2020 (r356689) +++ stable/12/usr.sbin/inetd/inetd.c Mon Jan 13 18:18:24 2020 (r356690) @@ -29,10 +29,12 @@ * SUCH DAMAGE. */ +#include +__FBSDID("$FreeBSD$"); + #ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1983, 1991, 1993, 1994\n\ - The Regents of the University of California. All rights reserved.\n"; +__COPYRIGHT("@(#) Copyright (c) 1983, 1991, 1993, 1994\n\ + The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint @@ -41,9 +43,6 @@ static char sccsid[] = "@(#)from: inetd.c 8.4 (Berkele #endif #endif /* not lint */ -#include -__FBSDID("$FreeBSD$"); - /* * Inetd - Internet super-server * @@ -1360,6 +1359,15 @@ setsockopt(fd, SOL_SOCKET, opt, (char *)&on, sizeof (o sock.sin_port = sep->se_ctrladdr6.sin6_port; } } +#else + else { + syslog(LOG_ERR, + "%s/%s: inetd compiled without inet6 support\n", + sep->se_service, sep->se_proto); + (void) close(sep->se_fd); + sep->se_fd = -1; + return; + } #endif if (debug) print_service("REG ", sep); @@ -1611,8 +1619,8 @@ getconfigent(void) #ifdef IPSEC char *policy; #endif - int v4bind; #ifdef INET6 + int v4bind; int v6bind; #endif int i; @@ -1622,8 +1630,8 @@ getconfigent(void) policy = NULL; #endif more: - v4bind = 0; #ifdef INET6 + v4bind = 0; v6bind = 0; #endif while ((cp = nextline(fconfig)) != NULL) { @@ -1652,7 +1660,9 @@ more: break; } if (cp == NULL) { +#ifdef IPSEC free(policy); +#endif return (NULL); } @@ -1787,7 +1797,9 @@ more: #endif if (sep->se_proto[strlen(sep->se_proto) - 1] == '4') { sep->se_proto[strlen(sep->se_proto) - 1] = '\0'; +#ifdef INET6 v4bind = 1; +#endif continue; } /* illegal version num */