git: d761918ef496 - main - news/nntp: fix build on FreeBSD-14

From: Dirk Meyer <dinoex_at_FreeBSD.org>
Date: Sat, 11 Mar 2023 17:52:27 UTC
The branch main has been updated by dinoex:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d761918ef496389a33b06cc07956e90b0f755f67

commit d761918ef496389a33b06cc07956e90b0f755f67
Author:     Dirk Meyer <dinoex@FreeBSD.org>
AuthorDate: 2023-03-11 17:51:57 +0000
Commit:     Dirk Meyer <dinoex@FreeBSD.org>
CommitDate: 2023-03-11 17:51:57 +0000

    news/nntp: fix build on FreeBSD-14
---
 news/nntp/Makefile                    |   7 +--
 news/nntp/distinfo                    |   6 +-
 news/nntp/files/patch-access.c        | 100 ----------------------------------
 news/nntp/files/patch-get_tcp_conn.c  |  67 -----------------------
 news/nntp/files/patch-netaux.c        |  13 -----
 news/nntp/files/patch-xfer-nntpxfer.c |  18 ------
 6 files changed, 5 insertions(+), 206 deletions(-)

diff --git a/news/nntp/Makefile b/news/nntp/Makefile
index c50c56146490..c4bc72a26abe 100644
--- a/news/nntp/Makefile
+++ b/news/nntp/Makefile
@@ -1,12 +1,12 @@
 PORTNAME=	nntp
 PORTVERSION=	1.5.12.2
-PORTREVISION=	10
+PORTREVISION=	11
 CATEGORIES=	news
 MASTER_SITES=	ftp://ftp.dinoex.org/pub/c-news/
 DISTNAME=	${PORTNAME}.${PORTVERSION}
 
 PATCH_SITES=	ftp://ftp.dinoex.org/pub/c-news/
-PATCHFILES=	nntp-patch-ansi
+PATCHFILES=	nntp-patch-ansi2
 
 MAINTAINER=	dinoex@FreeBSD.org
 COMMENT=	NNTP with NOV support
@@ -42,9 +42,6 @@ post-extract:
 	${CP} ${WRKSRC}/conf.h.dist ${WRKSRC}/conf.h
 
 post-patch:
-	${REINPLACE_CMD} \
-		-e 's=getline(=xmit_getline(=' \
-		${WRKSRC}/xmit/nntpxmit.c
 	${REINPLACE_CMD} \
 		-e 's=reaper()=reaper(int unused)=' \
 		${WRKSRC}/server/netaux.c
diff --git a/news/nntp/distinfo b/news/nntp/distinfo
index 60867f3e5a65..147e2a8790d5 100644
--- a/news/nntp/distinfo
+++ b/news/nntp/distinfo
@@ -1,5 +1,5 @@
-TIMESTAMP = 1479241494
+TIMESTAMP = 1678044879
 SHA256 (nntp.1.5.12.2.tar.gz) = c4b4b6e7aa6abfe06300c1667fc55049b01d9f3a2c6f8714845a1dfd4c33fe46
 SIZE (nntp.1.5.12.2.tar.gz) = 153634
-SHA256 (nntp-patch-ansi) = 7f977465945aa9a051ab91c2e8648968e9f94f16b782e55ccc26b530d523c572
-SIZE (nntp-patch-ansi) = 73091
+SHA256 (nntp-patch-ansi2) = 17fc41009e826986833f7fdde80288fe781b12a19881532e8e7a338fe1e5d980
+SIZE (nntp-patch-ansi2) = 112982
diff --git a/news/nntp/files/patch-access.c b/news/nntp/files/patch-access.c
deleted file mode 100644
index a5fa190c5f98..000000000000
--- a/news/nntp/files/patch-access.c
+++ /dev/null
@@ -1,100 +0,0 @@
---- 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
deleted file mode 100644
index 851d79dc5942..000000000000
--- a/news/nntp/files/patch-get_tcp_conn.c
+++ /dev/null
@@ -1,67 +0,0 @@
---- 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
deleted file mode 100644
index 2dea3a1a852f..000000000000
--- a/news/nntp/files/patch-netaux.c
+++ /dev/null
@@ -1,13 +0,0 @@
---- 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-xfer-nntpxfer.c b/news/nntp/files/patch-xfer-nntpxfer.c
deleted file mode 100644
index 94de45437f4d..000000000000
--- a/news/nntp/files/patch-xfer-nntpxfer.c
+++ /dev/null
@@ -1,18 +0,0 @@
---- xfer/nntpxfer.c.orig	1996-01-09 07:28:03 UTC
-+++ xfer/nntpxfer.c
-@@ -547,12 +556,14 @@ char *articleid;
- 	int len;
- #endif
- 	char id[BUFSIZ];
-+#ifndef CNEWS
- 	char *p;
-+#endif
- 
- 	/* remove any case sensitivity */
- 	(void) strcpy(id, articleid);
--	p = id;
- #ifndef CNEWS
-+	p = id;
- 	while (*p)
- 		{
- 		if (isupper(*p))