Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jan 2020 18:18:24 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r356690 - in stable: 11/usr.sbin/inetd 12/usr.sbin/inetd
Message-ID:  <202001131818.00DIIO7S010500@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <timp87 gmail com>
  
  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/11/usr.sbin/inetd/inetd.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/usr.sbin/inetd/inetd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/usr.sbin/inetd/inetd.c
==============================================================================
--- stable/11/usr.sbin/inetd/inetd.c	Mon Jan 13 18:16:57 2020	(r356689)
+++ stable/11/usr.sbin/inetd/inetd.c	Mon Jan 13 18:18:24 2020	(r356690)
@@ -27,10 +27,12 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
+__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
@@ -39,9 +41,6 @@ static char sccsid[] = "@(#)from: inetd.c	8.4 (Berkele
 #endif
 #endif /* not lint */
 
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
 /*
  * Inetd - Internet super-server
  *
@@ -1358,6 +1357,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);
@@ -1609,8 +1617,8 @@ getconfigent(void)
 #ifdef IPSEC
 	char *policy;
 #endif
-	int v4bind;
 #ifdef INET6
+	int v4bind;
 	int v6bind;
 #endif
 	int i;
@@ -1620,8 +1628,8 @@ getconfigent(void)
 	policy = NULL;
 #endif
 more:
-	v4bind = 0;
 #ifdef INET6
+	v4bind = 0;
 	v6bind = 0;
 #endif
 	while ((cp = nextline(fconfig)) != NULL) {
@@ -1650,7 +1658,9 @@ more:
 		break;
 	}
 	if (cp == NULL) {
+#ifdef IPSEC
 		free(policy);
+#endif
 		return (NULL);
 	}
 
@@ -1785,7 +1795,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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001131818.00DIIO7S010500>