git: 8d98ac3e234f - main - net/rdist7: Add new port

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Wed, 20 Mar 2024 03:03:07 UTC
The branch main has been updated by cy:

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

commit 8d98ac3e234f39a63dafbec5771ca2822f673597
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2024-03-20 03:00:09 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2024-03-20 03:02:33 +0000

    net/rdist7: Add new port
    
    Add new rdist7 port packaging rdist 7.0.0-alpha10.
---
 net/Makefile                              |   1 +
 net/rdist7/Makefile                       |  38 +++++++
 net/rdist7/distinfo                       |   3 +
 net/rdist7/files/patch-configure          |  11 ++
 net/rdist7/files/patch-doc_GNUMakefile.in |  11 ++
 net/rdist7/files/patch-include_defs.h     |  36 ++++++
 net/rdist7/files/patch-src_GNUmakefile.in |  14 +++
 net/rdist7/files/patch-src_child.c        |  29 +++++
 net/rdist7/files/patch-src_client.c       |  20 ++++
 net/rdist7/files/patch-src_common.c       |  87 +++++++++++++++
 net/rdist7/files/patch-src_docmd.c        |  56 ++++++++++
 net/rdist7/files/patch-src_filesys-os.c   |  43 +++++++
 net/rdist7/files/patch-src_filesys.c      |  13 +++
 net/rdist7/files/patch-src_gram.y         | 179 ++++++++++++++++++++++++++++++
 net/rdist7/files/patch-src_message.c      |  22 ++++
 net/rdist7/files/patch-src_rdist.c        |  54 +++++++++
 net/rdist7/files/patch-src_rshrcmd.c      |  22 ++++
 net/rdist7/files/patch-src_server.c       | 146 ++++++++++++++++++++++++
 net/rdist7/files/patch-src_setargs.c      |  19 ++++
 net/rdist7/pkg-descr                      |  16 +++
 net/rdist7/pkg-plist                      |  11 ++
 21 files changed, 831 insertions(+)

diff --git a/net/Makefile b/net/Makefile
index eecb6478e8d6..efd6d20a54d4 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -1209,6 +1209,7 @@
     SUBDIR += rdapper
     SUBDIR += rdesktop
     SUBDIR += rdist6
+    SUBDIR += rdist7
     SUBDIR += read_bbrlog
     SUBDIR += realtek-re-kmod
     SUBDIR += realtek-re-kmod198
diff --git a/net/rdist7/Makefile b/net/rdist7/Makefile
new file mode 100644
index 000000000000..f2b7655e0d4d
--- /dev/null
+++ b/net/rdist7/Makefile
@@ -0,0 +1,38 @@
+PORTNAME=	rdist
+PORTVERSION=	7.0.0.a10
+CATEGORIES=	net
+MASTER_SITES=	http://www.magnicomp.com/download/rdist/
+DISTNAME=	${PORTNAME}-${PORTVERSION:S/.a/-alpha/}
+
+MAINTAINER=	cy@FreeBSD.org
+COMMENT=	Network file distribution/synchronisation utility
+WWW=		https://www.magnicomp.com/
+
+LICENSE=	BSD3CLAUSE
+
+CONFLICTS=	rdist6
+
+USES=		gmake
+GNU_CONFIGURE=	yes
+GNU_CONFIGURE_PREFIX=		${STAGEDIR}/${PREFIX}
+GNU_CONFIGURE_MANPREFIX=	${STAGEDIR}/${PREFIX}/share
+
+INSTALL_TARGET=	install install.man
+
+.include <bsd.port.pre.mk>
+
+.if ${OPSYS} == FreeBSD
+RUN_DEPENDS+=	rsh:net/bsdrcmds
+.endif
+
+do-build:
+	@(cd ${WRKSRC} && gmake)
+
+do-install:
+	@(cd ${WRKSRC} && gmake install)
+
+post-install:
+	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/rdist
+	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/rdistd
+
+.include <bsd.port.post.mk>
diff --git a/net/rdist7/distinfo b/net/rdist7/distinfo
new file mode 100644
index 000000000000..523a94c8f6a8
--- /dev/null
+++ b/net/rdist7/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1710891839
+SHA256 (rdist-7.0.0-alpha10.tar.gz) = e4f709506396d5dfb9f5cc6599984cc40ecf8c13bf09b7e87347cf01fd5e0273
+SIZE (rdist-7.0.0-alpha10.tar.gz) = 164027
diff --git a/net/rdist7/files/patch-configure b/net/rdist7/files/patch-configure
new file mode 100644
index 000000000000..4d2e7dbf168c
--- /dev/null
+++ b/net/rdist7/files/patch-configure
@@ -0,0 +1,11 @@
+--- configure.orig	2001-10-23 08:38:00.000000000 -0700
++++ configure	2024-03-19 19:09:52.771040000 -0700
+@@ -883,7 +883,7 @@
+ 
+ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+ 
+-for ac_prog in 'bison -y' byacc
++for ac_prog in byacc
+ do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+ set dummy $ac_prog; ac_word=$2
diff --git a/net/rdist7/files/patch-doc_GNUMakefile.in b/net/rdist7/files/patch-doc_GNUMakefile.in
new file mode 100644
index 000000000000..38c3c1afb160
--- /dev/null
+++ b/net/rdist7/files/patch-doc_GNUMakefile.in
@@ -0,0 +1,11 @@
+--- doc/GNUmakefile.in.orig	2001-10-23 08:42:31.000000000 -0700
++++ doc/GNUmakefile.in	2024-03-19 19:21:04.474265000 -0700
+@@ -48,7 +48,7 @@
+ 
+ CLIENT_DEST 	= ${MAN_1_DIR}/${CLIENT}.${MAN_1_SECT}
+ SERVER_DEST 	= ${MAN_8_DIR}/${SERVER}.${MAN_8_SECT}
+-INSTALL_ARGS	= -o ${MAN_OWNER} -g ${MAN_GROUP} -m ${MAN_MODE} 
++INSTALL_ARGS	= -m ${MAN_MODE} 
+ 
+ MANHTMLFILES	= $(srcdir)/rdist.html \
+ 		$(srcdir)/rdistd.html
diff --git a/net/rdist7/files/patch-include_defs.h b/net/rdist7/files/patch-include_defs.h
new file mode 100644
index 000000000000..cc573003f8b6
--- /dev/null
+++ b/net/rdist7/files/patch-include_defs.h
@@ -0,0 +1,36 @@
+--- include/defs.h.orig	2001-10-22 13:21:36.000000000 -0700
++++ include/defs.h	2024-03-19 16:57:51.903085000 -0700
+@@ -53,6 +53,7 @@
+ #if defined(HAVE_STDLIB_H)
+ # include <stdlib.h>
+ #endif
++#include <libgen.h>
+ #include <stdio.h>
+ #include <ctype.h>
+ #include <errno.h>
+@@ -333,7 +334,6 @@
+ extern void			complain();
+ extern void			docmds();
+ extern void			finish();
+-extern void			log();
+ extern void			logmsg();
+ extern void			lostconn();
+ extern void			markassigned();
+@@ -342,7 +342,6 @@
+ extern void			runcmdspecial();
+ extern void			runcommand();
+ extern void			server();
+-extern void			setprogname();
+ extern void			sighandler();
+ extern void			waitup();
+ struct namelist		       *expand();
+@@ -355,7 +354,9 @@
+ extern void			error(char *, ...);
+ extern void			fatalerr(char *, ...);
+ extern void			message(int, char *, ...);
++#ifndef HAVE_SETPROCTITLE
+ extern void			setproctitle(const char *fmt, ...);
++#endif
+ #else
+ extern void			debugmsg();
+ extern void			error();
diff --git a/net/rdist7/files/patch-src_GNUmakefile.in b/net/rdist7/files/patch-src_GNUmakefile.in
new file mode 100644
index 000000000000..a4dcc63fb216
--- /dev/null
+++ b/net/rdist7/files/patch-src_GNUmakefile.in
@@ -0,0 +1,14 @@
+--- src/GNUmakefile.in.orig	2001-10-22 13:33:21.000000000 -0700
++++ src/GNUmakefile.in	2024-03-19 19:28:08.171296000 -0700
+@@ -99,9 +99,9 @@
+ install.files:
+ 	@$(MKDIRHIER) $(BIN_DIR)
+ 	@$(MKDIRHIER) $(BIN_SDIR)
+-	$(INSTALL) -o $(BIN_OWNER) -g $(BIN_GROUP) -m ${RDIST_MODE} \
++	$(INSTALL) -m ${RDIST_MODE} \
+ 		$(CLIENT_BIN) $(BIN_DIR)/$(CLIENT)
+-	$(INSTALL) -o ${BIN_OWNER} -g $(BIN_GROUP) -m ${RDISTD_MODE} \
++	$(INSTALL) -m ${RDISTD_MODE} \
+ 		$(SERVER_BIN) $(SBIN_DIR)/$(SERVER)
+ 
+ #
diff --git a/net/rdist7/files/patch-src_child.c b/net/rdist7/files/patch-src_child.c
new file mode 100644
index 000000000000..14b5a9ad3713
--- /dev/null
+++ b/net/rdist7/files/patch-src_child.c
@@ -0,0 +1,29 @@
+--- src/child.c.orig	1998-11-10 04:18:57 UTC
++++ src/child.c
+@@ -189,7 +189,7 @@ static void readchild(child)
+ 	CHILD *child;
+ {
+ 	char rbuf[BUFSIZ];
+-	int amt;
++	ssize_t amt;
+ 
+ 	debugmsg(DM_CALL, "[readchild(%s, %d, %d) start]", 
+ 		 child->c_name, child->c_pid, child->c_readfd);
+@@ -208,7 +208,7 @@ static void readchild(child)
+ 	 */
+ 	while ((amt = read(child->c_readfd, rbuf, sizeof(rbuf))) > 0) {
+ 		/* XXX remove these debug calls */
+-		debugmsg(DM_MISC, "[readchild(%s, %d, %d) got %d bytes]", 
++		debugmsg(DM_MISC, "[readchild(%s, %d, %d) got %lld bytes]", 
+ 			 child->c_name, child->c_pid, child->c_readfd, amt);
+ 
+ 		(void) xwrite(fileno(stdout), rbuf, amt);
+@@ -217,7 +217,7 @@ static void readchild(child)
+ 			 child->c_name, child->c_pid, child->c_readfd);
+ 	}
+ 
+-	debugmsg(DM_MISC, "readchild(%s, %d, %d) done: amt = %d errno = %d\n",
++	debugmsg(DM_MISC, "readchild(%s, %d, %d) done: amt = %lld errno = %d\n",
+ 		 child->c_name, child->c_pid, child->c_readfd, amt, errno);
+ 
+ 	/* 
diff --git a/net/rdist7/files/patch-src_client.c b/net/rdist7/files/patch-src_client.c
new file mode 100644
index 000000000000..33ed05ceb546
--- /dev/null
+++ b/net/rdist7/files/patch-src_client.c
@@ -0,0 +1,20 @@
+--- src/client.c.orig	2001-10-22 13:29:21.000000000 -0700
++++ src/client.c	2024-03-19 17:05:24.956590000 -0700
+@@ -1009,7 +1009,7 @@
+ 	/*
+ 	 * Parse size
+ 	 */
+-	size = (off_t) strtol((const char *)cp, (char **)&cp, 10);
++	size = (off_t) strtoll((const char *)cp, (char **)&cp, 10);
+ 	if (*cp++ != ' ') {
+ 		error("update: size not delimited");
+ 		return(US_NOTHING);
+@@ -1018,7 +1018,7 @@
+ 	/*
+ 	 * Parse mtime
+ 	 */
+-	mtime = strtol((const char *)cp, (char **)&cp, 10);
++	mtime = strtoll((const char *)cp, (char **)&cp, 10);
+ 	if (*cp++ != ' ') {
+ 		error("update: mtime not delimited");
+ 		return(US_NOTHING);
diff --git a/net/rdist7/files/patch-src_common.c b/net/rdist7/files/patch-src_common.c
new file mode 100644
index 000000000000..f22daf09ba55
--- /dev/null
+++ b/net/rdist7/files/patch-src_common.c
@@ -0,0 +1,87 @@
+--- src/common.c.orig	1998-11-10 04:09:01 UTC
++++ src/common.c
+@@ -108,21 +108,6 @@ extern WRITE_RETURN_T xwrite(fd, buf, len)
+ }
+ 
+ /*
+- * Set program name
+- */
+-extern void setprogname(argv)
+-	char **argv;
+-{
+-	register char *cp;
+-
+-	if (!progname) {
+-		progname = strdup(argv[0]);
+-		if (cp = strrchr(progname, '/'))
+-			progname = cp + 1;
+-	}
+-}
+-
+-/*
+  * Do run-time initialization
+  */
+ extern int init(argc, argv, envp)
+@@ -137,7 +122,8 @@ extern int init(argc, argv, envp)
+ 	if (!isserver)
+ 		(void) signal(SIGSEGV, sighandler);
+ 
+-	setprogname(argv);
++	if (progname == NULL)
++		progname = basename(argv[0]);
+ 
+ 	/*
+ 	 * Save a copy of our argc and argv before setargs() overwrites them
+@@ -393,14 +379,14 @@ extern int sendcmd(cmd, fmt, a1, a2, a3, a4, a5, a6, a
+  */
+ static u_char rembuf[BUFSIZ];
+ static u_char *remptr;
+-static int remleft;
++static ssize_t remleft;
+ 
+ #define remc() (--remleft < 0 ? remmore() : *remptr++)
+ 
+ /*
+  * Back end to remote read()
+  */
+-static int remread(fd, buf, bufsiz)
++static ssize_t remread(fd, buf, bufsiz)
+ 	int fd;
+ 	u_char *buf;
+ 	int bufsiz;
+@@ -494,7 +480,7 @@ extern int remline(buffer, space, doclean)
+ /*
+  * Non-line-oriented remote read.
+  */
+-readrem(p, space)
++ssize_t readrem(p, space)
+ 	char *p;
+ 	register int space;
+ {
+@@ -892,7 +878,7 @@ char *xmalloc(amt)
+ 	extern POINTER *malloc();
+ 
+ 	if ((ptr = (char *)malloc(amt)) == NULL)
+-		fatalerr("Cannot malloc %d bytes of memory.", amt);
++		fatalerr("Cannot malloc %zu bytes of memory.", amt);
+ 
+ 	return(ptr);
+ }
+@@ -908,7 +894,7 @@ char *xrealloc(baseptr, amt)
+ 	extern POINTER *realloc();
+ 
+ 	if ((new = (char *)realloc(baseptr, amt)) == NULL)
+-		fatalerr("Cannot realloc %d bytes of memory.", amt);
++		fatalerr("Cannot realloc %zu bytes of memory.", amt);
+ 
+ 	return(new);
+ }
+@@ -924,7 +910,7 @@ char *xcalloc(num, esize)
+ 	extern POINTER *calloc();
+ 
+ 	if ((ptr = (char *)calloc(num, esize)) == NULL)
+-		fatalerr("Cannot calloc %d * %d = %d bytes of memory.",
++		fatalerr("Cannot calloc %zu * %zu = %zu bytes of memory.",
+ 		      num, esize, num * esize);
+ 
+ 	return(ptr);
diff --git a/net/rdist7/files/patch-src_docmd.c b/net/rdist7/files/patch-src_docmd.c
new file mode 100644
index 000000000000..9d77381d9941
--- /dev/null
+++ b/net/rdist7/files/patch-src_docmd.c
@@ -0,0 +1,56 @@
+--- src/docmd.c.orig	2001-10-22 13:29:22.000000000 -0700
++++ src/docmd.c	2024-03-19 17:06:30.415295000 -0700
+@@ -132,7 +132,8 @@
+ 	register struct namelist *to;
+ 	time_t lmod;
+ {
+-	register int fd, len;
++	register int fd;
++	ssize_t len;
+ 	FILE *pf, *popen();
+ 	struct stat stb;
+ 	static char buf[BUFSIZ];
+@@ -300,9 +301,7 @@
+ 	char *cmd;
+ {
+ 	int desc;
+-#if	defined(DIRECT_RCMD)
+ 	static int port = -1;
+-#endif	/* DIRECT_RCMD */
+ 
+ 	debugmsg(DM_MISC, "local user = %s remote user = %s\n", luser, ruser);
+ 	debugmsg(DM_MISC, "Remote command = '%s'\n", cmd);
+@@ -350,7 +349,7 @@
+ 	register char *ruser, *cp;
+ 	static char *cur_host = NULL;
+ 	extern char *locuser;
+-	extern long min_freefiles, min_freespace;
++	extern int64_t min_freefiles, min_freespace;
+ 	extern char *remotemsglist;
+ 	char tuser[BUFSIZ], buf[BUFSIZ];
+ 	u_char respbuff[BUFSIZ];
+@@ -445,13 +444,13 @@
+ 			return(0);
+ 	}
+ 	if (min_freespace) {
+-		(void) sendcmd(C_SETCONFIG, "%c%d", SC_FREESPACE, 
++		(void) sendcmd(C_SETCONFIG, "%c%lld", SC_FREESPACE, 
+ 			       min_freespace);
+ 		if (response() < 0)
+ 			return(0);
+ 	}
+ 	if (min_freefiles) {
+-		(void) sendcmd(C_SETCONFIG, "%c%d", SC_FREEFILES, 
++		(void) sendcmd(C_SETCONFIG, "%c%lld", SC_FREEFILES, 
+ 			       min_freefiles);
+ 		if (response() < 0)
+ 			return(0);
+@@ -663,7 +662,7 @@
+ 		c = *cp;
+ 		if (c & 0200)
+ 			isbad = TRUE;
+-		if (!isalpha(c) && !isdigit(c) && c != '_' && c != '-')
++		if (!isalpha(c) && !isdigit(c) && c != '_' && c != '-' && c != '.' )
+ 			isbad = TRUE;
+ 	}
+ 
diff --git a/net/rdist7/files/patch-src_filesys-os.c b/net/rdist7/files/patch-src_filesys-os.c
new file mode 100644
index 000000000000..0d754facb41a
--- /dev/null
+++ b/net/rdist7/files/patch-src_filesys-os.c
@@ -0,0 +1,43 @@
+--- src/filesys-os.c.orig	2001-10-22 13:29:22.000000000 -0700
++++ src/filesys-os.c	2024-03-19 19:48:24.454801000 -0700
+@@ -144,6 +144,7 @@
+ 		mntstruct.me_flags |= MEFLAG_READONLY;
+ 
+ 	mntstruct.me_path = vmt2dataptr(mnt, VMT_STUB);
++#ifdef MNT_NFS
+ 	switch ((ulong)(struct vmount*)mnt->vmt_gfstype) {
+ 	      case MNT_NFS:
+ 		mntstruct.me_type = METYPE_NFS;
+@@ -152,6 +153,16 @@
+ 		mntstruct.me_type = METYPE_OTHER;
+ 		break;
+ 	}
++#else
++	if ((((struct statfs*)mnt)->f_flags & MNT_LOCAL) == 0) {
++		(void) sprintf(remote_dev, "%s", mnt->f_mntfromname);
++		mntstruct.me_path = remote_dev;
++		mntstruct.me_type = METYPE_NFS;
++	} else {
++		mntstruct.me_path = mnt->f_mntonname;
++		mntstruct.me_type = METYPE_OTHER;
++	}
++#endif
+ 
+ 	mnt = (struct vmount*)((mnt->vmt_length)+(ulong)mnt);
+ 	entries_left--;
+@@ -244,6 +255,7 @@
+ 	    }
+ 	}
+ #endif /* FMT_TYPE == FMT_STATFS_STR */
++#ifdef MOUNT_NFS
+ #if	FMT_TYPE == FMT_STATFS_STR && !defined(HAVE_GETVFSBYNAME)
+ 	if (strcmp(mnt->f_fstypename, MOUNT_NFS) == 0) {
+ 		(void) snprintf(remote_dev, sizeof(remote_dev), "%s",
+@@ -270,6 +282,7 @@
+ 		break;
+ 	}
+ #endif	/* FMT_TYPE == FMT_STATFS_STR */
++#endif
+ 
+ 	mnt = (struct statfs*)(sizeof(struct statfs)+(ulong)mnt);
+ 	entries_left--;
diff --git a/net/rdist7/files/patch-src_filesys.c b/net/rdist7/files/patch-src_filesys.c
new file mode 100644
index 000000000000..8754f236f8cb
--- /dev/null
+++ b/net/rdist7/files/patch-src_filesys.c
@@ -0,0 +1,13 @@
+--- src/filesys.c.orig	1998-11-10 04:10:18 UTC
++++ src/filesys.c
+@@ -430,8 +430,8 @@ int is_symlinked(path, statbuf, isvalid)
+  */
+ int getfilesysinfo(file, freespace, freefiles)
+ 	char *file;
+-	long *freespace;
+-	long *freefiles;
++	int64_t *freespace;
++	int64_t *freefiles;
+ {
+ #if	defined(STATFS_TYPE)
+ 	static statfs_t statfsbuf;
diff --git a/net/rdist7/files/patch-src_gram.y b/net/rdist7/files/patch-src_gram.y
new file mode 100644
index 000000000000..dd323eaa7b62
--- /dev/null
+++ b/net/rdist7/files/patch-src_gram.y
@@ -0,0 +1,179 @@
+--- src/gram.y.orig	1998-11-10 04:10:42 UTC
++++ src/gram.y
+@@ -61,6 +61,13 @@ static char copyright[] =
+ 
+ #include "defs.h"
+ 
++#define	yylex	rdist_yylex
++
++static char * xappend(char *str, size_t *len, char c);
++void yyerror(const char *message);
++static char *yytext;
++static size_t yytextlen;
++
+ static struct namelist *addnl(), *subnl(), *andnl();
+ struct	cmd *cmds = NULL;
+ struct	cmd *last_cmd;
+@@ -240,12 +247,14 @@ opt_namelist:	  /* VOID */ = {
+ int	yylineno = 1;
+ extern	FILE *fin;
+ 
++static int
+ yylex()
+ {
+-	static char yytext[INMAX];
+ 	register int c;
+-	register char *cp1, *cp2;
+ 	static char quotechars[] = "[]{}*?$";
++
++	yytext = NULL;
++	yytextlen = 0;
+ 	
+ again:
+ 	switch (c = getc(fin)) {
+@@ -285,19 +294,13 @@ again:
+ 		break;
+ 
+ 	case '"':  /* STRING */
+-		cp1 = yytext;
+-		cp2 = &yytext[INMAX - 1];
+ 		for (;;) {
+-			if (cp1 >= cp2) {
+-				yyerror("command string too long\n");
+-				break;
+-			}
+ 			c = getc(fin);
+ 			if (c == EOF || c == '"')
+ 				break;
+ 			if (c == '\\') {
+ 				if ((c = getc(fin)) == EOF) {
+-					*cp1++ = '\\';
++					yytext = xappend(yytext, &yytextlen, '\\');
+ 					break;
+ 				}
+ 			}
+@@ -305,12 +308,11 @@ again:
+ 				yylineno++;
+ 				c = ' '; /* can't send '\n' */
+ 			}
+-			*cp1++ = c;
++			yytext = xappend(yytext, &yytextlen, c);
+ 		}
+ 		if (c != '"')
+ 			yyerror("missing closing '\"'\n");
+-		*cp1 = '\0';
+-		yylval.string = makestr(yytext);
++		yylval.string = xappend(yytext, &yytextlen, '\0');
+ 		return(STRING);
+ 
+ 	case ':':  /* : or :: */
+@@ -319,35 +321,34 @@ again:
+ 		(void) ungetc(c, fin);
+ 		return(COLON);
+ 	}
+-	cp1 = yytext;
+-	cp2 = &yytext[INMAX - 1];
+ 	for (;;) {
+-		if (cp1 >= cp2) {
+-			yyerror("input line too long\n");
+-			break;
+-		}
+ 		if (c == '\\') {
+ 			if ((c = getc(fin)) != EOF) {
+ 				if (any(c, quotechars))
+-					*cp1++ = QUOTECHAR;
++					yytext = xappend(yytext, &yytextlen,
++					    QUOTECHAR);
+ 			} else {
+-				*cp1++ = '\\';
++				yytext = xappend(yytext, &yytextlen, '\\');
+ 				break;
+ 			}
+ 		}
+-		*cp1++ = c;
++		yytext = xappend(yytext, &yytextlen, c);
+ 		c = getc(fin);
+ 		if (c == EOF || any(c, " \"'\t()=;:\n")) {
+ 			(void) ungetc(c, fin);
+ 			break;
+ 		}
+ 	}
+-	*cp1 = '\0';
+-	if (yytext[0] == '-' && yytext[1] == CNULL) 
++	if (yytext == NULL) {
++		yylval.string = NULL;
++		return(NAME);
++	}
++	yytext = xappend(yytext, &yytextlen, '\0');
++	if (yytextlen == 2 && yytext[0] == '-') 
+ 		return '-';
+ 	if (yytext[0] == '-' && parendepth <= 0) {
+ 		opt_t opt = 0;
+-		static char ebuf[BUFSIZ];
++		char ebuf[BUFSIZ];
+ 
+ 		switch (yytext[1]) {
+ 		case 'o':
+@@ -397,7 +398,7 @@ again:
+ 	else if (!strcmp(yytext, "cmdspecial"))
+ 		c = CMDSPECIAL;
+ 	else {
+-		yylval.string = makestr(yytext);
++		yylval.string = yytext;
+ 		return(NAME);
+ 	}
+ 	yylval.subcmd = makesubcmd(c);
+@@ -421,6 +422,7 @@ extern int any(c, str)
+ /*
+  * Insert or append ARROW command to list of hosts to be updated.
+  */
++void
+ insert(label, files, hosts, subcmds)
+ 	char *label;
+ 	struct namelist *files, *hosts;
+@@ -475,6 +477,7 @@ insert(label, files, hosts, subcmds)
+  * Append DCOLON command to the end of the command list since these are always
+  * executed in the order they appear in the distfile.
+  */
++static void
+ append(label, files, stamp, subcmds)
+ 	char *label;
+ 	struct namelist *files;
+@@ -501,24 +504,30 @@ append(label, files, stamp, subcmds)
+ /*
+  * Error printing routine in parser.
+  */
++void
+ yyerror(s)
+-	char *s;
++	const char *s;
+ {
+-	error("Error in distfile: line %d: %s", yylineno, s);
++	error("Error in distfile: line %d: %s (offending text: %.*s%s)",
++	    yylineno, s, 11, yytextlen > 0 ? yytext : "<empty>",
++	    yytextlen > 11 ? " ..." : "");
+ }
+ 
+ /*
+- * Return a copy of the string.
++ * Append character to a string of given length. Return
++ * the new string, which -- depending on realloc -- may
++ * or may not have the same address now.
+  */
+-char *
+-makestr(str)
+-	char *str;
++static char *
++xappend(char *str, size_t *len, char c)
+ {
+ 	char *cp;
+ 
+-	cp = strdup(str);
++	cp = realloc(str, *len + 1);
+ 	if (cp == NULL)
+ 		fatalerr("ran out of memory");
++	cp[*len] = c;
++	(*len)++;
+ 
+ 	return(cp);
+ }
diff --git a/net/rdist7/files/patch-src_message.c b/net/rdist7/files/patch-src_message.c
new file mode 100644
index 000000000000..cc9fdc8f4158
--- /dev/null
+++ b/net/rdist7/files/patch-src_message.c
@@ -0,0 +1,22 @@
+--- src/message.c.orig	2001-10-22 13:29:22.000000000 -0700
++++ src/message.c	2024-03-19 17:13:40.618837000 -0700
+@@ -490,9 +490,8 @@
+ 		return;
+ 
+ 	if (!msgfac->mf_fptr) {
+-		register char *cp;
++		const char *cp;
+ 		size_t len;
+-		char *getenv();
+ 		int fd;
+ 
+ 		/*
+@@ -546,7 +545,7 @@
+  */
+ static void _message(flags, msgbuf)
+ 	int flags;
+-	char *msgbuf;
++	const char *msgbuf;
+ {
+ 	register int i, x;
+ 	register char *cp;
diff --git a/net/rdist7/files/patch-src_rdist.c b/net/rdist7/files/patch-src_rdist.c
new file mode 100644
index 000000000000..688ceff3b30d
--- /dev/null
+++ b/net/rdist7/files/patch-src_rdist.c
@@ -0,0 +1,54 @@
+--- src/rdist.c.orig	2001-10-22 13:29:22.000000000 -0700
++++ src/rdist.c	2024-03-19 17:15:49.254435000 -0700
+@@ -88,8 +88,8 @@
+ char   	       *distfile = NULL;		/* Name of distfile to use */
+ int     	maxchildren = MAXCHILDREN;	/* Max no of concurrent PIDs */
+ int		nflag = 0;			/* Say without doing */
+-long		min_freespace = 0;		/* Min filesys free space */
+-long		min_freefiles = 0;		/* Min filesys free # files */
++int64_t		min_freespace = 0;		/* Min filesys free space */
++int64_t		min_freefiles = 0;		/* Min filesys free # files */
+ FILE   	       *fin = NULL;			/* Input file pointer */
+ char		localmsglist[] = "stdout=all:notify=all:syslog=nerror,ferror";
+ char   	       *remotemsglist = NULL;
+@@ -132,13 +132,13 @@
+ 	register char *cp;
+ 	int cmdargs = 0;
+ 	int c;
+-	char *getenv();
++	const char *errstr;
+ 
+ 	/*
+ 	 * We initialize progname here instead of init() because
+ 	 * things in msgparseopts() need progname set.
+ 	 */
+-	setprogname(argv);
++	progname = basename(argv[0]);
+ 
+ 	if (cp = msgparseopts(localmsglist, TRUE)) {
+ 		error("Bad builtin log option (%s): %s.", 
+@@ -209,10 +209,20 @@
+ 				error("\"%s\" is not a number.", optarg);
+ 				usage();
+ 			}
+-			if (c == 'a')
+-				min_freespace = atoi(optarg);
+-			else if (c == 'A')
+-				min_freefiles = atoi(optarg);
++			if (c == 'a') {
++				min_freespace = (int64_t)strtonum(optarg,
++					0, LLONG_MAX, &errstr);
++				if (errstr)
++					fatalerr("Minimum free space is %s: "
++						 "'%s'", errstr, optarg);
++			}
++			else if (c == 'A') {
++				min_freefiles = (int64_t)strtonum(optarg,
++					0, LLONG_MAX, &errstr);
++				if (errstr)
++					fatalerr("Minimum free files is %s: "
++						 "'%s'", errstr, optarg);
++			}
+ 			else if (c == 'M')
+ 				maxchildren = atoi(optarg);
+ 			else if (c == 't')
diff --git a/net/rdist7/files/patch-src_rshrcmd.c b/net/rdist7/files/patch-src_rshrcmd.c
new file mode 100644
index 000000000000..5f935e8b645f
--- /dev/null
+++ b/net/rdist7/files/patch-src_rshrcmd.c
@@ -0,0 +1,22 @@
+--- src/rshrcmd.c.orig	1998-11-10 04:15:07 UTC
++++ src/rshrcmd.c
+@@ -41,19 +41,11 @@ rshrcmd(ahost, port, luser, ruser, cmd, fd2p)
+ 	int	*fd2p;
+ {
+ 	int             cpid;
+-	struct hostent  *hp;
+ 	int             sp[2];
+ 
+ 	/* insure that we are indeed being used as we thought. */
+ 	if (fd2p != 0)
+ 		return -1;
+-	/* validate remote hostname. */
+-	hp = gethostbyname(*ahost);
+-	if (hp == 0) {
+-		error("%s: unknown host", *ahost);
+-		return -1;
+-	}
+-	/* *ahost = hp->h_name;*/ /* This makes me nervous. */
+ 
+ 	/* get a socketpair we'll use for stdin and stdout. */
+ 	if (getsocketpair(AF_UNIX, SOCK_STREAM, 0, sp) < 0) {
diff --git a/net/rdist7/files/patch-src_server.c b/net/rdist7/files/patch-src_server.c
new file mode 100644
index 000000000000..844489a47f8c
--- /dev/null
+++ b/net/rdist7/files/patch-src_server.c
@@ -0,0 +1,146 @@
+--- src/server.c.orig	2001-10-22 13:29:22.000000000 -0700
++++ src/server.c	2024-03-19 19:42:42.143575000 -0700
+@@ -91,8 +91,8 @@
+ int	catname = 0;		/* cat name to target name */
+ char	*sptarget[128];		/* stack of saved ptarget's for directories */
+ char   *fromhost = NULL;	/* Client hostname */
+-static long min_freespace = 0;	/* Minimium free space on a filesystem */
+-static long min_freefiles = 0;	/* Minimium free # files on a filesystem */
++static int64_t min_freespace = 0; /* Minimium free space on a filesystem */
++static int64_t min_freefiles = 0; /* Minimium free # files on a filesystem */
+ int	oumask;			/* Old umask */
+ 
+ /*
+@@ -172,7 +172,7 @@
+ /*
+  * Set mode of a file
+  */
+-static int setmode(file, fd, mode, link)
++static int rdist_setmode(file, fd, mode, link)
+ 	char *file;
+ 	int fd;
+ 	int mode;
+@@ -355,7 +355,7 @@
+ 			mode &= ~S_ISGID;
+ 		}
+ 	}
+-	(void) setmode(file, fd, mode, S_ISLNK(st.st_mode));
++	(void) rdist_setmode(file, fd, mode, S_ISLNK(st.st_mode));
+ 
+ 	return(0);
+ }
+@@ -921,13 +921,13 @@
+ 	wrerr = 0;
+ 	olderrno = 0;
+ 	for (i = 0; i < size; i += BUFSIZ) {
+-		int amt = BUFSIZ;
++		off_t amt = BUFSIZ;
+ 
+ 		cp = buf;
+ 		if (i + amt > size)
+ 			amt = size - i;
+ 		do {
+-			int j;
++			ssize_t j;
+ 
+ 			if (rem_rz)
+ 			    j = readremz(cp, amt);
+@@ -1538,6 +1538,7 @@
+ {
+ 	register char *cp = cmd;
+ 	char *estr;
++	const char *errstr;
+ 
+ 	switch (*cp++) {
+ 	case SC_HOSTNAME:	/* Set hostname */
+@@ -1554,19 +1555,15 @@
+ 		break;
+ 
+ 	case SC_FREESPACE: 	/* Minimium free space */
+-		if (!isdigit(*cp)) {
+-			fatalerr("Expected digit, got '%s'.", cp);
+-			return;
+-		}
+-		min_freespace = (unsigned long) atoi(cp);
++		min_freespace = (int64_t)strtonum(cp, 0, LLONG_MAX, &errstr);
++		if (errstr)
++			fatalerr("Minimum free space is %s: '%s'", errstr, optarg);
+ 		break;
+ 
+ 	case SC_FREEFILES: 	/* Minimium free files */
+-		if (!isdigit(*cp)) {
+-			fatalerr("Expected digit, got '%s'.", cp);
+-			return;
+-		}
+-		min_freefiles = (unsigned long) atoi(cp);
++		min_freefiles = (int64_t)strtonum(cp, 0, LLONG_MAX, &errstr);
++		if (errstr)
++			fatalerr("Minimum free files is %s: '%s'", errstr, optarg);
+ 		break;
+ 
+ 	case SC_LOGGING:	/* Logging options */
+@@ -1608,7 +1605,7 @@
+ 	char new[MAXPATHLEN];
+ 	int newfd = -1;
+ 	char fileb[MAXPATHLEN];
+-	long freespace = -1, freefiles = -1;
++	int64_t freespace = -1, freefiles = -1;
+ 	char *cp = cmd;
+ 	char *name;
+ 
+@@ -1633,7 +1630,7 @@
+ 	/*
+ 	 * Get file size
+ 	 */
+-	size = strtol(cp, &cp, 10);
++	size = (off_t) strtoll(cp, &cp, 10);
+ 	if (*cp++ != ' ') {
+ 		error("recvit: size not delimited");
+ 		return;
+@@ -1642,7 +1639,7 @@
+ 	/*
+ 	 * Get modification time
+ 	 */
+-	mtime = strtol(cp, &cp, 10);
++	mtime = (time_t) strtol(cp, &cp, 10);
+ 	if (*cp++ != ' ') {
+ 		error("recvit: mtime not delimited");
+ 		return;
+@@ -1692,8 +1689,8 @@
+ 	file = fileb;
+ 
+ 	debugmsg(DM_MISC,
+-		 "recvit: opts = %04o mode = %04o size = %d mtime = %d",
+-		 opts, mode, size, mtime);
++		 "recvit: opts = %04o mode = %04o size = %lld mtime = %d",
++		 opts, mode, (long long) size, mtime);
+ 	debugmsg(DM_MISC,
+        "recvit: owner = '%s' group = '%s' file = '%s' catname = %d isdir = %d",
+ 		 owner, group, file, catname, (type == S_IFDIR) ? 1 : 0);
+@@ -1749,7 +1746,7 @@
+ 	 */
+ 	if (min_freespace || min_freefiles) {
+ 		/* Convert file size to kilobytes */
+-		long fsize = (long) (size / 1024);
++		int64_t fsize = (int64_t)size / 1024;
+ 
+ 		if (getfilesysinfo(target, &freespace, &freefiles) != 0) {
+ 		    	(void) close(newfd);
+@@ -1764,7 +1761,7 @@
+ 		if (min_freespace && (freespace >= 0) && 
+ 		    (freespace - fsize < min_freespace)) {
+ 			error(
+-		     "%s: Not enough free space on filesystem: min %d free %d",
++		     "%s: Not enough free space on filesystem: min %lld free %lld",
+ 			      target, min_freespace, freespace);
+ 		    	(void) close(newfd);
+ 		    	(void) unlink(new);
+@@ -1773,7 +1770,7 @@
+ 		if (min_freefiles && (freefiles >= 0) &&
+ 		    (freefiles - 1 < min_freefiles)) {
+ 			error(
+-		     "%s: Not enough free files on filesystem: min %d free %d",
++		     "%s: Not enough free files on filesystem: min %lld free %lld",
+ 			      target, min_freefiles, freefiles);
+ 		    	(void) close(newfd);
+ 		    	(void) unlink(new);
diff --git a/net/rdist7/files/patch-src_setargs.c b/net/rdist7/files/patch-src_setargs.c
new file mode 100644
index 000000000000..3f6ffbc75eae
--- /dev/null
+++ b/net/rdist7/files/patch-src_setargs.c
@@ -0,0 +1,19 @@
+--- src/setargs.c.orig	1998-11-10 04:15:56 UTC
++++ src/setargs.c
+@@ -89,6 +89,8 @@ setargs_settup(argc, argv, envp)
+ 		LastArgv = argv[argc-1] + strlen(argv[argc-1]);
+ }
+ 
++#ifndef HAVE_SETPROCTITLE
++
+ /*
+  * Set process title
+  */
+@@ -165,5 +167,7 @@ extern void setproctitle(fmt, a1, a2, a3, a4, a5, a6)
+ 	_setproctitle(buf);
+ }
+ #endif	/* !ARG_TYPE */
++
++#endif /* !HAVE_SETPROCTITLE */
+ 
+ #endif 	/* SETARGS */
diff --git a/net/rdist7/pkg-descr b/net/rdist7/pkg-descr
new file mode 100644
index 000000000000..3c6d3fafd802
--- /dev/null
+++ b/net/rdist7/pkg-descr
@@ -0,0 +1,16 @@
+This is version 6.1 of Rdist from USC.  It is based on rdist from
+4.3BSD (classic).  It includes all fixes for all bugs known to the
+CSRG Berkeley folks.  It has been running at USC and numerous other
+sites for some time now on a wide variety of platforms.
+
+This version of rdist is not directly compatible with rdist
+distributed with 4.3BSD and subsequent vendor releases, but does
+indirectly provide full backward compatibility.
+
+This version of rdist does not need to be setuid "root" at all.  Rdist
+now uses the rsh(1c) [remote command] program to make connections to
+remote hosts, instead of making the connection directly.  This
+eliminates the need to be run as "root".  Many thanks to Chris
+Siebenmann <cks@utcc.utoronto.ca> and John DiMarco
+<jdd@cdf.toronto.edu> who came up with an rsh version of rcmd() that
+makes this possible.
diff --git a/net/rdist7/pkg-plist b/net/rdist7/pkg-plist
new file mode 100644
index 000000000000..c3655110db9b
--- /dev/null
+++ b/net/rdist7/pkg-plist
*** 12 LINES SKIPPED ***