summaryrefslogtreecommitdiffstats
path: root/ftp
diff options
context:
space:
mode:
authoranray <anray@FreeBSD.org>2005-12-24 19:02:39 +0000
committeranray <anray@FreeBSD.org>2005-12-24 19:02:39 +0000
commit7085957f143e5cb8b7e9d9082f4869b85f8704e8 (patch)
treed0509fd27e676516bd5c63f3c3c26a3b717fdea3 /ftp
parent3821d03c7980356a6a20810507a532b6b1fca61c (diff)
downloadFreeBSD-ports-7085957f143e5cb8b7e9d9082f4869b85f8704e8.zip
FreeBSD-ports-7085957f143e5cb8b7e9d9082f4869b85f8704e8.tar.gz
Added pftpx, much enhanced ftp proxy for pf that supports most ftp protocols.
PR: ports/90868 Submitted by: thompsa Approved by: sem(mentor)
Diffstat (limited to 'ftp')
-rw-r--r--ftp/Makefile1
-rw-r--r--ftp/pfptx/Makefile45
-rw-r--r--ftp/pfptx/distinfo3
-rw-r--r--ftp/pfptx/files/patch-Makefile11
-rw-r--r--ftp/pfptx/files/patch-pftpx.c206
-rw-r--r--ftp/pfptx/pkg-descr7
6 files changed, 273 insertions, 0 deletions
diff --git a/ftp/Makefile b/ftp/Makefile
index 13b58d0..7e0dea2 100644
--- a/ftp/Makefile
+++ b/ftp/Makefile
@@ -70,6 +70,7 @@
SUBDIR += paraget
SUBDIR += pavuk
SUBDIR += pear-Net_FTP
+ SUBDIR += pfptx
SUBDIR += pftpd
SUBDIR += php4-curl
SUBDIR += php4-ftp
diff --git a/ftp/pfptx/Makefile b/ftp/pfptx/Makefile
new file mode 100644
index 0000000..401328a
--- /dev/null
+++ b/ftp/pfptx/Makefile
@@ -0,0 +1,45 @@
+# New ports collection makefile for: pftpx
+# Date created: 27 June 2005
+# Whom: Scott Ullrich (geekgod@geekgod.com)
+#
+# $FreeBSD$
+
+PORTNAME= pftpx
+PORTVERSION= 0.8
+CATEGORIES= ftp
+MASTER_SITES= http://www.sentia.org/downloads/
+DISTNAME= ${PORTNAME}-${PORTVERSION}
+
+MAINTAINER= geekgod@geekgod.com
+COMMENT= Much enhanced ftp proxy for pf that supports most ftp protocols
+
+LIB_DEPENDS= event-1.1a:${PORTSDIR}/devel/libevent
+
+MAN8= pftpx.8
+
+PLIST_FILES= sbin/pftpx
+
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} < 500000
+IGNORE= only for 5.0 and above
+.endif
+
+.if ${OSVERSION} < 502116
+MAKE_ARGS= LOCALBASE="${PREFIX}" OSLEVEL=34
+.if defined(WITH_ALTQ) && (${WITH_ALTQ} == "yes")
+CFLAGS+= -DHAVE_ALTQ=1
+.endif
+.elif ${OSVERSION} < 600025
+MAKE_ARGS= LOCALBASE="${PREFIX}" OSLEVEL=35
+CFLAGS+= -DHAVE_ALTQ=1 -DHAVE_RULE_ANCHOR=1
+.else
+MAKE_ARGS= LOCALBASE="${PREFIX}" OSLEVEL=37
+CFLAGS+= -DHAVE_ALTQ=1
+.endif
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/pftpx ${PREFIX}/sbin
+ ${INSTALL_MAN} ${WRKSRC}/pftpx.8 ${PREFIX}/man/man8
+
+.include <bsd.port.post.mk>
diff --git a/ftp/pfptx/distinfo b/ftp/pfptx/distinfo
new file mode 100644
index 0000000..85775cb
--- /dev/null
+++ b/ftp/pfptx/distinfo
@@ -0,0 +1,3 @@
+MD5 (pftpx-0.8.tar.gz) = 6d71baaab87c4ad13949bf7fc5d64f55
+SHA256 (pftpx-0.8.tar.gz) = b76443ac70cf19c2e92d69f51ed12995c582c60584111594ab97431c48e370ce
+SIZE (pftpx-0.8.tar.gz) = 11488
diff --git a/ftp/pfptx/files/patch-Makefile b/ftp/pfptx/files/patch-Makefile
new file mode 100644
index 0000000..4a6ace6
--- /dev/null
+++ b/ftp/pfptx/files/patch-Makefile
@@ -0,0 +1,11 @@
+--- Makefile.orig Mon Jun 27 19:14:36 2005
++++ Makefile Mon Jun 27 19:30:00 2005
+@@ -5,6 +5,8 @@
+ CFLAGS+=-I. -g
+ CFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
+ -Wno-uninitialized
++CFLAGS+=-I/usr/local/include -L/usr/local/lib
++INCLUDES+= -I/usr/local/include
+ LDADD+= -levent
+
+ .include <bsd.prog.mk>
diff --git a/ftp/pfptx/files/patch-pftpx.c b/ftp/pfptx/files/patch-pftpx.c
new file mode 100644
index 0000000..a46f624
--- /dev/null
+++ b/ftp/pfptx/files/patch-pftpx.c
@@ -0,0 +1,206 @@
+--- pftpx.c.orig Mon Jun 27 17:58:30 2005
++++ pftpx.c Mon Jun 27 18:01:11 2005
+@@ -58,6 +58,58 @@
+
+ #define sstosa(ss) ((struct sockaddr *)(ss))
+
++#include <sys/types.h>
++
++#include <ctype.h>
++#include <limits.h>
++#include <string.h>
++
++#define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7')
++#include <sys/types.h>
++
++#define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7')
++#define isvisible(c) (((u_int)(c) <= UCHAR_MAX && isascii((u_char)(c)) && \
++ isgraph((u_char)(c))) || \
++ ((flag & VIS_SP) == 0 && (c) == ' ') || \
++ ((flag & VIS_TAB) == 0 && (c) == '\t') || \
++ ((flag & VIS_NL) == 0 && (c) == '\n') || \
++ ((flag & VIS_SAFE) && ((c) == '\b' || \
++ (c) == '\007' || (c) == '\r' || \
++ isgraph((u_char)(c)))))
++
++#define _VIS_H_
++
++#include <sys/types.h>
++#include <limits.h>
++
++/*
++ * to select alternate encoding format
++ */
++#define VIS_OCTAL 0x01 /* use octal \ddd format */
++#define VIS_CSTYLE 0x02 /* use \[nrft0..] where appropriate */
++
++/*
++ * to alter set of characters encoded (default is to encode all
++ * non-graphic except space, tab, and newline).
++ */
++#define VIS_SP 0x04 /* also encode space */
++#define VIS_TAB 0x08 /* also encode tab */
++#define VIS_NL 0x10 /* also encode newline */
++#define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL)
++#define VIS_SAFE 0x20 /* only encode "unsafe" characters */
++
++/*
++ * other
++ */
++#define VIS_NOSLASH 0x40 /* inhibit printing '\' */
++
++#define LIST_FIRST(head) ((head)->lh_first)
++#define LIST_END(head) NULL
++#define LIST_NEXT(elm, field) ((elm)->field.le_next)
++
++char *vis(char *, int, int, int);
++int strnvis(char *, const char *, size_t, int);
++
+ enum { CMD_NONE = 0, CMD_PORT, CMD_EPRT, CMD_PASV, CMD_EPSV };
+
+ struct session {
+@@ -1037,3 +1089,143 @@
+ "[-p address] [-q queue] [-t timeout]\n", __progname);
+ exit(1);
+ }
++
++
++/*
++ * vis - visually encode characters
++ */
++char *
++vis(dst, c, flag, nextc)
++ register char *dst;
++ int c, nextc;
++ register int flag;
++{
++ if (isvisible(c)) {
++ *dst++ = c;
++ if (c == '\\' && (flag & VIS_NOSLASH) == 0)
++ *dst++ = '\\';
++ *dst = '\0';
++ return (dst);
++ }
++
++ if (flag & VIS_CSTYLE) {
++ switch(c) {
++ case '\n':
++ *dst++ = '\\';
++ *dst++ = 'n';
++ goto done;
++ case '\r':
++ *dst++ = '\\';
++ *dst++ = 'r';
++ goto done;
++ case '\b':
++ *dst++ = '\\';
++ *dst++ = 'b';
++ goto done;
++ case '\a':
++ *dst++ = '\\';
++ *dst++ = 'a';
++ goto done;
++ case '\v':
++ *dst++ = '\\';
++ *dst++ = 'v';
++ goto done;
++ case '\t':
++ *dst++ = '\\';
++ *dst++ = 't';
++ goto done;
++ case '\f':
++ *dst++ = '\\';
++ *dst++ = 'f';
++ goto done;
++ case ' ':
++ *dst++ = '\\';
++ *dst++ = 's';
++ goto done;
++ case '\0':
++ *dst++ = '\\';
++ *dst++ = '0';
++ if (isoctal(nextc)) {
++ *dst++ = '0';
++ *dst++ = '0';
++ }
++ goto done;
++ }
++ }
++ if (((c & 0177) == ' ') || (flag & VIS_OCTAL)) {
++ *dst++ = '\\';
++ *dst++ = ((u_char)c >> 6 & 07) + '0';
++ *dst++ = ((u_char)c >> 3 & 07) + '0';
++ *dst++ = ((u_char)c & 07) + '0';
++ goto done;
++ }
++ if ((flag & VIS_NOSLASH) == 0)
++ *dst++ = '\\';
++ if (c & 0200) {
++ c &= 0177;
++ *dst++ = 'M';
++ }
++ if (iscntrl(c)) {
++ *dst++ = '^';
++ if (c == 0177)
++ *dst++ = '?';
++ else
++ *dst++ = c + '@';
++ } else {
++ *dst++ = '-';
++ *dst++ = c;
++ }
++done:
++ *dst = '\0';
++ return (dst);
++}
++
++int
++strnvis(dst, src, siz, flag)
++ char *dst;
++ const char *src;
++ size_t siz;
++ int flag;
++{
++ char c;
++ char *start, *end;
++ char tbuf[5];
++ int i;
++
++ i = 0;
++ for (start = dst, end = start + siz - 1; (c = *src) && dst < end; ) {
++ if (isvisible(c)) {
++ i = 1;
++ *dst++ = c;
++ if (c == '\\' && (flag & VIS_NOSLASH) == 0) {
++ /* need space for the extra '\\' */
++ if (dst < end)
++ *dst++ = '\\';
++ else {
++ dst--;
++ i = 2;
++ break;
++ }
++ }
++ src++;
++ } else {
++ i = vis(tbuf, c, flag, *++src) - tbuf;
++ if (dst + i <= end) {
++ memcpy(dst, tbuf, i);
++ dst += i;
++ } else {
++ src--;
++ break;
++ }
++ }
++ }
++ if (siz > 0)
++ *dst = '\0';
++ if (dst + i > end) {
++ /* adjust return value for truncation */
++ while ((c = *src))
++ dst += vis(tbuf, c, flag, *++src) - tbuf;
++ }
++ return (dst - start);
++}
++
+
diff --git a/ftp/pfptx/pkg-descr b/ftp/pfptx/pkg-descr
new file mode 100644
index 0000000..e5dc486
--- /dev/null
+++ b/ftp/pfptx/pkg-descr
@@ -0,0 +1,7 @@
+pftpx is a ftp proxy with many advanced features such as:
+
+1) it handles all ftp modes: PORT, PASV, EPRT, EPSV
+2) it handles ipv6
+3) it should scale: one process handles all sessions using libevent
+4) it works with "strict" ftp clients (clients that want data connections
+ to the same IP as the control connection)
OpenPOWER on IntegriCloud