From f6a904c04ff55bf6effce9a17b29cc40c9ff1f19 Mon Sep 17 00:00:00 2001
From: Edwin Groothuis <edwin@FreeBSD.org>
Date: Sat, 3 Jan 2004 07:28:00 +0000
Subject: New port: ftp/tnftpd (obsoletes ftp/lukemftpd)

	tnftpd (formerly known as lukemftpd) is a port of the
	enhanced NetBSD ftp server to other systems

PR:		ports/55229
Submitted by:	Alex Vasylenko <lxv@send-pr.sink.omut.org>
---
 ftp/tnftpd/Makefile                  | 74 ++++++++++++++++++++++++++++++++++++
 ftp/tnftpd/distinfo                  |  1 +
 ftp/tnftpd/files/patch-src-logwtmp.c | 29 ++++++++++++++
 ftp/tnftpd/files/patch-tnftpd.h      | 12 ++++++
 ftp/tnftpd/pkg-descr                 |  2 +
 ftp/tnftpd/pkg-plist                 |  6 +++
 6 files changed, 124 insertions(+)
 create mode 100644 ftp/tnftpd/Makefile
 create mode 100644 ftp/tnftpd/distinfo
 create mode 100644 ftp/tnftpd/files/patch-src-logwtmp.c
 create mode 100644 ftp/tnftpd/files/patch-tnftpd.h
 create mode 100644 ftp/tnftpd/pkg-descr
 create mode 100644 ftp/tnftpd/pkg-plist

(limited to 'ftp/tnftpd')

diff --git a/ftp/tnftpd/Makefile b/ftp/tnftpd/Makefile
new file mode 100644
index 000000000000..d89e2e16e108
--- /dev/null
+++ b/ftp/tnftpd/Makefile
@@ -0,0 +1,74 @@
+# New ports collection makefile for:	tnftpd
+# Date created:				3 August 2003
+# Whom:					ports
+#
+# $FreeBSD$
+#
+
+PORTNAME=	tnftpd
+PORTVERSION=	2.0b3
+CATEGORIES=	ftp ipv6
+MASTER_SITES=	ftp://ftp.netbsd.org/pub/NetBSD/misc/tnftp/
+DISTNAME=	${PORTNAME}-2.0-beta3
+
+MAINTAINER=	ports@FreeBSD.org
+COMMENT=	Enhanced ftp server from NetBSD
+
+USE_REINPLACE=	yes
+GNU_CONFIGURE=	yes
+
+.if defined(WITH_SOCKS5)
+BUILD_DEPENDS=	${LOCALBASE}/lib/libsocks5.a:${PORTSDIR}/net/socks5
+CONFIGURE_ARGS+=	--with-socks5
+.endif
+
+DOCS=		ChangeLog README THANKS COPYING
+
+MAN5=		ftpd.conf.5 ftpusers.5
+MAN8=		tnftpd.8
+
+FIXPREFIX=	ftpd.8 ftpd.conf.5 ftpusers.5
+
+pre-patch:
+.for f in ${FIXPREFIX}
+	${REINPLACE_CMD} -e \
+		"s@^\.Dq Pa /etc@.Dq Pa ${PREFIX}/etc@g; \
+		s@^\.Pa /etc@.Pa ${PREFIX}/etc@g; \
+		s@^\.It Pa /etc/@.It Pa ${PREFIX}/etc/@g; \
+		s@^\.Ss /etc/@.Ss ${PREFIX}/etc/@g; \
+		s@^\.Sx /etc/@.Sx ${PREFIX}/etc/@g; \
+		s@^\.Bl -tag -width /etc/@.Bl -tag -width ${PREFIX}/etc/@g; \
+		s@${PREFIX}/etc/shells@/etc/shells@g; \
+		s@${PREFIX}/etc/motd@/etc/motd@g; \
+		s@${PREFIX}/etc/nologin@/etc/nologin@g; \
+		s@${PREFIX}/etc/pwd.db@/etc/pwd.db@g" \
+	${WRKSRC}/src/${f}
+.endfor
+	${REINPLACE_CMD} -e \
+		"s@^#define	_DEFAULT_CONFDIR	\"/etc\"@#define	_DEFAULT_CONFDIR	\"${PREFIX}/etc\"@" \
+	${WRKSRC}/src/pathnames.h
+
+do-install:
+	${INSTALL_PROGRAM} ${WRKSRC}/src/tnftpd ${PREFIX}/libexec
+	${INSTALL_MAN} ${WRKSRC}/src/ftpd.8 ${PREFIX}/man/man8/tnftpd.8
+	${INSTALL_MAN} ${WRKSRC}/src/ftpd.conf.5 ${PREFIX}/man/man5
+	${INSTALL_MAN} ${WRKSRC}/src/ftpusers.5 ${PREFIX}/man/man5
+.if !defined(NOPORTDOCS)
+	${MKDIR} ${PREFIX}/share/doc/${PORTNAME}
+.for f in ${DOCS}
+	${INSTALL_DATA} ${WRKSRC}/${f} ${PREFIX}/share/doc/${PORTNAME}/
+.endfor
+.endif
+
+post-install:
+	@${ECHO} "================================================================================"
+	@${ECHO} "This port relies on a number of configuration files in ${PREFIX}/etc."
+	@${ECHO} "At the very least, create a ftpusers file with the usernams of users you don't"
+	@${ECHO} "want to connect (root, toor, etc.). This will allow non-listed users to log in."
+	@${ECHO} "Copying /etc/ftpusers to ${PREFIX}/etc/ftpusers should be sufficient."
+	@${ECHO}
+	@${ECHO} "See the man files for more information. The man- and configuration files for"
+	@${ECHO} "FreeBSD's built-in ftpd can also be of use as examples/additional info."
+	@${ECHO} "================================================================================"
+
+.include <bsd.port.mk>
diff --git a/ftp/tnftpd/distinfo b/ftp/tnftpd/distinfo
new file mode 100644
index 000000000000..479d050fb06f
--- /dev/null
+++ b/ftp/tnftpd/distinfo
@@ -0,0 +1 @@
+MD5 (tnftpd-2.0-beta3.tar.gz) = 2c70bdc6549f88f992191ebe772629a7
diff --git a/ftp/tnftpd/files/patch-src-logwtmp.c b/ftp/tnftpd/files/patch-src-logwtmp.c
new file mode 100644
index 000000000000..928f910f9ad6
--- /dev/null
+++ b/ftp/tnftpd/files/patch-src-logwtmp.c
@@ -0,0 +1,29 @@
+--- src/logwtmp.c-orig	Sun Feb 23 22:38:44 2003
++++ src/logwtmp.c	Sun Aug  3 15:53:32 2003
+@@ -78,6 +78,26 @@
+ 	struct utmp ut;
+ 	struct stat buf;
+ 
++	if (strlen(host) > UT_HOSTSIZE) {
++		struct addrinfo hints, *res;
++		int error;
++		static char hostbuf[BUFSIZ];
++
++		memset(&hints, 0, sizeof(hints));
++		hints.ai_family = PF_UNSPEC;
++		error = getaddrinfo(host, NULL, &hints, &res);
++		if (error)
++			host = "invalid hostname";
++		else {
++			getnameinfo(res->ai_addr, res->ai_addrlen,
++				hostbuf, sizeof(hostbuf), NULL, 0,
++				NI_NUMERICHOST);
++			host = hostbuf;
++			if (strlen(host) > UT_HOSTSIZE)
++				host[UT_HOSTSIZE] = '\0';
++		}
++	}
++
+ 	if (fd < 0 && (fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) < 0)
+ 		return;
+ 	if (fstat(fd, &buf) == 0) {
diff --git a/ftp/tnftpd/files/patch-tnftpd.h b/ftp/tnftpd/files/patch-tnftpd.h
new file mode 100644
index 000000000000..018a2a02e118
--- /dev/null
+++ b/ftp/tnftpd/files/patch-tnftpd.h
@@ -0,0 +1,12 @@
+--- tnftpd.h-orig	Wed Feb 26 19:16:13 2003
++++ tnftpd.h	Sun Aug  3 15:49:57 2003
+@@ -404,6 +404,8 @@
+ #define SECSPERDAY	86400
+ #define TM_YEAR_BASE	1900
+ 
+-#if ! defined(LOGIN_NAME_MAX)
++#if defined(MAXLOGNAME)
++# define LOGIN_NAME_MAX MAXLOGNAME
++#elif ! defined(LOGIN_NAME_MAX)
+ # define LOGIN_NAME_MAX (9)
+ #endif
diff --git a/ftp/tnftpd/pkg-descr b/ftp/tnftpd/pkg-descr
new file mode 100644
index 000000000000..4533a0527f9f
--- /dev/null
+++ b/ftp/tnftpd/pkg-descr
@@ -0,0 +1,2 @@
+tnftpd is a port of the enhanced NetBSD ftp server to other systems.
+(Note: lukemftpd was renamed to tnftpd)
diff --git a/ftp/tnftpd/pkg-plist b/ftp/tnftpd/pkg-plist
new file mode 100644
index 000000000000..c9c43e9e5fbd
--- /dev/null
+++ b/ftp/tnftpd/pkg-plist
@@ -0,0 +1,6 @@
+libexec/tnftpd
+%%PORTDOCS%%%%DOCSDIR%%/ChangeLog
+%%PORTDOCS%%%%DOCSDIR%%/README
+%%PORTDOCS%%%%DOCSDIR%%/THANKS
+%%PORTDOCS%%%%DOCSDIR%%/COPYING
+%%PORTDOCS%%@dirrm %%DOCSDIR%%
-- 
cgit v1.2.3