diff options
author | lippe <lippe@FreeBSD.org> | 2008-09-03 03:05:13 +0800 |
---|---|---|
committer | lippe <lippe@FreeBSD.org> | 2008-09-03 03:05:13 +0800 |
commit | 8b623f208ea72409c3021fb018d94b689298828a (patch) | |
tree | 872e5becadb01ca4bf80e30e7f74b8d231cb82b7 /net/bounce | |
parent | 1861b4816f4b463e54a0ba0d498f719bb89cebc6 (diff) | |
download | freebsd-ports-gnome-8b623f208ea72409c3021fb018d94b689298828a.tar.gz freebsd-ports-gnome-8b623f208ea72409c3021fb018d94b689298828a.tar.zst freebsd-ports-gnome-8b623f208ea72409c3021fb018d94b689298828a.zip |
- Fix source bind address using -b option.
- Use PLIST_FILES instead of pkg-plist.
- The patches were merged.
- Bump PORTREVISION.
PR: ports/124062
Submitted by: Eugene Grosbein <eugen@kuzbass.ru>
Approved by: maintainer timeout (>2 weeks)
Diffstat (limited to 'net/bounce')
-rw-r--r-- | net/bounce/Makefile | 7 | ||||
-rw-r--r-- | net/bounce/files/patch-02 | 52 | ||||
-rw-r--r-- | net/bounce/files/patch-03 | 44 | ||||
-rw-r--r-- | net/bounce/files/patch-04 | 58 | ||||
-rw-r--r-- | net/bounce/files/patch-bounce.c (renamed from net/bounce/files/patch-01) | 99 | ||||
-rw-r--r-- | net/bounce/pkg-plist | 2 |
6 files changed, 91 insertions, 171 deletions
diff --git a/net/bounce/Makefile b/net/bounce/Makefile index 273684d4c788..25cd9b69fc06 100644 --- a/net/bounce/Makefile +++ b/net/bounce/Makefile @@ -1,5 +1,4 @@ -# ex:ts=8 -# Ports collection makefile for: bounce +# New Ports collection makefile for: bounce # Date created: Mon Dec 23, 1998 # Whom: David O'Brien (obrien@NUXI.com) # @@ -8,7 +7,7 @@ PORTNAME= bounce PORTVERSION= 1.0 -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= net security MASTER_SITES= http://www.iagora.com/~espel/ \ ${MASTER_SITE_LOCAL} @@ -22,6 +21,8 @@ COMMENT= Bounce tcp connections to another machine/port USE_RC_SUBR= bounce WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION} +PLIST_FILES= sbin/bounce + do-extract: @${MKDIR} ${WRKSRC} @${CP} ${DISTDIR}/${DISTFILES} ${WRKSRC} diff --git a/net/bounce/files/patch-02 b/net/bounce/files/patch-02 deleted file mode 100644 index 21953e7e4db4..000000000000 --- a/net/bounce/files/patch-02 +++ /dev/null @@ -1,52 +0,0 @@ ---- bounce.c.orig Fri Jun 2 12:58:37 2006 -+++ bounce.c Fri Jun 2 13:25:28 2006 -@@ -138,7 +138,7 @@ - } - - int main(int argc,char *argv[]) { -- int srv_fd, rem_fd, len, cl_fd, on=1; -+ int srv_fd, rem_fd, len, cl_fd, on=1, b=0; - int myport=DEFAULT_PORT, remoteport; - struct sockaddr_in rem_addr, srv_addr, cl_addr; - char *myname; -@@ -153,8 +153,9 @@ - - /* Process arguments */ - -- while( (ch = getopt(argc, argv, "p:a:")) != -1 ) { -+ while( (ch = getopt(argc, argv, "p:a:b:")) != -1 ) { - switch(ch) { -+ case 'b': b = 1; - case 'a': - hostname = malloc( strlen(optarg) + 1); - if( !hostname ) { -@@ -177,7 +178,7 @@ - argv += optind; - - if (argc!=2) { -- fprintf(stderr,"Use: %s [-a localaddr] [-p localport] machine port \n",myname); -+ fprintf(stderr,"Use: %s [-a localaddr | -b localaddr] [-p localport] machine port \n",myname); - exit(-1); - } - if ((remoteport=atoi(argv[1]))<=0) { -@@ -220,6 +221,7 @@ - exit(-1); - } - listen(srv_fd,QLEN); -+ srv_addr.sin_port=0; - - signal(SIGCHLD, sigchld); - printf("Ready to bounce connections from port %i to %s on port %i\n", -@@ -254,6 +256,12 @@ - if ((cl_fd=socket(PF_INET, SOCK_STREAM, 0))<0) { - close(rem_fd); - exit(-1); -+ } -+ if (b) { -+ if (bind(cl_fd,(struct sockaddr *)&srv_addr,sizeof(srv_addr))<0) { -+ close(rem_fd); -+ exit(-1); -+ } - } - if (connect(cl_fd, (struct sockaddr *)&cl_addr, - sizeof(cl_addr))<0) { diff --git a/net/bounce/files/patch-03 b/net/bounce/files/patch-03 deleted file mode 100644 index 199811db2d05..000000000000 --- a/net/bounce/files/patch-03 +++ /dev/null @@ -1,44 +0,0 @@ ---- bounce.c.orig Mon May 28 09:07:37 2007 -+++ bounce.c Mon May 28 09:08:41 2007 -@@ -138,7 +138,7 @@ - } - - int main(int argc,char *argv[]) { -- int srv_fd, rem_fd, len, cl_fd, on=1, b=0; -+ int srv_fd, rem_fd, len, cl_fd, on=1, b=0, d=0; - int myport=DEFAULT_PORT, remoteport; - struct sockaddr_in rem_addr, srv_addr, cl_addr; - char *myname; -@@ -153,9 +153,10 @@ - - /* Process arguments */ - -- while( (ch = getopt(argc, argv, "p:a:b:")) != -1 ) { -+ while( (ch = getopt(argc, argv, "p:a:b:d")) != -1 ) { - switch(ch) { - case 'b': b = 1; -+ case 'd': d = 1; break; - case 'a': - hostname = malloc( strlen(optarg) + 1); - if( !hostname ) { -@@ -178,7 +179,7 @@ - argv += optind; - - if (argc!=2) { -- fprintf(stderr,"Use: %s [-a localaddr | -b localaddr] [-p localport] machine port \n",myname); -+ fprintf(stderr,"Use: %s [-a localaddr | -b localaddr] [-p localport] [-d] machine port \n",myname); - exit(-1); - } - if ((remoteport=atoi(argv[1]))<=0) { -@@ -261,6 +262,11 @@ - if (bind(cl_fd,(struct sockaddr *)&srv_addr,sizeof(srv_addr))<0) { - close(rem_fd); - exit(-1); -+ } -+ } -+ if (d) { -+ if ((hp=gethostbyname(argv[0]))!=NULL) { -+ cl_addr.sin_addr=*(struct in_addr *)(hp->h_addr_list[0]); - } - } - if (connect(cl_fd, (struct sockaddr *)&cl_addr, diff --git a/net/bounce/files/patch-04 b/net/bounce/files/patch-04 deleted file mode 100644 index 395facc44edc..000000000000 --- a/net/bounce/files/patch-04 +++ /dev/null @@ -1,58 +0,0 @@ ---- bounce.c.orig Sun Aug 26 14:24:58 2007 -+++ bounce.c Sun Aug 26 14:34:57 2007 -@@ -31,6 +31,7 @@ - #define DEFAULT_PORT 1523 - - char sbuf[16384], cbuf[16384]; -+int t=0; - - void sigchld() { - signal(SIGCHLD, sigchld); -@@ -46,12 +47,15 @@ - - struct itimerval itime; - -+ if (t) -+ { - itime.it_interval.tv_sec=0; - itime.it_interval.tv_usec=0; -- itime.it_value.tv_sec=21600; -+ itime.it_value.tv_sec=t; - itime.it_value.tv_usec=0; - setitimer(ITIMER_REAL,&itime,NULL); - /* arbitrary connection time limit: 6 hours (in case the client hangs) */ -+ } - - chead=ctail=cbuf; - cpos=0; -@@ -153,7 +157,7 @@ - - /* Process arguments */ - -- while( (ch = getopt(argc, argv, "p:a:b:d")) != -1 ) { -+ while( (ch = getopt(argc, argv, "p:a:b:dt:")) != -1 ) { - switch(ch) { - case 'b': b = 1; - case 'd': d = 1; break; -@@ -172,6 +176,12 @@ - exit(-1); - } - break; -+ case 't': -+ if ((t=atoi(optarg)) == 0) { -+ fprintf(stderr, "Bad timer value.\n"); -+ exit(-1); -+ } -+ break; - } - } - -@@ -179,7 +189,7 @@ - argv += optind; - - if (argc!=2) { -- fprintf(stderr,"Use: %s [-a localaddr | -b localaddr] [-p localport] [-d] machine port \n",myname); -+ fprintf(stderr,"Use: %s [-a localaddr | -b localaddr] [-d] [-p localport] [-t timer] machine port \n",myname); - exit(-1); - } - if ((remoteport=atoi(argv[1]))<=0) { diff --git a/net/bounce/files/patch-01 b/net/bounce/files/patch-bounce.c index 573c6777527a..285bb479be1f 100644 --- a/net/bounce/files/patch-01 +++ b/net/bounce/files/patch-bounce.c @@ -1,5 +1,5 @@ ---- bounce.c.orig Fri Jan 14 20:47:39 2000 -+++ bounce.c Fri Jan 14 20:48:56 2000 +--- bounce.c.old 2008-09-02 14:10:20.000000000 -0300 ++++ bounce.c 2008-09-02 14:10:29.000000000 -0300 @@ -1,5 +1,7 @@ /* socket bouncer, by orabidoo 12 Feb '95 using code from mark@cairo.anu.edu.au's general purpose telnet server. @@ -8,7 +8,7 @@ */ #include <stdio.h> -@@ -20,13 +22,15 @@ +@@ -20,13 +22,16 @@ #include <sys/ioctl.h> #include <signal.h> #include <sys/wait.h> @@ -23,12 +23,36 @@ char sbuf[16384], cbuf[16384]; -extern int errno; -extern char *sys_errlist[]; ++int t=0; void sigchld() { signal(SIGCHLD, sigchld); -@@ -138,27 +142,45 @@ +@@ -42,12 +47,15 @@ + + struct itimerval itime; + ++ if (t) ++ { + itime.it_interval.tv_sec=0; + itime.it_interval.tv_usec=0; +- itime.it_value.tv_sec=21600; ++ itime.it_value.tv_sec=t; + itime.it_value.tv_usec=0; + setitimer(ITIMER_REAL,&itime,NULL); + /* arbitrary connection time limit: 6 hours (in case the client hangs) */ ++ } + + chead=ctail=cbuf; + cpos=0; +@@ -134,31 +142,65 @@ + } + + int main(int argc,char *argv[]) { +- int srv_fd, rem_fd, len, cl_fd, on=1; ++ int srv_fd, rem_fd, len, cl_fd, on=1, b=0, d=0; int myport=DEFAULT_PORT, remoteport; - struct sockaddr_in rem_addr, srv_addr, cl_addr; +- struct sockaddr_in rem_addr, srv_addr, cl_addr; ++ struct sockaddr_in rem_addr, srv_addr, cl_addr, src_addr; char *myname; - struct hostent *hp; + struct hostent *hp, *hpLocal; @@ -36,6 +60,7 @@ + extern char *optarg; + extern int optind; + char *hostname = NULL; ++ char *sourcename = NULL; + char ch; myname=argv[0]; @@ -53,8 +78,16 @@ + + /* Process arguments */ + -+ while( (ch = getopt(argc, argv, "p:a:")) != -1 ) { ++ while( (ch = getopt(argc, argv, "p:a:b:dt:")) != -1 ) { + switch(ch) { ++ case 'b': b = 1; ++ sourcename = malloc( strlen(optarg) + 1); ++ if( !sourcename ) { ++ fprintf( stderr, "Can't allocate memory!\n" ); ++ exit(-1); + } ++ strcpy( sourcename, optarg ); ++ break; + case 'a': + hostname = malloc( strlen(optarg) + 1); + if( !hostname ) { @@ -64,11 +97,18 @@ + strcpy( hostname, optarg ); + break; + ++ case 'd': d = 1; break; + case 'p': + if ((myport=atoi(optarg))==0) { + fprintf(stderr,"Bad port number.\n"); + exit(-1); - } ++ } ++ break; ++ case 't': ++ if ((t=atoi(optarg)) == 0) { ++ fprintf(stderr, "Bad timer value.\n"); ++ exit(-1); ++ } + break; + } } @@ -79,7 +119,7 @@ + argv += optind; + + if (argc!=2) { -+ fprintf(stderr,"Use: %s [-a localaddr] [-p localport] machine port \n",myname); ++ fprintf(stderr,"Use: %s [-a localaddr | -b localaddr] [-d] [-p localport] [-t timer] machine port \n",myname); exit(-1); } - if ((remoteport=atoi(argv[2]))<=0) { @@ -87,7 +127,11 @@ fprintf(stderr, "Bad remote port number.\n"); exit(-1); } -@@ -169,8 +191,8 @@ +@@ -166,11 +208,12 @@ + memset((char *) &rem_addr, 0, sizeof(rem_addr)); + memset((char *) &srv_addr, 0, sizeof(srv_addr)); + memset((char *) &cl_addr, 0, sizeof(cl_addr)); ++ memset((char *) &src_addr, 0, sizeof(src_addr)); cl_addr.sin_family=AF_INET; cl_addr.sin_port=htons(remoteport); @@ -98,7 +142,7 @@ if (cl_addr.sin_addr.s_addr==-1) { fprintf(stderr, "Unknown host.\n"); exit(-1); -@@ -178,11 +200,22 @@ +@@ -178,19 +221,43 @@ } else cl_addr.sin_addr=*(struct in_addr *)(hp->h_addr_list[0]); @@ -113,6 +157,18 @@ + srv_addr.sin_addr=*(struct in_addr *)(hp->h_addr_list[0]); + } + ++ if( sourcename ) { ++ if ((hpLocal=gethostbyname(sourcename))==NULL) { ++ src_addr.sin_addr.s_addr=inet_addr(sourcename); ++ if (src_addr.sin_addr.s_addr==-1) { ++ fprintf(stderr, "Unknown host: %s\n", sourcename); ++ exit(-1); ++ } ++ } else ++ src_addr.sin_addr=*(struct in_addr *)(hp->h_addr_list[0]); ++ } ++ src_addr.sin_family=AF_INET; ++ srv_addr.sin_family=AF_INET; - srv_addr.sin_addr.s_addr=htonl(INADDR_ANY); + /* srv_addr.sin_addr.s_addr=htonl(INADDR_ANY); */ @@ -123,7 +179,8 @@ perror("bind"); exit(-1); } -@@ -190,7 +223,7 @@ + listen(srv_fd,QLEN); ++ srv_addr.sin_port=0; signal(SIGCHLD, sigchld); printf("Ready to bounce connections from port %i to %s on port %i\n", @@ -132,7 +189,7 @@ close(0); close(1); close(2); chdir("/"); #ifdef TIOCNOTTY -@@ -202,11 +235,13 @@ +@@ -202,11 +269,13 @@ if (fork()) exit(0); while (1) { len=sizeof(rem_addr); @@ -147,3 +204,21 @@ switch(fork()) { case -1: /* we're in the background.. no-one to complain to */ +@@ -220,6 +289,17 @@ + close(rem_fd); + exit(-1); + } ++ if (b) { src_addr.sin_port=0; ++ if (bind(cl_fd,(struct sockaddr *)&src_addr,sizeof(src_addr))<0) { ++ close(rem_fd); ++ exit(-1); ++ } ++ } ++ if (d) { ++ if ((hp=gethostbyname(argv[0]))!=NULL) { ++ cl_addr.sin_addr=*(struct in_addr *)(hp->h_addr_list[0]); ++ } ++ } + if (connect(cl_fd, (struct sockaddr *)&cl_addr, + sizeof(cl_addr))<0) { + close(rem_fd); diff --git a/net/bounce/pkg-plist b/net/bounce/pkg-plist deleted file mode 100644 index fb7e97e1b366..000000000000 --- a/net/bounce/pkg-plist +++ /dev/null @@ -1,2 +0,0 @@ -@comment $FreeBSD$ -sbin/bounce |