ports/90868: [new port] add ftp/pftpx

Andrew Thompson thompsa at FreeBSD.org
Sat Dec 24 01:40:08 UTC 2005


>Number:         90868
>Category:       ports
>Synopsis:       [new port] add ftp/pftpx
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec 24 01:40:05 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Thompson
>Release:        FreeBSD 6.0-STABLE i386
>Organization:
>Environment:
System: FreeBSD heff.fud.org.nz 6.0-STABLE FreeBSD 6.0-STABLE #1: Sat Dec 17 09:51:12 NZDT 2005 root at heff.fud.org.nz:/usr/obj/usr/src/sys/HEFF i386


	
>Description:

Add ftp/pftpx on behalf of Scott Ullrich

>How-To-Repeat:
>Fix:

also available @ http://people.freebsd.org/~thompsa/pftpx.shar



# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	ftp
#	ftp/pfptx
#	ftp/pfptx/Makefile
#	ftp/pfptx/pkg-descr
#	ftp/pfptx/files
#	ftp/pfptx/files/patch-pftpx.c
#	ftp/pfptx/files/patch-Makefile
#	ftp/pfptx/distinfo
#
echo c - ftp
mkdir -p ftp > /dev/null 2>&1
echo c - ftp/pfptx
mkdir -p ftp/pfptx > /dev/null 2>&1
echo x - ftp/pfptx/Makefile
sed 's/^X//' >ftp/pfptx/Makefile << 'END-of-ftp/pfptx/Makefile'
X# New ports collection makefile for:	pftpx
X# Date created:		27 June 2005
X# Whom:			Scott Ullrich (geekgod at geekgod.com)
X#
X# $FreeBSD: $
X
XPORTNAME=	pftpx
XPORTVERSION=	0.8
XCATEGORIES=	ftp
XMASTER_SITES=	http://www.sentia.org/downloads/
XDISTNAME=	${PORTNAME}-${PORTVERSION}
X
XMAINTAINER=	geekgod at geekgod.com
XCOMMENT=	Much enhanced ftp proxy for pf that supports most ftp protocols
X
XLIB_DEPENDS=	event-1.1a:${PORTSDIR}/devel/libevent
X
XMAN8=		pftpx.8
X
XPLIST_FILES=    sbin/pftpx
X
X.include <bsd.port.pre.mk>
X
X.if ${OSVERSION} < 500000
XIGNORE=		only for 5.0 and above
X.endif
X
X.if ${OSVERSION} < 502116
XMAKE_ARGS=	LOCALBASE="${PREFIX}" OSLEVEL=34
X.if defined(WITH_ALTQ) && (${WITH_ALTQ} == "yes")
XCFLAGS+=	-DHAVE_ALTQ=1
X.endif
X.elif ${OSVERSION} < 600025
XMAKE_ARGS=	LOCALBASE="${PREFIX}" OSLEVEL=35
XCFLAGS+=	-DHAVE_ALTQ=1 -DHAVE_RULE_ANCHOR=1
X.else
XMAKE_ARGS=	LOCALBASE="${PREFIX}" OSLEVEL=37
XCFLAGS+=	-DHAVE_ALTQ=1
X.endif
X
Xdo-install:
X	${INSTALL_PROGRAM} ${WRKSRC}/pftpx ${PREFIX}/sbin
X	${INSTALL_MAN} ${WRKSRC}/pftpx.8 ${PREFIX}/man/man8
X
X.include <bsd.port.post.mk>
END-of-ftp/pfptx/Makefile
echo x - ftp/pfptx/pkg-descr
sed 's/^X//' >ftp/pfptx/pkg-descr << 'END-of-ftp/pfptx/pkg-descr'
Xpftpx is a ftp proxy with many advanced features such as:
X
X1) it handles all ftp modes: PORT, PASV, EPRT, EPSV
X2) it handles ipv6
X3) it should scale: one process handles all sessions using libevent
X4) it works with "strict" ftp clients (clients that want data connections 
X   to the same IP as the control connection)
END-of-ftp/pfptx/pkg-descr
echo c - ftp/pfptx/files
mkdir -p ftp/pfptx/files > /dev/null 2>&1
echo x - ftp/pfptx/files/patch-pftpx.c
sed 's/^X//' >ftp/pfptx/files/patch-pftpx.c << 'END-of-ftp/pfptx/files/patch-pftpx.c'
X--- pftpx.c.orig        Mon Jun 27 17:58:30 2005
X+++ pftpx.c     Mon Jun 27 18:01:11 2005
X@@ -58,6 +58,58 @@
X
X #define        sstosa(ss)      ((struct sockaddr *)(ss))
X
X+#include <sys/types.h>
X+
X+#include <ctype.h>
X+#include <limits.h>
X+#include <string.h>
X+
X+#define isoctal(c)      (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7')
X+#include <sys/types.h>
X+
X+#define isoctal(c)      (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7')
X+#define isvisible(c)    (((u_int)(c) <= UCHAR_MAX && isascii((u_char)(c)) && \
X+                                isgraph((u_char)(c))) ||                     \
X+                                ((flag & VIS_SP) == 0 && (c) == ' ') ||      \
X+                                ((flag & VIS_TAB) == 0 && (c) == '\t') ||    \
X+                                ((flag & VIS_NL) == 0 && (c) == '\n') ||     \
X+                                ((flag & VIS_SAFE) && ((c) == '\b' ||        \
X+                                (c) == '\007' || (c) == '\r' ||              \
X+                                isgraph((u_char)(c)))))
X+
X+#define _VIS_H_
X+
X+#include <sys/types.h>
X+#include <limits.h>
X+
X+/*
X+ * to select alternate encoding format
X+ */
X+#define VIS_OCTAL       0x01    /* use octal \ddd format */
X+#define VIS_CSTYLE      0x02    /* use \[nrft0..] where appropriate */
X+
X+/*
X+ * to alter set of characters encoded (default is to encode all
X+ * non-graphic except space, tab, and newline).
X+ */
X+#define VIS_SP          0x04    /* also encode space */
X+#define VIS_TAB         0x08    /* also encode tab */
X+#define VIS_NL          0x10    /* also encode newline */
X+#define VIS_WHITE       (VIS_SP | VIS_TAB | VIS_NL)
X+#define VIS_SAFE        0x20    /* only encode "unsafe" characters */
X+
X+/*
X+ * other
X+ */
X+#define VIS_NOSLASH     0x40    /* inhibit printing '\' */
X+
X+#define LIST_FIRST(head)                ((head)->lh_first)
X+#define LIST_END(head)                        NULL
X+#define LIST_NEXT(elm, field)                ((elm)->field.le_next)
X+
X+char    *vis(char *, int, int, int);
X+int     strnvis(char *, const char *, size_t, int);
X+
X enum { CMD_NONE = 0, CMD_PORT, CMD_EPRT, CMD_PASV, CMD_EPSV };
X
X struct session {
X@@ -1037,3 +1089,143 @@
X            "[-p address] [-q queue] [-t timeout]\n", __progname);
X        exit(1);
X }
X+
X+
X+/*
X+ * vis - visually encode characters
X+ */
X+char *
X+vis(dst, c, flag, nextc)
X+        register char *dst;
X+        int c, nextc;
X+        register int flag;
X+{
X+        if (isvisible(c)) {
X+                *dst++ = c;
X+                if (c == '\\' && (flag & VIS_NOSLASH) == 0)
X+                        *dst++ = '\\';
X+                *dst = '\0';
X+                return (dst);
X+        }
X+
X+        if (flag & VIS_CSTYLE) {
X+                switch(c) {
X+                case '\n':
X+                        *dst++ = '\\';
X+                        *dst++ = 'n';
X+                        goto done;
X+                case '\r':
X+                        *dst++ = '\\';
X+                        *dst++ = 'r';
X+                        goto done;
X+                case '\b':
X+                        *dst++ = '\\';
X+                        *dst++ = 'b';
X+                        goto done;
X+                case '\a':
X+                        *dst++ = '\\';
X+                        *dst++ = 'a';
X+                        goto done;
X+                case '\v':
X+                        *dst++ = '\\';
X+                        *dst++ = 'v';
X+                        goto done;
X+                case '\t':
X+                        *dst++ = '\\';
X+                        *dst++ = 't';
X+                        goto done;
X+                case '\f':
X+                        *dst++ = '\\';
X+                        *dst++ = 'f';
X+                        goto done;
X+                case ' ':
X+                        *dst++ = '\\';
X+                        *dst++ = 's';
X+                        goto done;
X+                case '\0':
X+                        *dst++ = '\\';
X+                        *dst++ = '0';
X+                        if (isoctal(nextc)) {
X+                                *dst++ = '0';
X+                                *dst++ = '0';
X+                        }
X+                        goto done;
X+                }
X+        }
X+        if (((c & 0177) == ' ') || (flag & VIS_OCTAL)) {
X+                *dst++ = '\\';
X+                *dst++ = ((u_char)c >> 6 & 07) + '0';
X+                *dst++ = ((u_char)c >> 3 & 07) + '0';
X+                *dst++ = ((u_char)c & 07) + '0';
X+                goto done;
X+        }
X+        if ((flag & VIS_NOSLASH) == 0)
X+                *dst++ = '\\';
X+        if (c & 0200) {
X+                c &= 0177;
X+                *dst++ = 'M';
X+        }
X+        if (iscntrl(c)) {
X+                *dst++ = '^';
X+                if (c == 0177)
X+                        *dst++ = '?';
X+                else
X+                        *dst++ = c + '@';
X+        } else {
X+                *dst++ = '-';
X+                *dst++ = c;
X+        }
X+done:
X+        *dst = '\0';
X+        return (dst);
X+}
X+
X+int
X+strnvis(dst, src, siz, flag)
X+        char *dst;
X+        const char *src;
X+        size_t siz;
X+        int flag;
X+{
X+        char c;
X+        char *start, *end;
X+        char tbuf[5];
X+        int  i;
X+
X+        i = 0;
X+        for (start = dst, end = start + siz - 1; (c = *src) && dst < end; ) {
X+                if (isvisible(c)) {
X+                        i = 1;
X+                        *dst++ = c;
X+                        if (c == '\\' && (flag & VIS_NOSLASH) == 0) {
X+                                /* need space for the extra '\\' */
X+                                if (dst < end)
X+                                        *dst++ = '\\';
X+                                else {
X+                                        dst--;
X+                                        i = 2;
X+                                        break;
X+                                }
X+                        }
X+                        src++;
X+                } else {
X+                        i = vis(tbuf, c, flag, *++src) - tbuf;
X+                        if (dst + i <= end) {
X+                                memcpy(dst, tbuf, i);
X+                                dst += i;
X+                        } else {
X+                                src--;
X+                                break;
X+                        }
X+                }
X+        }
X+        if (siz > 0)
X+                *dst = '\0';
X+        if (dst + i > end) {
X+                /* adjust return value for truncation */
X+                while ((c = *src))
X+                        dst += vis(tbuf, c, flag, *++src) - tbuf;
X+        }
X+        return (dst - start);
X+}
X+
X
END-of-ftp/pfptx/files/patch-pftpx.c
echo x - ftp/pfptx/files/patch-Makefile
sed 's/^X//' >ftp/pfptx/files/patch-Makefile << 'END-of-ftp/pfptx/files/patch-Makefile'
X--- Makefile.orig	Mon Jun 27 19:14:36 2005
X+++ Makefile	Mon Jun 27 19:30:00 2005
X@@ -5,6 +5,8 @@
X CFLAGS+=-I. -g
X CFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
X         -Wno-uninitialized
X+CFLAGS+=-I/usr/local/include -L/usr/local/lib
X+INCLUDES+=	-I/usr/local/include
X LDADD+=	-levent
X 
X .include <bsd.prog.mk>
END-of-ftp/pfptx/files/patch-Makefile
echo x - ftp/pfptx/distinfo
sed 's/^X//' >ftp/pfptx/distinfo << 'END-of-ftp/pfptx/distinfo'
XMD5 (pftpx-0.8.tar.gz) = 6d71baaab87c4ad13949bf7fc5d64f55
XSHA256 (pftpx-0.8.tar.gz) = b76443ac70cf19c2e92d69f51ed12995c582c60584111594ab97431c48e370ce
XSIZE (pftpx-0.8.tar.gz) = 11488
END-of-ftp/pfptx/distinfo
exit


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list