aboutsummaryrefslogtreecommitdiff
path: root/news
diff options
context:
space:
mode:
authorDirk Meyer <dinoex@FreeBSD.org>2018-04-30 10:23:32 +0000
committerDirk Meyer <dinoex@FreeBSD.org>2018-04-30 10:23:32 +0000
commitb446a1d670459277afaff817be4d2ca79e6da98b (patch)
treec38e67afd248a0bd8f9c64f24627429555927b0b /news
parent4c1ad8033ac85ccf9d441836e44befc5e844e989 (diff)
downloadports-b446a1d670459277afaff817be4d2ca79e6da98b.tar.gz
ports-b446a1d670459277afaff817be4d2ca79e6da98b.zip
- 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.
Notes
Notes: svn path=/head/; revision=468686
Diffstat (limited to 'news')
-rw-r--r--news/nntp/Makefile21
-rw-r--r--news/nntp/files/patch-Makefile12
-rw-r--r--news/nntp/files/patch-access.c100
-rw-r--r--news/nntp/files/patch-get_tcp_conn.c67
-rw-r--r--news/nntp/files/patch-netaux.c13
-rw-r--r--news/nntp/files/patch-server-Makefile11
-rw-r--r--news/nntp/pkg-plist5
7 files changed, 212 insertions, 17 deletions
diff --git a/news/nntp/Makefile b/news/nntp/Makefile
index b9f415129096..b7abe4b2da8b 100644
--- a/news/nntp/Makefile
+++ b/news/nntp/Makefile
@@ -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 -lutil"
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}=" \
diff --git a/news/nntp/files/patch-Makefile b/news/nntp/files/patch-Makefile
index 2bd1e1215b1a..62eb3f6e73c4 100644
--- a/news/nntp/files/patch-Makefile
+++ b/news/nntp/files/patch-Makefile
@@ -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
diff --git a/news/nntp/files/patch-access.c b/news/nntp/files/patch-access.c
new file mode 100644
index 000000000000..a5fa190c5f98
--- /dev/null
+++ b/news/nntp/files/patch-access.c
@@ -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;
+ };
diff --git a/news/nntp/files/patch-get_tcp_conn.c b/news/nntp/files/patch-get_tcp_conn.c
new file mode 100644
index 000000000000..851d79dc5942
--- /dev/null
+++ b/news/nntp/files/patch-get_tcp_conn.c
@@ -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 */
+ }
diff --git a/news/nntp/files/patch-netaux.c b/news/nntp/files/patch-netaux.c
new file mode 100644
index 000000000000..2dea3a1a852f
--- /dev/null
+++ b/news/nntp/files/patch-netaux.c
@@ -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 */
diff --git a/news/nntp/files/patch-server-Makefile b/news/nntp/files/patch-server-Makefile
new file mode 100644
index 000000000000..295685958d0c
--- /dev/null
+++ b/news/nntp/files/patch-server-Makefile
@@ -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
+
diff --git a/news/nntp/pkg-plist b/news/nntp/pkg-plist
index 17d31e7133b3..2ba40d6b24d0 100644
--- a/news/nntp/pkg-plist
+++ b/news/nntp/pkg-plist
@@ -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
-@dir %%VARBASE%%/%%NEWSCTL%%
-@dir %%VARBASE%%/lib
+@dir(news,news,755) %%VARBASE%%/%%NEWSCTL%%
+@dir(news,news,755) %%VARBASE%%/lib