Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Feb 2017 15:52:08 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r313206 - stable/10/usr.sbin/inetd
Message-ID:  <201702041552.v14Fq80M053049@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sat Feb  4 15:52:08 2017
New Revision: 313206
URL: https://svnweb.freebsd.org/changeset/base/313206

Log:
  MFC r312105,r312162:
  
  r312105:
  
  Conditionalize libwrap support into inetd based on MK_TCP_WRAPPERS
  
  This will allow inetd to stand by itself without libwrap.
  
  Relnotes:	yes
  
  r312162:
  
  Fix up r312105
  
  - Only #include tcpd.h when LIBWRAP is true to avoid header include errors
  - Only define whichaf when LIBWRAP is true to avoid -Wunused warning and
    to avoid issues with structs being defined that should only be defined
    when tcpd.h is included.
  
  Pointyhat to:	ngie

Modified:
  stable/10/usr.sbin/inetd/Makefile
  stable/10/usr.sbin/inetd/inetd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/inetd/Makefile
==============================================================================
--- stable/10/usr.sbin/inetd/Makefile	Sat Feb  4 15:51:45 2017	(r313205)
+++ stable/10/usr.sbin/inetd/Makefile	Sat Feb  4 15:52:08 2017	(r313206)
@@ -16,8 +16,14 @@ CFLAGS+= -DLOGIN_CAP
 CFLAGS+= -DINET6
 .endif
 
-DPADD=	${LIBUTIL} ${LIBWRAP}
-LDADD=	-lutil -lwrap
+DPADD+=		${LIBUTIL}
+LDADD+=		-lutil
+
+.if ${MK_TCP_WRAPPERS} != "no"
+CFLAGS+=	-DLIBWRAP
+DPADD+=		${LIBWRAP}
+LDADD+=		-lwrap
+.endif
 
 # XXX for src/release/picobsd
 .if !defined(RELEASE_CRUNCH)

Modified: stable/10/usr.sbin/inetd/inetd.c
==============================================================================
--- stable/10/usr.sbin/inetd/inetd.c	Sat Feb  4 15:51:45 2017	(r313205)
+++ stable/10/usr.sbin/inetd/inetd.c	Sat Feb  4 15:52:08 2017	(r313206)
@@ -138,7 +138,9 @@ __FBSDID("$FreeBSD$");
 #include <string.h>
 #include <sysexits.h>
 #include <syslog.h>
+#ifdef LIBWRAP
 #include <tcpd.h>
+#endif
 #include <unistd.h>
 
 #include "inetd.h"
@@ -297,6 +299,7 @@ getvalue(const char *arg, int *value, co
 	return 0;				/* success */
 }
 
+#ifdef LIBWRAP
 static sa_family_t
 whichaf(struct request_info *req)
 {
@@ -310,6 +313,7 @@ whichaf(struct request_info *req)
 		return AF_INET;
 	return sa->sa_family;
 }
+#endif
 
 int
 main(int argc, char **argv)
@@ -324,9 +328,11 @@ main(int argc, char **argv)
 #ifdef LOGIN_CAP
 	login_cap_t *lc = NULL;
 #endif
+#ifdef LIBWRAP
 	struct request_info req;
 	int denied;
 	char *service = NULL;
+#endif
 	struct sockaddr_storage peer;
 	int i;
 	struct addrinfo hints, *res;
@@ -736,6 +742,7 @@ main(int argc, char **argv)
 					    _exit(0);
 				    }
 			    }
+#ifdef LIBWRAP
 			    if (ISWRAP(sep)) {
 				inetd_setproctitle("wrapping", ctrl);
 				service = sep->se_server_name ?
@@ -764,6 +771,7 @@ main(int argc, char **argv)
 					(whichaf(&req) == AF_INET6) ? "6" : "");
 				}
 			    }
+#endif
 			    if (sep->se_bi) {
 				(*sep->se_bi->bi_fn)(ctrl, sep);
 			    } else {



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