From owner-freebsd-ports-bugs@FreeBSD.ORG Mon Apr 24 13:20:11 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 957F816A400 for ; Mon, 24 Apr 2006 13:20:11 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4BF5B43D46 for ; Mon, 24 Apr 2006 13:20:10 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k3ODKA30049039 for ; Mon, 24 Apr 2006 13:20:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k3ODKAi6049038; Mon, 24 Apr 2006 13:20:10 GMT (envelope-from gnats) Resent-Date: Mon, 24 Apr 2006 13:20:10 GMT Resent-Message-Id: <200604241320.k3ODKAi6049038@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, SeaD Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6D67516A40A for ; Mon, 24 Apr 2006 13:11:01 +0000 (UTC) (envelope-from sead@mail.ru) Received: from f43.mail.ru (f43.mail.ru [194.67.57.81]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7A9E143D45 for ; Mon, 24 Apr 2006 13:10:59 +0000 (GMT) (envelope-from sead@mail.ru) Received: from mail by f43.mail.ru with local id 1FY0q6-000KQn-00; Mon, 24 Apr 2006 17:10:54 +0400 Received: from [195.137.200.184] by win.mail.ru with HTTP; Mon, 24 Apr 2006 19:10:54 +0600 Message-Id: Date: Mon, 24 Apr 2006 19:10:54 +0600 From: SeaD To: "freebsd-gnats-submit@freebsd.org" Cc: obrien@NUXI.com Subject: ports/96263: port update: net/bounce . bind outgoing connection X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: SeaD List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2006 13:20:11 -0000 >Number: 96263 >Category: ports >Synopsis: port update: net/bounce . bind outgoing connection >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Mon Apr 24 13:20:09 GMT 2006 >Closed-Date: >Last-Modified: >Originator: SeaD >Release: FreeBSD 6.0-RELEASE-p3 i386 >Organization: >Environment: System: FreeBSD newcom.perm.ws 6.0-RELEASE-p3 FreeBSD 6.0-RELEASE-p3 #2: Mon Feb 27 19:34:42 YEKT 2006 sead@newcom.perm.ws:/usr/obj/usr/src/sys/KNEWCOM i386 >Description: Small port update. >How-To-Repeat: >Fix: # 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: # # /usr/ports/net/bounce/ # /usr/ports/net/bounce/files # /usr/ports/net/bounce/files/patch-01 # /usr/ports/net/bounce/files/patch-02 # /usr/ports/net/bounce/Makefile # /usr/ports/net/bounce/distinfo # /usr/ports/net/bounce/pkg-descr # /usr/ports/net/bounce/pkg-plist # echo c - /usr/ports/net/bounce/ mkdir -p /usr/ports/net/bounce/ > /dev/null 2>&1 echo c - /usr/ports/net/bounce/files mkdir -p /usr/ports/net/bounce/files > /dev/null 2>&1 echo x - /usr/ports/net/bounce/files/patch-01 sed 's/^X//' >/usr/ports/net/bounce/files/patch-01 << 'END-of-/usr/ports/net/bounce/files/patch-01' X--- bounce.c.orig Fri Jan 14 20:47:39 2000 X+++ bounce.c Fri Jan 14 20:48:56 2000 X@@ -1,5 +1,7 @@ X /* socket bouncer, by orabidoo 12 Feb '95 X using code from mark@cairo.anu.edu.au's general purpose telnet server. X+ Hacked by scot@poptart.org (April 1999) to allow a local bind address X+ and syslog logging. X */ X X #include X@@ -20,13 +22,15 @@ X #include X #include X #include X+#include X+#include X+#include X+#include X X #define QLEN 5 X #define DEFAULT_PORT 1523 X X char sbuf[16384], cbuf[16384]; X-extern int errno; X-extern char *sys_errlist[]; X X void sigchld() { X signal(SIGCHLD, sigchld); X@@ -138,27 +142,45 @@ X int myport=DEFAULT_PORT, remoteport; X struct sockaddr_in rem_addr, srv_addr, cl_addr; X char *myname; X- struct hostent *hp; X+ struct hostent *hp, *hpLocal; X+ X+ extern char *optarg; X+ extern int optind; X+ char *hostname = NULL; X+ char ch; X X myname=argv[0]; X- if (argc==5) { X- if (strcmp(argv[1],"-p")==0) { X- if ((myport=atoi(argv[2]))==0) { X- fprintf(stderr,"Bad port number.\n"); X- exit(-1); X- } X- argv+=2; X- argc-=2; X- } else { X- fprintf(stderr,"Use: %s [-p localport] machine port \n",myname); X- exit(-1); X+ X+ /* Process arguments */ X+ X+ while( (ch = getopt(argc, argv, "p:a:")) != -1 ) { X+ switch(ch) { X+ case 'a': X+ hostname = malloc( strlen(optarg) + 1); X+ if( !hostname ) { X+ fprintf( stderr, "Can't allocate memory!\n" ); X+ exit(-1); X+ } X+ strcpy( hostname, optarg ); X+ break; X+ X+ case 'p': X+ if ((myport=atoi(optarg))==0) { X+ fprintf(stderr,"Bad port number.\n"); X+ exit(-1); X } X+ break; X+ } X } X- if (argc!=3) { X- fprintf(stderr,"Use: %s [-p localport] machine port \n",myname); X+ X+ argc -= optind; X+ argv += optind; X+ X+ if (argc!=2) { X+ fprintf(stderr,"Use: %s [-a localaddr] [-p localport] machine port \n",myname); X exit(-1); X } X- if ((remoteport=atoi(argv[2]))<=0) { X+ if ((remoteport=atoi(argv[1]))<=0) { X fprintf(stderr, "Bad remote port number.\n"); X exit(-1); X } X@@ -169,8 +191,8 @@ X X cl_addr.sin_family=AF_INET; X cl_addr.sin_port=htons(remoteport); X- if ((hp=gethostbyname(argv[1]))==NULL) { X- cl_addr.sin_addr.s_addr=inet_addr(argv[1]); X+ if ((hp=gethostbyname(argv[0]))==NULL) { X+ cl_addr.sin_addr.s_addr=inet_addr(argv[0]); X if (cl_addr.sin_addr.s_addr==-1) { X fprintf(stderr, "Unknown host.\n"); X exit(-1); X@@ -178,11 +200,22 @@ X } else X cl_addr.sin_addr=*(struct in_addr *)(hp->h_addr_list[0]); X X+ if( hostname ) { X+ if ((hpLocal=gethostbyname(hostname))==NULL) { X+ srv_addr.sin_addr.s_addr=inet_addr(hostname); X+ if (srv_addr.sin_addr.s_addr==-1) { X+ fprintf(stderr, "Unknown host: %s\n", hostname); X+ exit(-1); X+ } X+ } else X+ srv_addr.sin_addr=*(struct in_addr *)(hp->h_addr_list[0]); X+ } X+ X srv_addr.sin_family=AF_INET; X- srv_addr.sin_addr.s_addr=htonl(INADDR_ANY); X+ /* srv_addr.sin_addr.s_addr=htonl(INADDR_ANY); */ X srv_addr.sin_port=htons(myport); X srv_fd=socket(PF_INET,SOCK_STREAM,0); X- if (bind(srv_fd,&srv_addr,sizeof(srv_addr))==-1) { X+ if (bind(srv_fd,(struct sockaddr *)&srv_addr,sizeof(srv_addr))==-1) { X perror("bind"); X exit(-1); X } X@@ -190,7 +223,7 @@ X X signal(SIGCHLD, sigchld); X printf("Ready to bounce connections from port %i to %s on port %i\n", X- myport, argv[1], remoteport); X+ myport, argv[0], remoteport); X close(0); close(1); close(2); X chdir("/"); X #ifdef TIOCNOTTY X@@ -202,11 +235,13 @@ X if (fork()) exit(0); X while (1) { X len=sizeof(rem_addr); X- rem_fd=accept(srv_fd,&rem_addr,&len); X+ rem_fd=accept(srv_fd,(struct sockaddr *)&rem_addr,&len); X if (rem_fd<0) { X if (errno==EINTR) continue; X exit(-1); X } X+ syslog( LOG_NOTICE, "connection from %s to local port %i. Bouncing to %s, %i", X+ inet_ntoa(rem_addr.sin_addr), myport, argv[0], remoteport ); X switch(fork()) { X case -1: X /* we're in the background.. no-one to complain to */ END-of-/usr/ports/net/bounce/files/patch-01 echo x - /usr/ports/net/bounce/files/patch-02 sed 's/^X//' >/usr/ports/net/bounce/files/patch-02 << 'END-of-/usr/ports/net/bounce/files/patch-02' X--- bounce.c.orig Wed Mar 15 13:21:58 2006 X+++ bounce.c Fri Mar 31 17:58:08 2006 X@@ -220,6 +220,7 @@ X exit(-1); X } X listen(srv_fd,QLEN); X+ srv_addr.sin_port=0; X X signal(SIGCHLD, sigchld); X printf("Ready to bounce connections from port %i to %s on port %i\n", X@@ -252,6 +253,10 @@ X default: /* parent process */ X close(srv_fd); /* close original socket */ X if ((cl_fd=socket(PF_INET, SOCK_STREAM, 0))<0) { X+ close(rem_fd); X+ exit(-1); X+ } X+ if (bind(cl_fd,(struct sockaddr *)&srv_addr,sizeof(srv_addr))<0) { X close(rem_fd); X exit(-1); X } END-of-/usr/ports/net/bounce/files/patch-02 echo x - /usr/ports/net/bounce/Makefile sed 's/^X//' >/usr/ports/net/bounce/Makefile << 'END-of-/usr/ports/net/bounce/Makefile' X# ex:ts=8 X# Ports collection makefile for: bounce X# Date created: Mon Dec 23, 1998 X# Whom: David O'Brien (obrien@NUXI.com) X# X# $FreeBSD: ports/net/bounce/Makefile,v 1.17 2003/02/20 18:50:52 knu Exp $ X# X XPORTNAME= bounce XPORTVERSION= 1.0 XCATEGORIES= net security XMASTER_SITES= http://www.iagora.com/~espel/ \ X ${MASTER_SITE_LOCAL} XMASTER_SITE_SUBDIR= obrien XDISTNAME= bounce XEXTRACT_SUFX= .c X XMAINTAINER= ports@FreeBSD.org XCOMMENT= Bounce tcp connections to another machine/port X XNO_WRKSUBDIR= yes X Xdo-extract: X @${MKDIR} ${WRKDIR} X @${CP} ${DISTDIR}/${DISTFILES} ${WRKDIR} X Xdo-build: X (cd ${WRKSRC} && ${CC} ${CFLAGS} -o ${DISTNAME} ${DISTNAME}.c) X Xdo-install: X ${INSTALL_PROGRAM} ${WRKSRC}/${DISTNAME} ${PREFIX}/sbin X X.include END-of-/usr/ports/net/bounce/Makefile echo x - /usr/ports/net/bounce/distinfo sed 's/^X//' >/usr/ports/net/bounce/distinfo << 'END-of-/usr/ports/net/bounce/distinfo' XMD5 (bounce.c) = 9ec7c53022f4c6a0559c7bbcc08080f1 XSHA256 (bounce.c) = 2f2174556c55dc327bb109ad1a933b378666df103b08680763acf953c0013652 XSIZE (bounce.c) = 6189 END-of-/usr/ports/net/bounce/distinfo echo x - /usr/ports/net/bounce/pkg-descr sed 's/^X//' >/usr/ports/net/bounce/pkg-descr << 'END-of-/usr/ports/net/bounce/pkg-descr' XA little program to bounce tcp connections to another machine/port. XBy default it listens on port 1523. X XAuthor: Roger Espel Llima XWWW: http://www.iagora.com/~espel/hacks.html END-of-/usr/ports/net/bounce/pkg-descr echo x - /usr/ports/net/bounce/pkg-plist sed 's/^X//' >/usr/ports/net/bounce/pkg-plist << 'END-of-/usr/ports/net/bounce/pkg-plist' X@comment $FreeBSD: ports/net/bounce/pkg-plist,v 1.3 2001/11/24 01:32:22 petef Exp $ Xsbin/bounce END-of-/usr/ports/net/bounce/pkg-plist exit >Release-Note: >Audit-Trail: >Unformatted: