svn commit: r468686 - in head/news/nntp: . files

Dirk Meyer dinoex at FreeBSD.org
Mon Apr 30 10:23:34 UTC 2018


Author: dinoex
Date: Mon Apr 30 10:23:32 2018
New Revision: 468686
URL: https://svnweb.freebsd.org/changeset/ports/468686

Log:
  - remove option INETD
  - build both standalone and inetd version
  - fix permissions on update
  - add IPv6 support based on work from Gert Doering
  
  If you used the inetd version, please change the path in /etc/inetd.conf
  from /usr/local/sbin/nntpd to /usr/local/libexec/nntpd.

Added:
  head/news/nntp/files/patch-access.c   (contents, props changed)
  head/news/nntp/files/patch-get_tcp_conn.c   (contents, props changed)
  head/news/nntp/files/patch-netaux.c   (contents, props changed)
  head/news/nntp/files/patch-server-Makefile   (contents, props changed)
Modified:
  head/news/nntp/Makefile
  head/news/nntp/files/patch-Makefile
  head/news/nntp/pkg-plist

Modified: head/news/nntp/Makefile
==============================================================================
--- head/news/nntp/Makefile	Mon Apr 30 09:41:04 2018	(r468685)
+++ head/news/nntp/Makefile	Mon Apr 30 10:23:32 2018	(r468686)
@@ -3,8 +3,8 @@
 
 PORTNAME=	nntp
 PORTVERSION=	1.5.12.2
-PORTREVISION=	9
-CATEGORIES=	news
+PORTREVISION=	10
+CATEGORIES=	news ipv6
 MASTER_SITES=	ftp://ftp.dinoex.org/pub/c-news/
 DISTNAME=	${PORTNAME}.${PORTVERSION}
 
@@ -35,17 +35,12 @@ MAKE_ENV+=	DBLIBS="${LOCALBASE}/lib/libcnews.a -lcrypt
 MAKE_ENV+=	ETCDIR="${STAGEDIR}${PREFIX}/sbin"
 MAKE_ENV+=	BINDIR="${STAGEDIR}${NEWSBIN}"
 MAKE_ENV+=	MANDIR="${STAGEDIR}${PREFIX}/man"
+MAKE_ENV+=	EXECDIR="${STAGEDIR}${PREFIX}/libexec"
 
-OPTIONS_DEFINE=	INETD DOCS
-NO_OPTIONS_SORT=yes
-INETD_DESC=	build to run from inetd only
+OPTIONS_DEFINE=	DOCS
 
 .include <bsd.port.options.mk>
 
-.if ${PORT_OPTIONS:MINETD}
-ALONE=	-e 's|\#define.ALONE|\#undef	ALONE|'
-.endif
-
 post-extract:
 	${CP} ${WRKSRC}/conf.h.dist ${WRKSRC}/conf.h
 
@@ -56,9 +51,15 @@ post-patch:
 	${REINPLACE_CMD} \
 		-e 's=reaper()=reaper(int unused)=' \
 		${WRKSRC}/server/netaux.c
+	(cd ${WRKSRC} && ${CP} -pr server inetd)
+	${REINPLACE_CMD} \
+		-e 's|^CPPFLAGS|#CPPFLAGS|' \
+		-e 's|ETCDIR|EXECDIR|g' \
+		${WRKSRC}/inetd/Makefile
 
 pre-configure:
-	${REINPLACE_CMD} ${ALONE} \
+	${REINPLACE_CMD} \
+		-e 's|\#define.ALONE.*||' \
 		-e "s=/usr/local/news/lib/bin/config=${NEWSBIN}/config=" \
 		-e "s=/usr/local/news/cnewsbin=${NEWSBIN}=" \
 		-e "s=/usr/local/news/lib=${NEWSCTL}=" \

Modified: head/news/nntp/files/patch-Makefile
==============================================================================
--- head/news/nntp/files/patch-Makefile	Mon Apr 30 09:41:04 2018	(r468685)
+++ head/news/nntp/files/patch-Makefile	Mon Apr 30 10:23:32 2018	(r468686)
@@ -1,5 +1,5 @@
---- Makefile.orig	1996-01-09 08:30:24.000000000 +0100
-+++ Makefile	2013-09-03 20:32:47.000000000 +0200
+--- Makefile.orig	1996-01-09 07:30:24 UTC
++++ Makefile
 @@ -4,7 +4,7 @@
  # The program that knows how to deal with makefiles. [Uncomment if needed.]
  # MAKE=make
@@ -9,7 +9,7 @@
  #Uncomment the following for Solaris (and similiar SVR4 systems)
  #NETLIBS   = -lsocket -lnsl 
  #Uncomment the following if the previous one does not work
-@@ -20,11 +20,11 @@
+@@ -20,11 +20,11 @@ CFLAGS= -O 
  #Uncomment the following for Solaris (and similiar SVR4 systems)
  #KVMLIB = -lelf
  # Where nntpd is going to live
@@ -24,7 +24,7 @@
  #
  LIBS = $(DBLIBS) $(RESLIB) $(NETLIBS) $(KVMLIB)
  SUBMAKEFLAGS="LIBS=${LIBS}" "CFLAGS=${CFLAGS}" "ETCDIR=${ETCDIR}" "BINDIR=${BINDIR}" "MANDIR=${MANDIR}"
-@@ -42,11 +42,11 @@
+@@ -42,11 +42,12 @@ TYPE = server
  all: make_$(TYPE)
  
  make_server: /nowhere
@@ -34,6 +34,7 @@
 -	cd xmit; $(MAKE) $(MFLAGS) $(SUBMAKEFLAGS)
 -	cd xfer; $(MAKE) $(MFLAGS) $(SUBMAKEFLAGS)
 +	$(MAKE) -C server $(MFLAGS) $(SUBMAKEFLAGS)
++	$(MAKE) -C inetd $(MFLAGS) $(SUBMAKEFLAGS)
 +	$(MAKE) -C support $(MFLAGS) $(SUBMAKEFLAGS)
 +	$(MAKE) -C doc $(MFLAGS) $(SUBMAKEFLAGS)
 +	$(MAKE) -C xmit $(MFLAGS) $(SUBMAKEFLAGS)
@@ -41,7 +42,7 @@
  
  server: make_server
  
-@@ -59,25 +59,25 @@
+@@ -59,25 +60,26 @@ client: make_client
  install: install_$(TYPE)
  
  install_server:
@@ -51,6 +52,7 @@
 -	cd xmit; $(MAKE) $(MFLAGS) $(SUBMAKEFLAGS) install
 -	cd xfer; $(MAKE) $(MFLAGS) $(SUBMAKEFLAGS) install
 +	$(MAKE) -C server $(MFLAGS) $(SUBMAKEFLAGS) install
++	$(MAKE) -C inetd $(MFLAGS) $(SUBMAKEFLAGS) install
 +	$(MAKE) -C support $(MFLAGS) $(SUBMAKEFLAGS) install
 +	$(MAKE) -C doc $(MFLAGS) $(SUBMAKEFLAGS) install
 +	$(MAKE) -C xmit $(MFLAGS) $(SUBMAKEFLAGS) install

Added: head/news/nntp/files/patch-access.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/news/nntp/files/patch-access.c	Mon Apr 30 10:23:32 2018	(r468686)
@@ -0,0 +1,100 @@
+--- server/access.c.orig	2018-04-30 09:19:08 UTC
++++ server/access.c
+@@ -11,6 +11,10 @@ static char	sccsid[] = "@(#)$Id: access.
+ #endif
+ #include <sys/socket.h>
+ 
++#ifdef __FreeBSD__
++# include <netdb.h>
++#endif
++
+ #define	SNETMATCH	1
+ #define	NETMATCH	2
+ 
+@@ -40,6 +44,12 @@ static char	sccsid[] = "@(#)$Id: access.
+  *	Side effects:	None.
+  */
+ 
++typedef union {
++  struct sockaddr sa;
++  struct sockaddr_in sin;
++  struct sockaddr_in6 sin6;
++} nntp_sockaddr_union_t;
++
+ #ifdef EXCELAN
+ extern struct sockaddr_in current_peer;
+ #endif
+@@ -60,8 +70,7 @@ host_access(hcanread, hcanpost, hcanxfer
+ {
+ 	int		sockt;
+ 	socklen_t	length;
+-	struct sockaddr	sa;
+-	struct sockaddr_in *sin = (struct sockaddr_in *) &sa;
++	nntp_sockaddr_union_t	su;
+ #ifdef TLI
+ 	struct hostent	*hp;
+ 	int		argcnt = 0;
+@@ -89,10 +98,11 @@ host_access(hcanread, hcanpost, hcanxfer
+ 	*hcanread = *hcanpost = *hcanxfer = 0;
+ 
+ 	sockt = fileno(stdin);
+-	length = sizeof (sa);
++	length = sizeof (su);
++	int sa_len = (su.sa.sa_family == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6);
+ 
+ #ifdef TLI
+-	if (t_getpeername(sockt, &sa, &length) < 0) {
++	if (t_getpeername(sockt, &su.sa, &length) < 0) {
+ 		if (isatty(sockt)) {
+ 			(void) strcpy(hostname, "stdin");
+ 			*hcanread = 1;
+@@ -110,7 +120,7 @@ host_access(hcanread, hcanpost, hcanxfer
+ #ifdef EXCELAN
+ 	if (raddr(current_peer.sin_addr) == NULL) {
+ #else
+-	if (getpeername(sockt, &sa, &length) < 0) {
++	if (getpeername(sockt, &su.sa, &length) < 0) {
+ #endif
+ 		if (isatty(sockt)) {
+ 			(void) strcpy(hostname, "stdin");
+@@ -124,24 +134,35 @@ host_access(hcanread, hcanpost, hcanxfer
+ 		return;
+ 	}
+ #ifdef EXCELAN
+-	else bcopy(&current_peer,&sa,length);
++	else bcopy(&current_peer,&su.sa,length);
+ #endif
+ #endif /* !TLI */
+ 
+-	switch (sa.sa_family) {
++	switch (su.sa.sa_family) {
+ 	case AF_INET:
+-		inet_netnames(sockt, sin, net_name, snet_name, host_name);
++		inet_netnames(sockt, &su.sin, net_name, snet_name, host_name);
+ 		break;
+ 
++	case AF_INET6:
++
++		getnameinfo( (struct sockaddr *) &su.sa, su.sa.sa_len, 
++			     host_name, sizeof(host_name), NULL, 0, 0 );
++		net_name[0] = snet_name[0] = '\0';
++#ifdef SYSLOG
++		syslog(LOG_DEBUG, "IPv6 connect from %s (%ld->%d/%d)",
++			host_name, sizeof(su.sa), length, su.sa.sa_len );
++#endif
++               break;
++
+ #ifdef DECNET
+ 	case AF_DECnet:
+-		dnet_netnames(sockt, &sa, net_name, snet_name, host_name);
++		dnet_netnames(sockt, &su.sa, net_name, snet_name, host_name);
+ 		break;
+ #endif
+ 
+ 	default:
+ #ifdef SYSLOG
+-		syslog(LOG_ERR, "unknown address family %ld", (long)(sa.sa_family));
++		syslog(LOG_ERR, "unknown address family %ld", (long)(su.sa.sa_family));
+ #endif
+ 		return;
+ 	};

Added: head/news/nntp/files/patch-get_tcp_conn.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/news/nntp/files/patch-get_tcp_conn.c	Mon Apr 30 10:23:32 2018	(r468686)
@@ -0,0 +1,67 @@
+--- xmit/get_tcp_conn.c.orig	2018-04-20 08:58:07 UTC
++++ xmit/get_tcp_conn.c
+@@ -33,6 +33,7 @@ static const char * rcsid = "$Id: get_tc
+ #ifndef	NONETDB
+ #include <netdb.h>
+ #endif	/* NONETDB */
++#include <syslog.h>
+ 
+ extern	char	*Pname;
+ #ifndef BSD_44
+@@ -286,6 +287,50 @@ const char	*serv;
+ 	sp.sp_protocol	= (u_short)IPPROTO_TCP;
+ #endif	/* OLDSOCKET */
+ 
++#ifndef PRE_IPv6
++	/* see "man getaddrinfo()" */
++	struct addrinfo hints, *addrs, *ai_p;
++	int r;
++
++	memset( &hints, 0, sizeof(hints) );
++	hints.ai_family = PF_UNSPEC;
++	hints.ai_socktype = SOCK_STREAM;
++	if ( (r = getaddrinfo( host, "nntp", &hints, &addrs )) != 0 )
++	{ 
++	    fprintf( stderr, "getaddrinfo(%s/nntp): %s", host, 
++			gai_strerror(r));
++	    return(NOHOST);
++	}
++	sock=-1;
++	for( ai_p = addrs; ai_p != NULL; ai_p = ai_p->ai_next )
++	{
++	    sock = socket( ai_p->ai_family, ai_p->ai_socktype, 
++                           ai_p->ai_protocol);
++	    if ( sock < 0 ) {continue;}
++	    if ( connect( sock, ai_p->ai_addr, ai_p->ai_addrlen ) < 0 )
++	    {
++		fprintf( stderr, "connect() failed: %s", strerror(errno));
++		close(sock); 
++		sock=-1;
++		continue;
++	    }
++	    if ( ai_p->ai_family == AF_INET6 )
++	    {
++		char addrbuf[100];
++		inet_ntop( ai_p->ai_family, ai_p->ai_addr, 
++                           addrbuf, sizeof(addrbuf) );
++		syslog(LOG_INFO, "IPv6 connect to %s (%s) - yeah!",
++			 host, addrbuf );
++	    }
++	    break;
++	}
++	freeaddrinfo(addrs);
++	if ( sock < 0 ) { return(FAIL); }
++
++	/* TODO: keepalives! */
++	return(sock);
++
++#else /*PRE_IPv6*/
+ 	if ((addrlist = name_to_address(host)) == (struct in_addr **)NULL) {
+ 		return(NOHOST);
+ 	}
+@@ -330,4 +375,5 @@ const char	*serv;
+ 								    }
+ 	}
+ 	return(FAIL);
++#endif /* PRE_IPv6 */
+ }

Added: head/news/nntp/files/patch-netaux.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/news/nntp/files/patch-netaux.c	Mon Apr 30 10:23:32 2018	(r468686)
@@ -0,0 +1,13 @@
+--- server/netaux.c.orig	2018-04-30 06:13:43 UTC
++++ server/netaux.c
+@@ -281,10 +281,4 @@ reaper(int unused)
+ 
+ #else /* !ALONE */
+ 
+-/* Kludge for greenhill's C compiler */
+-
+-static
+-netaux_greenkludge()
+-{
+-}
+ #endif /* not ALONE */

Added: head/news/nntp/files/patch-server-Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/news/nntp/files/patch-server-Makefile	Mon Apr 30 10:23:32 2018	(r468686)
@@ -0,0 +1,11 @@
+--- server/Makefile.orig	1994-12-04 00:18:48 UTC
++++ server/Makefile
+@@ -31,6 +31,8 @@ SRCS	= ${SRVRSRC}
+ 
+ LIBS = $(DBLIBS) $(NETLIBS)
+ 
++CPPFLAGS+= -DALONE
++
+ # Where nntpd is going to live
+ #DESTDIR = /etc
+ 

Modified: head/news/nntp/pkg-plist
==============================================================================
--- head/news/nntp/pkg-plist	Mon Apr 30 09:41:04 2018	(r468685)
+++ head/news/nntp/pkg-plist	Mon Apr 30 10:23:32 2018	(r468686)
@@ -1,6 +1,7 @@
 man/man1/nntpxmit.1.gz
 man/man8/nntpd.8c.gz
 man/man8/acttimes.8c.gz
+libexec/nntpd
 sbin/nntpd
 %%NEWSBIN%%/acttimes
 %%NEWSBIN%%/nntpxmit
@@ -17,5 +18,5 @@ sbin/nntpd
 %%PORTDOCS%%%%DOCSDIR%%/xfer-README
 %%PORTDOCS%%%%DOCSDIR%%/xmit-README
 %%VARBASE%%/%%NEWSCTL%%/overview.fmt
- at dir %%VARBASE%%/%%NEWSCTL%%
- at dir %%VARBASE%%/lib
+ at dir(news,news,755) %%VARBASE%%/%%NEWSCTL%%
+ at dir(news,news,755) %%VARBASE%%/lib


More information about the svn-ports-head mailing list