[Midnightbsd-cvs] mports: mports/ftp: add tnftpd aka lukemftpd from NetBSD
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Tue Sep 30 19:24:33 EDT 2008
Log Message:
-----------
add tnftpd aka lukemftpd from NetBSD
Modified Files:
--------------
mports/ftp:
Makefile (r1.21 -> r1.22)
Added Files:
-----------
mports/ftp/tnftpd:
Makefile (r1.1)
distinfo (r1.1)
pkg-descr (r1.1)
mports/ftp/tnftpd/files:
patch-src-Makefile.in (r1.1)
patch-src-ftpd.c (r1.1)
patch-src-logutmp.c (r1.1)
patch-src-logwtmp.c (r1.1)
patch-tnftpd.h (r1.1)
pkg-message.in (r1.1)
-------------- next part --------------
--- /dev/null
+++ ftp/tnftpd/pkg-descr
@@ -0,0 +1,2 @@
+tnftpd (formerly known as lukemftpd) is a port of the enhanced NetBSD ftp
+server to other systems.
--- /dev/null
+++ ftp/tnftpd/Makefile
@@ -0,0 +1,65 @@
+# New ports collection makefile for: tnftpd
+# Date created: 3 August 2003
+# Whom: ports
+#
+# $MidnightBSD: mports/ftp/tnftpd/Makefile,v 1.1 2008/09/30 23:24:30 laffer1 Exp $
+# $FreeBSD: ports/ftp/tnftpd/Makefile,v 1.13 2008/08/23 20:13:18 beech Exp $
+#
+
+PORTNAME= tnftpd
+PORTVERSION= 20080609
+CATEGORIES= ftp ipv6
+MASTER_SITES= ftp://ftp.netbsd.org/pub/NetBSD/misc/tnftp/
+
+MAINTAINER= ports at MidnightBSD.org
+COMMENT= Enhanced ftp server from NetBSD
+LICENSE= bsd4
+
+GNU_CONFIGURE= yes
+
+CFLAGS+= -DSUPPORT_UTMP
+
+.if defined(WITH_SOCKS5)
+BUILD_DEPENDS+= ${LOCALBASE}/lib/libsocks5.a:${PORTSDIR}/net/socks5
+CONFIGURE_ARGS+= --with-socks5
+.endif
+
+MAN5= ftpd.conf.5 ftpusers.5
+MAN8= tnftpd.8
+PLIST_FILES= libexec/tnftpd
+PORTDOCS= ChangeLog NEWS README THANKS COPYING
+
+SUB_FILES= pkg-message
+FIXPREFIX= ftpd.8 ftpd.conf.5 ftpusers.5
+
+pre-patch:
+.for f in ${FIXPREFIX}
+ ${REINPLACE_CMD} -e \
+ "s@^\.Dq Pa /etc at .Dq Pa ${PREFIX}/etc at g; \
+ s@^\.Pa /etc at .Pa ${PREFIX}/etc at 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 at g; \
+ s@${PREFIX}/etc/nologin@/etc/nologin at g; \
+ s@${PREFIX}/etc/pwd.db@/etc/pwd.db at 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} ${DOCSDIR}
+.for f in ${PORTDOCS}
+ ${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
+.endfor
+.endif
+
+.include <bsd.port.mk>
--- /dev/null
+++ ftp/tnftpd/distinfo
@@ -0,0 +1,3 @@
+MD5 (tnftpd-20080609.tar.gz) = 9753e194b81357262581de12f07a76b5
+SHA256 (tnftpd-20080609.tar.gz) = 82f594afd58f70e4439c52262edefee7edbd8802d7feb86710e34cab2facdd7c
+SIZE (tnftpd-20080609.tar.gz) = 244732
Index: Makefile
===================================================================
RCS file: /home/cvs/mports/ftp/Makefile,v
retrieving revision 1.21
retrieving revision 1.22
diff -L ftp/Makefile -L ftp/Makefile -u -r1.21 -r1.22
--- ftp/Makefile
+++ ftp/Makefile
@@ -17,6 +17,7 @@
SUBDIR += php5-ftp
SUBDIR += proftpd
SUBDIR += tnftp
+ SUBDIR += tnftpd
SUBDIR += wget
SUBDIR += wu-ftpd
SUBDIR += wu-ftpd+ipv6
--- /dev/null
+++ ftp/tnftpd/files/patch-src-logwtmp.c
@@ -0,0 +1,57 @@
+
+FreeBSD does not have header file util.h, fortunately it is not needed. Add
+header files sys/socket.h and netdb.h for getaddrinfo() and getnameinfo().
+If host name is longer than UT_HOSTSIZE (16 characters), log numeric
+address to utmp.
+
+--- src/logwtmp.c.orig 2008-05-31 23:26:12.000000000 -0400
++++ src/logwtmp.c 2008-05-31 23:26:12.000000000 -0400
+@@ -43,11 +43,13 @@
+
+ #include <sys/types.h>
+ #include <sys/param.h>
++#include <sys/socket.h>
+ #include <sys/time.h>
+ #include <sys/stat.h>
+ #include <sys/wait.h>
+
+ #include <fcntl.h>
++#include <netdb.h>
+ #include <signal.h>
+ #include <stdio.h>
+ #include <string.h>
+@@ -60,7 +62,6 @@
+ #ifdef SUPPORT_UTMPX
+ #include <utmpx.h>
+ #endif
+-#include <util.h>
+
+ #ifdef KERBEROS5
+ #include <krb5/krb5.h>
+@@ -90,6 +91,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)
++ hostbuf[UT_HOSTSIZE] = '\0';
++ }
++ }
++
+ if (fd < 0)
+ return;
+ if (fstat(fd, &buf) == 0) {
--- /dev/null
+++ ftp/tnftpd/files/patch-src-Makefile.in
@@ -0,0 +1,16 @@
+
+FreeBSD does have support for utmp/wtmp, so include relevant files into
+a build.
+
+--- src/Makefile.in.orig 2008-03-09 16:51:35.000000000 -0400
++++ src/Makefile.in 2008-03-09 16:51:35.000000000 -0400
+@@ -2,8 +2,7 @@
+ #
+
+ PROG = tnftpd at EXEEXT@
+-SRCS = cmds.c conf.c ftpd.c ftpcmd.c popen.c @LSOBJS@
+-# removed: logutmp.o logwtmp.o
++SRCS = cmds.c conf.c ftpd.c ftpcmd.c popen.c logutmp.c logwtmp.c @LSOBJS@
+
+ srcdir = @srcdir@
+ VPATH = @srcdir@
--- /dev/null
+++ ftp/tnftpd/files/patch-src-logutmp.c
@@ -0,0 +1,21 @@
+
+FreeBSD does not have header file util.h, fortunately it is not needed.
+Add header file time.h for time().
+
+--- src/logutmp.c.orig 2006-12-04 16:13:22.000000000 -0500
++++ src/logutmp.c 2006-12-04 16:13:22.000000000 -0500
+@@ -59,13 +59,13 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <time.h>
+ #include <ttyent.h>
+ #include <unistd.h>
+ #include <utmp.h>
+ #ifdef SUPPORT_UTMPX
+ #include <utmpx.h>
+ #endif
+-#include <util.h>
+
+ #include "extern.h"
+
--- /dev/null
+++ ftp/tnftpd/files/pkg-message.in
@@ -0,0 +1,7 @@
+This port relies on a number of configuration files in %%PREFIX%%/etc.
+At the very least, create a ftpusers file with the usernams of users you don't
+want to connect (root, toor, etc.). This will allow non-listed users to log in.
+Copying /etc/ftpusers to %%PREFIX%%/etc/ftpusers should be sufficient.
+
+See the man files for more information. The man- and configuration files for
+MidnightBSD's built-in ftpd can also be of use as examples/additional info.
--- /dev/null
+++ ftp/tnftpd/files/patch-src-ftpd.c
@@ -0,0 +1,109 @@
+
+Add -C user at host support instead of just -C user and add support for
+IPv6 in ftpusers.
+
+FreeBSD does not have _PASSWORD_CHGNOW defined, so use direct constant
+instead.
+
+We are sure, that we have good LOGIN_NAME_MAX from tnftpd.h, so use it
+instead of unnecessarily conservative _POSIX_LOGIN_NAME_MAX.
+
+--- src/ftpd.c.orig 2008-06-08 20:52:33.000000000 -0400
++++ src/ftpd.c 2008-06-08 20:52:33.000000000 -0400
+@@ -368,6 +368,24 @@
+ break;
+
+ case 'C':
++ if ((p = strchr(optarg, '@')) != NULL) {
++ *p++ = '\0';
++ strlcpy(remotehost, p, MAXHOSTNAMELEN + 1);
++ if (inet_pton(AF_INET, p,
++ &his_addr.su_addr) == 1) {
++ his_addr.su_family = AF_INET;
++ his_addr.su_len =
++ sizeof(his_addr.si_su.su_sin);
++#ifdef INET6
++ } else if (inet_pton(AF_INET6, p,
++ &his_addr.su_6addr) == 1) {
++ his_addr.su_family = AF_INET6;
++ his_addr.su_len =
++ sizeof(his_addr.si_su.su_sin6);
++#endif
++ } else
++ his_addr.su_family = AF_UNSPEC;
++ }
+ pw = sgetpwnam(optarg);
+ exit(checkaccess(optarg) ? 0 : 1);
+ /* NOTREACHED */
+@@ -497,12 +515,12 @@
+ exit(1);
+ } else if (l <= 0) {
+ syslog(LOG_WARNING, "using conservative LOGIN_NAME_MAX value");
+- curname_len = _POSIX_LOGIN_NAME_MAX;
++ curname_len = LOGIN_NAME_MAX;
+ } else
+ curname_len = (size_t)l;
+ #else
+ /* using conservative LOGIN_NAME_MAX value */
+- curname_len = _POSIX_LOGIN_NAME_MAX;
++ curname_len = LOGIN_NAME_MAX;
+ #endif
+ curname = malloc(curname_len);
+ if (curname == NULL) {
+@@ -1179,18 +1197,38 @@
+
+ /* have a host specifier */
+ if ((p = strchr(word, '@')) != NULL) {
+- unsigned long net, mask, addr;
+- int bits;
++ char net[16], mask[16], *addr;
++ int addrlen, bits, bytes, a;
+
+ *p++ = '\0';
+ /* check against network or CIDR */
+- if (isdigit((unsigned char)*p) &&
+- (bits = inet_net_pton(AF_INET, p,
+- &net, sizeof(net))) != -1) {
+- net = ntohl(net);
+- mask = 0xffffffffU << (32 - bits);
+- addr = ntohl(his_addr.su_addr.s_addr);
+- if ((addr & mask) != net)
++ memset(net, 0x00, sizeof(net));
++ if ((bits = inet_net_pton(his_addr.su_family, p, net,
++ sizeof(net))) != -1) {
++#ifdef INET6
++ if (his_addr.su_family == AF_INET) {
++#endif
++ addrlen = 4;
++ addr = (char *)&his_addr.su_addr;
++#ifdef INET6
++ } else {
++ addrlen = 16;
++ addr = (char *)&his_addr.su_6addr;
++ }
++#endif
++ bytes = bits / 8;
++ bits = bits % 8;
++ if (bytes > 0)
++ memset(mask, 0xFF, bytes);
++ if (bytes < addrlen)
++ mask[bytes] = 0xFF << (8 - bits);
++ if (bytes + 1 < addrlen)
++ memset(mask + bytes + 1, 0x00,
++ addrlen - bytes - 1);
++ for (a = 0; a < addrlen; a++)
++ if ((addr[a] & mask[a]) != net[a])
++ break;
++ if (a < addrlen)
+ continue;
+
+ /* check against hostname glob */
+@@ -3776,7 +3814,7 @@
+ expire = pwent->pw_expire;
+ #endif
+ #if defined(HAVE_STRUCT_PASSWD_PW_CHANGE)
+- change = (pwent->pw_change == _PASSWORD_CHGNOW)? now : pwent->pw_change;
++ change = (pwent->pw_change == -1)? now : pwent->pw_change;
+ #endif
+ #endif
+
--- /dev/null
+++ ftp/tnftpd/files/patch-tnftpd.h
@@ -0,0 +1,19 @@
+
+FreeBSD does not have LOGIN_NAME_MAX, but it has MAXLOGNAME instead,
+so use it as much as possible.
+
+--- tnftpd.h.orig 2008-06-08 21:24:51.000000000 -0400
++++ tnftpd.h 2008-06-08 21:24:51.000000000 -0400
+@@ -548,8 +548,12 @@
+ #define TM_YEAR_BASE 1900
+
+ #if !defined(LOGIN_NAME_MAX)
++#if defined(MAXLOGNAME)
++# define LOGIN_NAME_MAX MAXLOGNAME
++#else
+ # define LOGIN_NAME_MAX (9)
+ #endif
++#endif
+
+ #if !defined(_POSIX_LOGIN_NAME_MAX)
+ # define _POSIX_LOGIN_NAME_MAX LOGIN_NAME_MAX
More information about the Midnightbsd-cvs
mailing list