Date: Sat, 4 Jan 2003 19:15:49 -0600 From: Tilghman Lesher <tilghman@mail.jeffandtilghman.com> To: ports@freebsd.org Subject: Patch for /usr/ports/net/bounce Message-ID: <20030105011549.GA38859@jeff.jeffandtilghman.com>
next in thread | raw e-mail | index | archive | help
--pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Here's a patch for the bounce port, located in the net subdirectory of the ports tree. It allows for the use of service names when invoking bounce. The main attraction of doing this is when you're looking at your process list, you can more easily know which service you're bouncing. For example: bounce -p 119 10.0.0.25 119 versus bounce -p nntp 10.0.0.25 nntp The patch is diff'ed against the already patched version in the ports tree, so it could be simply put into the ports tree at: /usr/ports/net/bounce/files/patch-02 -Tilghman --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="bounce.c.patch-02" *** /usr/ports/net/bounce/work/bounce.c.old Sat Jan 4 19:01:49 2003 --- /usr/ports/net/bounce/work/bounce.c Sat Jan 4 19:14:36 2003 *************** *** 2,7 **** --- 2,9 ---- using code from mark@cairo.anu.edu.au's general purpose telnet server. Hacked by scot@poptart.org (April 1999) to allow a local bind address and syslog logging. + Extra hack by fbsd-ports@the-tilghman.com (January 2002) to allow service + names to be used, instead of (in addition to) port numbers. */ #include <stdio.h> *************** *** 9,14 **** --- 11,17 ---- #include <sys/socket.h> #include <sys/time.h> #include <sys/resource.h> + #include <netdb.h> #ifdef _AIX #include <sys/select.h> *************** *** 166,173 **** case 'p': if ((myport=atoi(optarg))==0) { ! fprintf(stderr,"Bad port number.\n"); ! exit(-1); } break; } --- 169,184 ---- case 'p': if ((myport=atoi(optarg))==0) { ! /* Lookup service */ ! struct servent *se = NULL; ! ! se = getservbyname(optarg,"tcp"); ! if (se != NULL) { ! myport = ntohs(se->s_port); ! } else { ! fprintf(stderr,"Bad port number.\n"); ! exit(-1); ! } } break; } *************** *** 181,188 **** --- 192,207 ---- exit(-1); } if ((remoteport=atoi(argv[1]))<=0) { + /* Lookup service */ + struct servent *se = NULL; + + se = getservbyname(argv[1],"tcp"); + if (se != NULL) { + remoteport = ntohs(se->s_port); + } else { fprintf(stderr, "Bad remote port number.\n"); exit(-1); + } } memset((char *) &rem_addr, 0, sizeof(rem_addr)); --pWyiEgJYm5f9v55/-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030105011549.GA38859>