Index: head/ftp/frox/Makefile =================================================================== --- head/ftp/frox/Makefile (revision 421835) +++ head/ftp/frox/Makefile (revision 421836) @@ -1,66 +1,70 @@ # Created by: Sergey Matveychuk # $FreeBSD$ PORTNAME= frox PORTVERSION= 0.7.18 PORTREVISION= 2 CATEGORIES= ftp MASTER_SITES= http://www.hollo.org/frox/download/ \ http://frox.sourceforge.net/download/ \ SF MAINTAINER= ports@FreeBSD.org COMMENT= Transparent FTP proxy with caching support -LICENSE= GPLv2 +LICENSE= GPLv2+ +LICENSE_FILE= ${WRKSRC}/COPYING USES= gmake tar:bzip2 GNU_CONFIGURE= yes +CONFIGURE_ARGS= --enable-configfile=${PREFIX}/etc/frox.conf USE_RC_SUBR= frox SUB_FILES= pkg-message PORTDOCS= SECURITY CREDITS ChangeLog FAQ.html FAQ-1.html FAQ-2.html \ FAQ-3.html FAQ-4.html FAQ-5.html FAQ-6.html FAQ-7.html \ FAQ-8.html -PLIST_FILES= sbin/frox ${EXAMPLESDIR:S,${PREFIX}/,,}/frox.conf \ - man/man1/frox.1.gz man/man5/frox.conf.5.gz +PORTEXAMPLES= * +PLIST_FILES= sbin/frox \ + man/man1/frox.1.gz \ + man/man5/frox.conf.5.gz -PKGMESSAGE= ${WRKDIR}/pkg-message - -CONFIGURE_ARGS= --enable-configfile=${PREFIX}/etc/frox.conf - -OPTIONS_DEFINE= VIRUS_SCAN HTTP_CACHE LOCAL_CACHE CCP ROOT_RUN DOCS +OPTIONS_DEFINE= VIRUS_SCAN HTTP_CACHE LOCAL_CACHE CCP ROOT_RUN DOCS EXAMPLES OPTIONS_DEFAULT= HTTP_CACHE CCP OPTIONS_RADIO= PFILTER OPTIONS_RADIO_PFILTER= IPFILTER PF IPFILTER_DESC= Use ipfilter instead of ipfw PF_DESC= Build with pf(4) support VIRUS_SCAN_DESC= Run external virus scaner on each download HTTP_CACHE_DESC= Enable use of external cache LOCAL_CACHE_DESC= Enable use of local cache CCP_DESC= Ftp-proxy style command control programs ROOT_RUN_DESC= Allow frox running as root (not recomended) IPFILTER_CONFIGURE_ENABLE= ipfilter -PF_CPPFLAGS= -DPF +PF_CPPFLAGS= -DPF VIRUS_SCAN_CONFIGURE_ENABLE= virus-scan HTTP_CACHE_CONFIGURE_ENABLE= http-cache LOCAL_CACHE_CONFIGURE_ENABLE= local-cache -CCP_CONFIGURE_ENABLE= ccp +CCP_CONFIGURE_ENABLE= ccp ROOT_RUN_CONFIGURE_ARGS= run-as-root do-install: ${INSTALL_PROGRAM} ${WRKSRC}/src/frox ${STAGEDIR}${PREFIX}/sbin - @${MKDIR} ${STAGEDIR}${EXAMPLESDIR} - ${INSTALL_DATA} ${WRKSRC}/src/frox.conf ${STAGEDIR}${EXAMPLESDIR}/frox.conf ${INSTALL_MAN} ${WRKSRC}/doc/frox.man ${STAGEDIR}${MANPREFIX}/man/man1/frox.1 ${INSTALL_MAN} ${WRKSRC}/doc/frox.conf.man ${STAGEDIR}${MANPREFIX}/man/man5/frox.conf.5 + +do-install-EXAMPLES-on: + @${MKDIR} ${STAGEDIR}${EXAMPLESDIR} + ${INSTALL_DATA} ${WRKSRC}/src/frox.conf ${STAGEDIR}${EXAMPLESDIR}/frox.conf + +do-install-DOCS-on: @${MKDIR} ${STAGEDIR}${DOCSDIR} .for f in ${PORTDOCS} ${INSTALL_DATA} ${WRKSRC}/doc/${f} ${STAGEDIR}${DOCSDIR} .endfor .include Index: head/ftp/frox/files/patch-lib-sstrlib-sstr_io.c =================================================================== --- head/ftp/frox/files/patch-lib-sstrlib-sstr_io.c (revision 421835) +++ head/ftp/frox/files/patch-lib-sstrlib-sstr_io.c (revision 421836) @@ -1,27 +1,27 @@ ---- lib/sstrlib/sstr_io.c.orig 2005-02-04 13:24:55.000000000 +0300 -+++ lib/sstrlib/sstr_io.c 2007-12-14 18:07:15.000000000 +0300 +--- lib/sstrlib/sstr_io.c.orig 2005-02-04 10:24:55 UTC ++++ lib/sstrlib/sstr_io.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "sstr.h" #include "sstr_private.h" -@@ -61,8 +62,14 @@ +@@ -61,8 +62,14 @@ int sstr_apprintf(sstr * p, const char * int sstr_append_read(int fd, sstr * p, int cnt) { int i; - if(ioctl(fd, FIONREAD, &i) == -1) - return (-1); + struct stat mystat; + + if(ioctl(fd, FIONREAD, &i) == -1) { + fstat(fd,&mystat); + if (mystat.st_mode & S_IFREG == 0) + return (-1); + i=mystat.st_blksize; + } if(i == 0) return (0); Index: head/ftp/frox/files/patch-src-bsd.c =================================================================== --- head/ftp/frox/files/patch-src-bsd.c (revision 421835) +++ head/ftp/frox/files/patch-src-bsd.c (revision 421836) @@ -1,75 +1,75 @@ ---- src/bsd.c.orig Fri Feb 4 20:54:55 2005 -+++ src/bsd.c Wed Jul 25 01:25:16 2007 +--- src/bsd.c.orig 2005-02-04 10:24:55 UTC ++++ src/bsd.c @@ -30,6 +30,16 @@ #error --enable-transparent-data not supported under BSD #endif +#ifdef PF +#include +#include +#include +#include + +static int natfd; +#endif + + #ifdef IPFILTER #include #include -@@ -51,6 +61,11 @@ +@@ -51,6 +61,11 @@ int os_init(void) if(natfd < 0) write_log(ERROR, "Unable to initialise IPFilter"); #endif +#ifdef PF + natfd = open("/dev/pf", O_RDWR); + if (natfd == -1) + write_log(ERROR, "Unable to initialise PF"); +#endif return 0; } -@@ -61,6 +76,11 @@ +@@ -61,6 +76,11 @@ int os_init(void) int get_orig_dest(int fd, struct sockaddr_in *addr) { socklen_t len; +#ifdef PF + struct pfioc_natlook nl; + struct sockaddr_in from; + int r2; +#endif #ifdef IPFILTER struct natlookup nat; struct sockaddr_in from; -@@ -99,6 +119,31 @@ - addr->sin_family = AF_INET; +@@ -100,6 +120,31 @@ int get_orig_dest(int fd, struct sockadd return r2; } -+#endif + #endif +#ifdef PF + getpeername(fd, (struct sockaddr *) &from, &len); + memset(&nl, 0, sizeof(struct pfioc_natlook)); + memcpy( &nl.daddr.v4, &to.sin_addr.s_addr, sizeof( nl.saddr.v4 )); + memcpy( &nl.saddr.v4, &from.sin_addr.s_addr, sizeof( nl.daddr.v4 )); + nl.dport = to.sin_port; + nl.sport = from.sin_port; + nl.af = AF_INET; + nl.proto = IPPROTO_TCP; + nl.direction = PF_INOUT; + + if ( natfd > 0 ){ + if (ioctl(natfd, DIOCNATLOOK, &nl)==-1){ + write_log(ERROR, "Failed to lookup address"); + } + else { + memset(addr, sizeof(*addr), 0); + memcpy(&addr->sin_addr.s_addr, &nl.rdaddr.v4.s_addr, sizeof(struct sockaddr_in)); + addr->sin_len = sizeof(struct sockaddr_in); + addr->sin_port = nl.rdport; + addr->sin_family = AF_INET; + return r2; + } + } - #endif ++#endif memcpy(addr, &to, len); return r1; + } Index: head/ftp/frox/files/patch-src-cache.c =================================================================== --- head/ftp/frox/files/patch-src-cache.c (revision 421835) +++ head/ftp/frox/files/patch-src-cache.c (revision 421836) @@ -1,18 +1,16 @@ Apply patch Patch attached with submission follows: ---- src/cache.c.orig 2008-03-12 16:56:10.000000000 +0200 -+++ src/cache.c 2008-03-12 16:56:10.000000000 +0200 -@@ -364,7 +364,7 @@ +--- src/cache.c.orig 2005-02-04 10:24:55 UTC ++++ src/cache.c +@@ -364,7 +364,7 @@ int setup_fileinfo(sstr * filename) int code; sstr *msg; - if(!strcasecmp(config.cachemod, "Local") || !config.forcehttp) { + if(!strcasecmp(config.cachemod, "Local") || config.forcehttp) { send_ccommand("SIZE", sstr_buf(filename)); get_message(&code, &msg); if(code / 100 != 2) { - - Index: head/ftp/frox/files/patch-src_frox.conf =================================================================== --- head/ftp/frox/files/patch-src_frox.conf (revision 421835) +++ head/ftp/frox/files/patch-src_frox.conf (revision 421836) @@ -1,51 +1,51 @@ ---- src/frox.conf.orig Sat Apr 5 17:30:35 2003 -+++ src/frox.conf Mon Apr 7 15:05:51 2003 +--- src/frox.conf.orig 2005-02-04 10:24:55 UTC ++++ src/frox.conf @@ -18,16 +18,13 @@ # commented out to listen on all local IPs. # # Listen firewall.localnet +# Change it with your ip! Listen 192.168.2.1 # Port to listen on. Must be supplied. # Port 2121 -# If specified then bind to this device -# -BindToDevice eth0 - # Whether to run from inetd. You should still define Port above, but # it isn't used for much. # -@@ -44,7 +41,7 @@ +@@ -44,7 +41,7 @@ BindToDevice eth0 # comment this out and copy resolver libraries into the chroot jail instead. # See FAQ section 3.2 for details. # -ResolvLoadHack wontresolve.doesntexist.abc +#ResolvLoadHack wontresolve.doesntexist.abc # Another ftp proxy to forward on to. Frox will contact this ftp # proxy, and send it a login name of the form "user@host:port" where -@@ -64,8 +61,8 @@ +@@ -73,8 +70,8 @@ ResolvLoadHack wontresolve.doesntexist.a # you really want to run as root (not a good idea) you must say so # specifically, and have compiled with --enable-run-as-root. # -# User nobody -# Group nogroup +User nobody +Group nogroup # This is frox's working directory - it must be specified. Temporary # files and sockets will be created here. If you are using local -@@ -74,8 +71,8 @@ +@@ -83,8 +80,8 @@ ResolvLoadHack wontresolve.doesntexist.a # also chroot to this dir on startup. To avoid this you must specifically # set DontChroot to Yes. # -# WorkingDir /usr/local/lib/frox -# DontChroot Yes +WorkingDir /tmp +DontChroot Yes - # Logging level. 0=No logging. 5=Critical errors only. 10= All errors. + # Logging level. 0=No logging. 5=Critical errors only. 10= All errors. # 15=Errors, other important stuf. 20= Errors, connections, cache