rpms/redir/F-9 01_fix_max_bandwidth_docs.dpatch, NONE, 1.1 02_use_ntohs.dpatch, NONE, 1.1 03_fix_tcp_wrappers.dpatch, NONE, 1.1 04_fix_timeouts.dpatch, NONE, 1.1 05_pedantic.dpatch, NONE, 1.1 06_fix_shaper_buffer.dpatch, NONE, 1.1 07_cosmetics.dpatch, NONE, 1.1 08_add_wrappers.dpatch, NONE, 1.1 09_add_linux_software_map.dpatch, NONE, 1.1 15_deb_cosmetics.dpatch, NONE, 1.1 20_do_not_strip.dpatch, NONE, 1.1 25_fix_setsockopt.dpatch, NONE, 1.1 30_fix_manpage.dpatch, NONE, 1.1 31_fix_transproxy_location.patch, NONE, 1.1 import.log, NONE, 1.1 redir.spec, NONE, 1.1 redir_gcc4.4-signedness.patch, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Itamar Reis Peixoto itamarjp at fedoraproject.org
Tue Apr 7 10:31:32 UTC 2009


Author: itamarjp

Update of /cvs/pkgs/rpms/redir/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv10493/F-9

Modified Files:
	.cvsignore sources 
Added Files:
	01_fix_max_bandwidth_docs.dpatch 02_use_ntohs.dpatch 
	03_fix_tcp_wrappers.dpatch 04_fix_timeouts.dpatch 
	05_pedantic.dpatch 06_fix_shaper_buffer.dpatch 
	07_cosmetics.dpatch 08_add_wrappers.dpatch 
	09_add_linux_software_map.dpatch 15_deb_cosmetics.dpatch 
	20_do_not_strip.dpatch 25_fix_setsockopt.dpatch 
	30_fix_manpage.dpatch 31_fix_transproxy_location.patch 
	import.log redir.spec redir_gcc4.4-signedness.patch 
Log Message:
Initial RPM



--- NEW FILE 01_fix_max_bandwidth_docs.dpatch ---

#! /bin/sh /usr/share/dpatch/dpatch-run
## 01_fix_max_bandwidth_docs.dpatch by Daniel Kahn Gillmor <dkg at fifthhorseman.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix docs and --help to show --max_bandwidth instead of --maxbandwidth

@DPATCH@
diff -urNad redir-2.2.1~/redir.c redir-2.2.1/redir.c
--- redir-2.2.1~/redir.c	1999-12-26 15:50:06.000000000 -0500
+++ redir-2.2.1/redir.c	2005-10-22 21:21:56.849499952 -0400
@@ -233,7 +233,7 @@
 #ifndef NO_SHAPER
         /* options for bandwidth */
         fprintf(stderr, "\t\t--bufsize=<octets>\tsize of the buffer\n");
-        fprintf(stderr, "\t\t--maxbandwidth=<bit-per-sec>\tlimit the bandwidth\n");
+        fprintf(stderr, "\t\t--max_bandwidth=<bit-per-sec>\tlimit the bandwidth\n");
         fprintf(stderr, "\t\t--random_wait=<millisec>\twait before each packet\n");
         fprintf(stderr, "\t\t--wait_in_out=<flag>\t1 wait for in, 2 out, 3 in&out\n");
         /* end options for bandwidth */
diff -urNad redir-2.2.1~/redir.man redir-2.2.1/redir.man
--- redir-2.2.1~/redir.man	1999-12-26 15:52:24.000000000 -0500
+++ redir-2.2.1/redir.man	2005-10-22 21:22:28.882630176 -0400
@@ -18,7 +18,7 @@
 .I --lport=port
 .I --cport=port
 .RB [ \--bufsize=n ]
-.RB [ \--maxbandwidth=n ]
+.RB [ \--max_bandwidth=n ]
 .RB [ \--random_wait=n ]
 .RB [ \--wait_in_out=n ]
 .ll -8
@@ -35,7 +35,7 @@
 .RB [ \--connect=host:port ]
 .I --cport=port
 .RB [ \--bufsize=n ]
-.RB [ \--maxbandwidth=n ]
+.RB [ \--max_bandwidth=n ]
 .RB [ \--random_wait=n ]
 .RB [ \--wait_in_out=n ]
 .ll -8
@@ -102,9 +102,9 @@
 .TP
 .B \--bufsize n
 Set the bufsize (defaut 4096) in bytes. Can be used combined with
---maxbandwidth or --random_wait to simulate a slow connection.
+--max_bandwidth or --random_wait to simulate a slow connection.
 .TP
-.B \--maxbandwidth n
+.B \--max_bandwidth n
 Reduce the bandwidth to be no more than n bits/sec.  The algorithme is
 basic, the goal is to simulate a slow connection, so there is no pic
 acceptance.
@@ -115,7 +115,7 @@
 than the bufsize (see also --bufsize).
 .TP
 .B \--wait_in_out n
-Apply --maxbandwidth and --random_wait for input if n=1, output if n=2 and
+Apply --max_bandwidth and --random_wait for input if n=1, output if n=2 and
 both if n=3.
 .SH "SEE ALSO"
 inetd(1)



--- NEW FILE 02_use_ntohs.dpatch ---

#! /bin/sh /usr/share/dpatch/dpatch-run
## 02_use_ntohs.dpatch by Daniel Kahn Gillmor <dkg at fifthhorseman.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: use ntohs() to generate comprehensible debug()s and syslog()s.

@DPATCH@
diff -urNad redir-2.2.1~/redir.c redir-2.2.1/redir.c
--- redir-2.2.1~/redir.c	1999-12-26 15:50:06.000000000 -0500
+++ redir-2.2.1/redir.c	2005-10-22 21:29:55.491735272 -0400
@@ -745,7 +745,7 @@
 	}
      
 	debug1("peer IP is %s\n", inet_ntoa(client.sin_addr));
-	debug1("peer socket is %d\n", client.sin_port);
+	debug1("peer socket is %d\n", ntohs(client.sin_port));
 
 	/*
 	 * Double fork here so we don't have to wait later
@@ -871,8 +871,8 @@
 		strcpy(tmp2, inet_ntoa(target->sin_addr));
 	  
 		syslog(LOG_NOTICE, "connecting %s/%d to %s/%d",
-		       tmp1, client.sin_port,
-		       tmp2, target->sin_port);
+		       tmp1, ntohs(client.sin_port),
+		       tmp2, ntohs(target->sin_port));
 	}
 
 	/* do proxy stuff */
@@ -1066,7 +1066,7 @@
 
 		if (!getpeername(0, (struct sockaddr *) &client, &client_size)) {
 			debug1("peer IP is %s\n", inet_ntoa(client.sin_addr));
-			debug1("peer socket is %d\n", client.sin_port);
+			debug1("peer socket is %d\n", ntohs(client.sin_port));
 		}
 		if ((targetsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
 			perror("target: socket");
@@ -1109,8 +1109,8 @@
 
 		if (dosyslog) {
 			syslog(LOG_NOTICE, "connecting %s/%d to %s/%d",
-			       inet_ntoa(client.sin_addr), client.sin_port,
-			       target_ip, target.sin_port);
+			       inet_ntoa(client.sin_addr), ntohs(client.sin_port),
+			       target_ip, ntohs(target.sin_port));
 		}
 
 		/* Just start copying - one side of the loop is stdin - 0 */



--- NEW FILE 03_fix_tcp_wrappers.dpatch ---

#! /bin/sh /usr/share/dpatch/dpatch-run
## 03_fix_tcp_wrappers.dpatch by Daniel Kahn Gillmor <dkg at fifthhorseman.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: fix calls to tcp wrappers

@DPATCH@
diff -urNad redir-2.2.1~/redir.c redir-2.2.1/redir.c
--- redir-2.2.1~/redir.c	2005-10-22 22:10:11.439455392 -0400
+++ redir-2.2.1/redir.c	2005-10-22 22:10:51.625346208 -0400
@@ -802,8 +802,8 @@
 #ifdef USE_TCP_WRAPPERS
 	request_init(&request, RQ_DAEMON, ident, RQ_FILE, clisock, 0);
 	sock_host(&request);
-	sock_hostname(&request);
-	sock_hostaddr(&request);
+	sock_hostname(request.client);
+	sock_hostaddr(request.client);
 
 	if (!hosts_access(&request)) {
 		refuse(&request);
@@ -1057,8 +1057,8 @@
 #ifdef USE_TCP_WRAPPERS
 		request_init(&request, RQ_DAEMON, ident, RQ_FILE, 0, 0);
 		sock_host(&request);
-		sock_hostname(&request);
-		sock_hostaddr(&request);
+		sock_hostname(request.client);
+		sock_hostaddr(request.client);
 	
 		if (!hosts_access(&request))
 			refuse(&request);



--- NEW FILE 04_fix_timeouts.dpatch ---

#! /bin/sh /usr/share/dpatch/dpatch-run
## 04_fix_timeouts.dpatch by Daniel Kahn Gillmor <dkg at fifthhorseman.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Apply a close approximation of Robert de Bath's patch for bug #142382

@DPATCH@
diff -urNad redir-2.2.1~/redir.c redir-2.2.1/redir.c
--- redir-2.2.1~/redir.c	2005-10-22 22:44:39.504061784 -0400
+++ redir-2.2.1/redir.c	2005-10-22 22:47:14.746461352 -0400
@@ -598,10 +598,6 @@
 	/* Record start time */
 	start_time = (unsigned int) time(NULL);
 
-	/* Set up timeout */
-	timeout.tv_sec = timeout_secs;
-	timeout.tv_usec = 0;
-
 	/* file descriptor bits */
 	FD_ZERO(&iofds);
 	FD_SET(insock, &iofds);
@@ -618,14 +614,21 @@
 	while(1) {
 		(void) memcpy(&c_iofds, &iofds, sizeof(iofds));
 
+		/* Set up timeout, Linux returns seconds left in this structure
+		 * so we have to reset it before each select(). */
+		timeout.tv_sec = timeout_secs;
+		timeout.tv_usec = 0;
+
 
 		if (select(max_fd + 1,
 			   &c_iofds,
 			   (fd_set *)0,
 			   (fd_set *)0,
 			   (timeout_secs ? &timeout : NULL)) <= 0) {
-			/*	    syslog(LLEV,"connection timeout: %d sec",timeout.tv_sec);*/
-			break;
+		  if (dosyslog) {
+		    syslog(LOG_NOTICE,"connection timeout: %d sec",timeout_secs);
+		  }
+		  break;
 		}
 
 		if(FD_ISSET(insock, &c_iofds)) {



--- NEW FILE 05_pedantic.dpatch ---

#! /bin/sh /usr/share/dpatch/dpatch-run
## 05_pedantic.dpatch by Daniel Kahn Gillmor <dkg at fifthhorseman.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: changes to make clean up compilation

@DPATCH@
diff -urNad redir-2.2.1~/Makefile redir-2.2.1/Makefile
--- redir-2.2.1~/Makefile	2005-10-22 23:11:41.000000000 -0400
+++ redir-2.2.1/Makefile	2005-10-22 23:11:48.818368360 -0400
@@ -32,7 +32,7 @@
 # if your system lacks getopt_long, remove the comment from this line
 OBJS = redir.o $(GETOPT_OBJS)
 
-CFLAGS = -O2 -Wall $(STR_CFLAGS) $(WRAP_CFLAGS) $(EXTRA_CFLAGS)
+CFLAGS = -O2 -Wall --pedantic $(STR_CFLAGS) $(WRAP_CFLAGS) $(EXTRA_CFLAGS)
 LDFLAGS = -s
 
 # solaris, and others, may also need these libraries to link
diff -urNad redir-2.2.1~/redir.c redir-2.2.1/redir.c
--- redir-2.2.1~/redir.c	2005-10-22 23:11:48.282449832 -0400
+++ redir-2.2.1/redir.c	2005-10-22 23:12:23.201141384 -0400
@@ -73,6 +73,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/time.h>
+#include <time.h>
 #include <sys/wait.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -460,7 +461,7 @@
 	int lport, rport;
 	int remip[4];
 	int localsock;
-	int socksize = sizeof(struct sockaddr_in);
+	size_t socksize = sizeof(struct sockaddr_in);
 
 	struct sockaddr_in newsession;
 	struct sockaddr_in sockname;
@@ -509,7 +510,7 @@
 	if(getsockname(localsock, (struct sockaddr *)&sockname, &socksize) < 0) {
 		perror("getsockname");
 		if (dosyslog)
-			syslog(LOG_ERR, "getsockname failed: %m");
+			syslog(LOG_ERR, "getsockname failed: %s",strerror(errno));
 		exit(1);
 	}
 
@@ -562,7 +563,7 @@
 	switch(fork())
 	{
      	case -1: /* Error */
-     		syslog(LOG_ERR, "Couldn't fork: %m");
+     		syslog(LOG_ERR, "Couldn't fork: %s",strerror(errno));
      		_exit(1);
      	case 0:  /* Child */
 	{
@@ -723,7 +724,7 @@
 	int clisock;
 	int targetsock;
 	struct sockaddr_in client;
-	int clientlen = sizeof(client);
+	size_t clientlen = sizeof(client);
 	int accept_errno;
      
 	debug("top of accept loop\n");
@@ -734,7 +735,7 @@
 		perror("server: accept");
 
 		if (dosyslog)
-			syslog(LOG_ERR, "accept failed: %m");
+			syslog(LOG_ERR, "accept failed: %s",strerror(errno));
 
 		/* determine if this error is fatal */
 		switch(accept_errno) {
@@ -768,7 +769,7 @@
      		perror("(server) fork");
 
      		if (dosyslog)
-     			syslog(LOG_ERR, "(server) fork failed: %m");
+     			syslog(LOG_ERR, "(server) fork failed: %s",strerror(errno));
 
      		_exit(1);
      	case 0:  /* Child */
@@ -795,7 +796,7 @@
      		perror("(child) fork");
 
      		if (dosyslog)
-     			syslog(LOG_ERR, "(child) fork failed: %m");
+     			syslog(LOG_ERR, "(child) fork failed: %s",strerror(errno));
 
      		_exit(1);
      	case 0:  /* Child */
@@ -826,7 +827,7 @@
 		perror("target: socket");
 	  
 		if (dosyslog)
-			syslog(LOG_ERR, "socket failed: %m");
+			syslog(LOG_ERR, "socket failed: %s",strerror(errno));
 		
 		_exit(1);
 	}
@@ -850,7 +851,7 @@
    only be different if the input value is 0 (let the system pick a 
    port) */
 			if (dosyslog)
-				syslog(LOG_ERR, "bind failed: %m");
+				syslog(LOG_ERR, "bind failed: %s",strerror(errno));
 
 			_exit(1);
 		}
@@ -862,7 +863,7 @@
 		perror("target: connect");
 
 		if (dosyslog)
-			syslog(LOG_ERR, "bind failed: %m");
+			syslog(LOG_ERR, "bind failed: %s",strerror(errno));
 
 		_exit(1);
 	}
@@ -923,7 +924,7 @@
 			perror("server: socket");
 
 			if (dosyslog)
-				syslog(LOG_ERR, "socket failed: %m");
+				syslog(LOG_ERR, "socket failed: %s",strerror(errno));
 
 			exit(1);
 		}
@@ -962,7 +963,7 @@
 			perror("server: bind");
 
 			if (dosyslog)
-				syslog(LOG_ERR, "bind failed: %m");
+				syslog(LOG_ERR, "bind failed: %s",strerror(errno));
 
 			exit(1);
 		}
@@ -980,7 +981,7 @@
 			perror("server: listen");
 
 			if (dosyslog)
-				syslog(LOG_ERR, "listen failed: %m");
+				syslog(LOG_ERR, "listen failed: %s",strerror(errno));
 
 			exit(1);
 		}
@@ -1059,7 +1060,7 @@
 	if (inetd) {
 		int targetsock;
 		struct sockaddr_in client;
-		int client_size = sizeof(client);
+		size_t client_size = sizeof(client);
 
 #ifdef USE_TCP_WRAPPERS
 		request_init(&request, RQ_DAEMON, ident, RQ_FILE, 0, 0);
@@ -1079,7 +1080,7 @@
 			perror("target: socket");
 
 			if (dosyslog)
-				syslog(LOG_ERR, "targetsock failed: %m");
+				syslog(LOG_ERR, "targetsock failed: %s",strerror(errno));
 
 			exit(1);
 		}
@@ -1097,7 +1098,7 @@
 				perror("bind_addr: cannot bind to forcerd outgoing addr");
 				 
 				if (dosyslog)
-					syslog(LOG_ERR, "bind failed: %m");
+					syslog(LOG_ERR, "bind failed: %s",strerror(errno));
 				 
 				exit(1);
 			}
@@ -1109,7 +1110,7 @@
 			perror("target: connect");
 
 			if (dosyslog)
-				syslog(LOG_ERR, "connect failed: %m");
+				syslog(LOG_ERR, "connect failed: %s",strerror(errno));
 
 			exit(1);
 		}



--- NEW FILE 06_fix_shaper_buffer.dpatch ---

#! /bin/sh /usr/share/dpatch/dpatch-run
## 06_fix_shaper_buffer.dpatch by Daniel Kahn Gillmor <dkg at fifthhorseman.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: properly allocate copyloop buffer

@DPATCH@
diff -urNad redir-2.2.1~/redir.c redir-2.2.1/redir.c
--- redir-2.2.1~/redir.c	2005-10-22 23:20:05.235901424 -0400
+++ redir-2.2.1/redir.c	2005-10-22 23:22:20.198384008 -0400
@@ -260,7 +260,7 @@
 #endif
 	   int *transproxy,
 #ifndef NO_SHAPER
-           unsigned int * bufsize,
+           unsigned int * bufsizeout,
            int * max_bandwidth,
            int * random_wait,
            int * wait_in_out,
@@ -367,7 +367,7 @@
 
 #ifndef NO_SHAPER
                 case 'z':
-                  *bufsize = (unsigned int)atol(optarg);
+                  *bufsizeout = (unsigned int)atol(optarg);
                   break;
  
                 case 'm':
@@ -594,7 +594,7 @@
 	unsigned long bytes_in = 0;
 	unsigned long bytes_out = 0;
 	unsigned int start_time, end_time;
-	char buf[bufsize];
+	char* buf = malloc(bufsize);
 
 	/* Record start time */
 	start_time = (unsigned int) time(NULL);
@@ -637,7 +637,7 @@
 		}
 
 		if(FD_ISSET(insock, &c_iofds)) {
-			if((bytes = read(insock, buf, sizeof(buf))) <= 0)
+			if((bytes = read(insock, buf, bufsize)) <= 0)
 				break;
 #ifndef NO_FTP
 			if (ftp & FTP_PORT)
@@ -652,7 +652,7 @@
 			bytes_out += bytes;
 		}
 		if(FD_ISSET(outsock, &c_iofds)) {
-			if((bytes = read(outsock, buf, sizeof(buf))) <= 0)
+			if((bytes = read(outsock, buf, bufsize)) <= 0)
 				break;
 			/* if we're correcting for PASV on ftp redirections, then
 			   fix buf and bytes to have the new address, among other
@@ -689,6 +689,7 @@
 		syslog(LOG_NOTICE, "disconnect %d secs, %ld in %ld out",
 		       (end_time - start_time), bytes_in, bytes_out);
 	}
+	free(buf);
 	return;
 }
 



--- NEW FILE 07_cosmetics.dpatch ---

#! /bin/sh /usr/share/dpatch/dpatch-run
## 07_cosmetics.dpatch by Daniel Kahn Gillmor <dkg at fifthhorseman.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Cosmetic fixes which could be applied upstream

@DPATCH@
diff -urNad redir-2.2.1~/redir.man redir-2.2.1/redir.man
--- redir-2.2.1~/redir.man	2005-10-22 21:41:51.284918168 -0400
+++ redir-2.2.1/redir.man	2005-10-22 21:42:42.115190792 -0400
@@ -73,7 +73,7 @@
 Specify program name to be used for TCP wrapper checks and syslog logging.
 .TP
 .B --timeout
-Timeout and close the connection after n seconds on inactivity.
+Timeout and close the connection after n seconds of inactivity.
 .TP
 .B \--syslog
 Log information to syslog.
@@ -90,7 +90,7 @@
 undesirable. 
 .TP
 .B \--transproxy
-On a linux system with transparany proxying enables, causes redir to
+On a linux system with transparent proxying enabled, causes redir to
 make connections appear as if they had come from their true origin.
 (see transproxy.txt in the source archive)
 .TP



--- NEW FILE 08_add_wrappers.dpatch ---

#! /bin/sh /usr/share/dpatch/dpatch-run
## 08_add_wrappers.dpatch by Daniel Kahn Gillmor <dkg at fifthhorseman.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Enabling TCP wrapper support

@DPATCH@

--- redir-2.2.1.orig/Makefile
+++ redir-2.2.1/Makefile
@@ -9,8 +9,8 @@
 # if you would like support for TCP wrappers (and have libwrap.a
 # installed), remove these comments.
 
-WRAP_CFLAGS = # -DUSE_TCP_WRAPPERS 
-WRAP_LIBS = # -lwrap
+WRAP_CFLAGS = -DUSE_TCP_WRAPPERS 
+WRAP_LIBS = -lwrap
 
 # if your system needs any additional libraries (solaris, for example, 
 # needs the ones commented out below), edit this line.




--- NEW FILE 09_add_linux_software_map.dpatch ---

#! /bin/sh /usr/share/dpatch/dpatch-run
## 09_add_linux_software_map.dpatch by Daniel Kahn Gillmor <dkg at fifthhorseman.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Add linux software map file

@DPATCH@

--- redir-2.2.1.orig/redir-2.2.lsm
+++ redir-2.2.1/redir-2.2.lsm
@@ -0,0 +1,11 @@
+Begin3
+Title:   redir
+Version:  2.2
+Entered-date:  15DEC1999
+Description:  TCP Port redirector (for firewalls etc).
+Keywords:  tcp port redirector bouncer proxy
+Author:   sammy at oh.verio.com
+Primary-site:  sunsite.unc.edu /pub/Linux/system/Network/daemons
+   39936 redir-2.2.tar.gz
+Copying-policy:  GPL
+End




--- NEW FILE 15_deb_cosmetics.dpatch ---

#! /bin/sh /usr/share/dpatch/dpatch-run
## 15_deb_cosmetics.dpatch by Daniel Kahn Gillmor <dkg at fifthhorseman.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Cosmetic changes applicable only to debian

@DPATCH@
diff -urNad redir-2.2.1~/redir.man redir-2.2.1/redir.man
--- redir-2.2.1~/redir.man	2005-10-22 21:47:44.067287096 -0400
+++ redir-2.2.1/redir.man	2005-10-22 21:48:34.218662928 -0400
@@ -92,7 +92,7 @@
 .B \--transproxy
 On a linux system with transparent proxying enabled, causes redir to
 make connections appear as if they had come from their true origin.
-(see transproxy.txt in the source archive)
+(see /usr/share/doc/redir/transproxy.txt)
 .TP
 .B \--connect
 Redirects connections through an HTTP proxy which supports the CONNECT 



--- NEW FILE 20_do_not_strip.dpatch ---

#! /bin/sh /usr/share/dpatch/dpatch-run
## 20_do_not_strip.dpatch by Daniel Kahn Gillmor <dkg at fifthhorseman.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: don't strip by default.  let dh_strip take care of it.

@DPATCH@
diff -urNad redir-2.2.1~/Makefile redir-2.2.1/Makefile
--- redir-2.2.1~/Makefile	2007-08-15 14:53:41.908911693 -0400
+++ redir-2.2.1/Makefile	2007-08-15 14:53:59.409909018 -0400
@@ -33,7 +33,7 @@
 OBJS = redir.o $(GETOPT_OBJS)
 
 CFLAGS = -O2 -Wall --pedantic $(STR_CFLAGS) $(WRAP_CFLAGS) $(EXTRA_CFLAGS)
-LDFLAGS = -s
+LDFLAGS = # -s
 
 # solaris, and others, may also need these libraries to link
 # also edit here if you're using the TCP wrappers code



--- NEW FILE 25_fix_setsockopt.dpatch ---

#! /bin/sh /usr/share/dpatch/dpatch-run
## 25_fix_setsockopt.dpatch by Daniel Kahn Gillmor <dkg at fifthhorseman.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Ensure that the server socket has SO_REUSEADDR and SO_LINGER set properly.

@DPATCH@
diff -urNad redir~/redir.c redir/redir.c
--- redir~/redir.c	2009-03-03 17:35:12.022427586 -0500
+++ redir/redir.c	2009-03-03 17:45:28.998426896 -0500
@@ -90,8 +90,8 @@
 /* let's set up some globals... */
 int dodebug = 0;
 int dosyslog = 0;
-unsigned char reuse_addr = 1;
-unsigned char linger_opt = 0;
+int reuse_addr = 1; /* allow address reuse */
+struct linger linger_opt = { 0, 0}; /* do not linger */
 char * bind_addr = NULL;
 struct sockaddr_in addr_out;
 int timeout = 0;
@@ -906,6 +906,7 @@
 
 	int servsock;
 	struct sockaddr_in server;
+	int ret;
      
 	/*
 	 * Get a socket to work with.  This socket will
@@ -944,8 +945,30 @@
 		server.sin_addr.s_addr = htonl(inet_addr("0.0.0.0"));
 	}
      
-	setsockopt(servsock, SOL_SOCKET, SO_REUSEADDR, &reuse_addr, sizeof(reuse_addr));
-	setsockopt(servsock, SOL_SOCKET, SO_LINGER, &linger_opt, sizeof(SO_LINGER)); 
+	ret = setsockopt(servsock, SOL_SOCKET, SO_REUSEADDR, &reuse_addr, sizeof(reuse_addr));
+	if (ret != 0) {
+		if(fail) {
+			return -1;
+		}
+		else {
+			perror("server: setsockopt (SO_REUSEADDR)");
+			if (dosyslog)
+				syslog(LOG_ERR, "setsockopt failed with SO_REUSEADDR: %s",strerror(errno));
+			exit(1);
+		}
+	}
+	ret = setsockopt(servsock, SOL_SOCKET, SO_LINGER, &linger_opt, sizeof(linger_opt)); 
+	if (ret != 0) {
+		if(fail) {
+			return -1;
+		}
+		else {
+			perror("server: setsockopt (SO_LINGER)");
+			if (dosyslog)
+				syslog(LOG_ERR, "setsockopt failed with SO_LINGER: %s",strerror(errno));
+			exit(1);
+		}
+	}
      
 	/*
 	 * Try to bind the address to the socket.



--- NEW FILE 30_fix_manpage.dpatch ---

#! /bin/sh /usr/share/dpatch/dpatch-run
## 30_fix_manpage.dpatch by Daniel Kahn Gillmor <dkg at fifthhorseman.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Clean up questionable formatting in man page.

@DPATCH@
diff -urNad redir~/redir.man redir/redir.man
--- redir~/redir.man	2009-03-03 18:55:37.790428922 -0500
+++ redir/redir.man	2009-03-03 18:58:48.486428715 -0500
@@ -1,43 +1,42 @@
-.PU
 .TH REDIR 1 local
 .SH NAME
-redir \- redirect tcp connections
+redir - redirect tcp connections
 .SH SYNOPSIS
 .ll +8
 .B redir
-.RB [ \--laddr=incoming.ip.address ]
-.RB [ \--caddr=host ]
-.RB [ \--debug ]
-.RB [ \--syslog 
-.RB [ \--name=str ] 
-.RB [ \--timeout=n ]
-.RB [ \--bind_addr=my.other.ip.address ]
-.RB [ \--ftp=type ]
-.RB [ \--transproxy ]
-.RB [ \--connect=host:port ]
-.I --lport=port
-.I --cport=port
-.RB [ \--bufsize=n ]
-.RB [ \--max_bandwidth=n ]
-.RB [ \--random_wait=n ]
-.RB [ \--wait_in_out=n ]
+.RB [ \-\-laddr=incoming.ip.address ]
+.RB [ \-\-caddr=host ]
+.RB [ \-\-debug ]
+.RB [ \-\-syslog 
+.RB [ \-\-name=str ] 
+.RB [ \-\-timeout=n ]
+.RB [ \-\-bind_addr=my.other.ip.address ]
+.RB [ \-\-ftp=type ]
+.RB [ \-\-transproxy ]
+.RB [ \-\-connect=host:port ]
+.I \-\-lport=port
+.I \-\-cport=port
+.RB [ \-\-bufsize=n ]
+.RB [ \-\-max_bandwidth=n ]
+.RB [ \-\-random_wait=n ]
+.RB [ \-\-wait_in_out=n ]
 .ll -8
 .br
 .B redir
-.RB \--inetd
-.RB [ \--caddr=host ]
-.RB [ \--debug ]
-.RB [ \--syslog 
-.RB [ \--name=str ] 
-.RB [ \--timeout=n ]
-.RB [ \--ftp=type ]
-.RB [ \--transproxy ]
-.RB [ \--connect=host:port ]
-.I --cport=port
-.RB [ \--bufsize=n ]
-.RB [ \--max_bandwidth=n ]
-.RB [ \--random_wait=n ]
-.RB [ \--wait_in_out=n ]
+.RB \-\-inetd
+.RB [ \-\-caddr=host ]
+.RB [ \-\-debug ]
+.RB [ \-\-syslog ]
+.RB [ \-\-name=str ] 
+.RB [ \-\-timeout=n ]
+.RB [ \-\-ftp=type ]
+.RB [ \-\-transproxy ]
+.RB [ \-\-connect=host:port ]
+.I \-\-cport=port
+.RB [ \-\-bufsize=n ]
+.RB [ \-\-max_bandwidth=n ]
+.RB [ \-\-random_wait=n ]
+.RB [ \-\-wait_in_out=n ]
 .ll -8
 .br
 .SH DESCRIPTION
@@ -49,74 +48,73 @@
 Depending on how redir was compiled, not all options may be available.
 .SH OPTIONS
 .TP
-.B \--lport
+.B \-\-lport
 Specifies port to listen for connections on (when not running from inetd)
 .TP
-.B \--laddr
+.B \-\-laddr
 IP address to bind to when listening for connections (when not
 running from inetd) 
 .TP
-.B \--cport
+.B \-\-cport
 Specifies port to connect to.
 .TP
-.B \--caddr
+.B \-\-caddr
 Specifies remote host to connect to. (localhost if omitted)
 .TP
-.B \--inetd
+.B \-\-inetd
 Run as a process started from inetd, with the connection passed as stdin
 and stdout on startup.
 .TP
-.B \--debug
+.B \-\-debug
 Write debug output to stderr or syslog.
 .TP
-.B \--name
+.B \-\-name
 Specify program name to be used for TCP wrapper checks and syslog logging.
 .TP
-.B --timeout
+.B \-\-timeout
 Timeout and close the connection after n seconds of inactivity.
 .TP
-.B \--syslog
+.B \-\-syslog
 Log information to syslog.
 .TP
-.B \--bind_addr
+.B \-\-bind_addr
 Forces redir to pick a specific address/interface to bind to when it listens 
 for incoming connections. 
 .TP
-.B \--ftp
+.B \-\-ftp
 When using redir for an FTP server, this will cause redir to also
 redirect ftp connections.  Type should be specified as either "port",
 "pasv", or "both", to specify what type of FTP connection to handle.
-Note that --transproxy often makes one or the other (generally port)
+Note that \-\-transproxy often makes one or the other (generally port)
 undesirable. 
 .TP
-.B \--transproxy
+.B \-\-transproxy
 On a linux system with transparent proxying enabled, causes redir to
 make connections appear as if they had come from their true origin.
 (see /usr/share/doc/redir/transproxy.txt)
 .TP
-.B \--connect
+.B \-\-connect
 Redirects connections through an HTTP proxy which supports the CONNECT 
-command.  Specify the address and port of the proxy using --caddr and
---cport.  --connect requires the hostname and port which the HTTP
+command.  Specify the address and port of the proxy using \-\-caddr and
+\-\-cport.  \-\-connect requires the hostname and port which the HTTP
 proxy will be asked to connect to.
 .TP
-.B \--bufsize n
+.B \-\-bufsize n
 Set the bufsize (defaut 4096) in bytes. Can be used combined with
---max_bandwidth or --random_wait to simulate a slow connection.
+\-\-max_bandwidth or \-\-random_wait to simulate a slow connection.
 .TP
-.B \--max_bandwidth n
+.B \-\-max_bandwidth n
 Reduce the bandwidth to be no more than n bits/sec.  The algorithme is
 basic, the goal is to simulate a slow connection, so there is no pic
 acceptance.
 .TP
-.B \--random_wait n
+.B \-\-random_wait n
 Wait between 0 and 2 x n milliseconds before each "packet". A "packet" is
 a bloc of data read in one time by redir. A "packet" size is always less
-than the bufsize (see also --bufsize).
+than the bufsize (see also \-\-bufsize).
 .TP
-.B \--wait_in_out n
-Apply --max_bandwidth and --random_wait for input if n=1, output if n=2 and
+.B \-\-wait_in_out n
+Apply \-\-max_bandwidth and \-\-random_wait for input if n=1, output if n=2 and
 both if n=3.
 .SH "SEE ALSO"
 inetd(1)
-


31_fix_transproxy_location.patch:

--- NEW FILE 31_fix_transproxy_location.patch ---
diff -ruNp a/redir-2.2.1/redir.man b/redir-2.2.1/redir.man
--- a/redir-2.2.1/redir.man	2009-04-06 13:21:06.000000000 -0300
+++ b/redir-2.2.1/redir.man	2009-04-06 13:23:59.000000000 -0300
@@ -91,7 +91,7 @@ undesirable. 
 .B \-\-transproxy
 On a linux system with transparent proxying enabled, causes redir to
 make connections appear as if they had come from their true origin.
-(see /usr/share/doc/redir/transproxy.txt)
+(see /usr/share/doc/redir-2.2.1/transproxy.txt)
 .TP
 .B \-\-connect
 Redirects connections through an HTTP proxy which supports the CONNECT 


--- NEW FILE import.log ---
redir-2_2_1-3_fc11:F-9:redir-2.2.1-3.fc11.src.rpm:1239100171


--- NEW FILE redir.spec ---
Name:           redir
Version:        2.2.1
Release:        3%{?dist}
Summary:        Redirect TCP connections

Group:          Applications/Internet
License:        GPL+
URL:            http://sammy.net/~sammy/hacks/
Source0:        http://sammy.net/~sammy/hacks/%{name}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  tcp_wrappers-devel

#Include Debian Patches
Patch0:         01_fix_max_bandwidth_docs.dpatch
Patch1:         02_use_ntohs.dpatch
Patch2:         03_fix_tcp_wrappers.dpatch
Patch3:         04_fix_timeouts.dpatch
Patch4:         05_pedantic.dpatch
Patch5:         06_fix_shaper_buffer.dpatch
Patch6:         07_cosmetics.dpatch
Patch7:         08_add_wrappers.dpatch
Patch8:         09_add_linux_software_map.dpatch
Patch9:         15_deb_cosmetics.dpatch
Patch10:        20_do_not_strip.dpatch
Patch11:        25_fix_setsockopt.dpatch
Patch12:        30_fix_manpage.dpatch
#end of debian patches

Patch13:        redir_gcc4.4-signedness.patch
Patch14:        31_fix_transproxy_location.patch
%description
a port redirector, used to forward incoming connections to somewhere else.
by far the cleanest piece of code here, because someone else liked it
enough to fix it.

%prep
%setup -q

# Fix docs and --help to show --max_bandwidth instead of --maxbandwidth
%patch0 -p1

#use ntohs() to generate comprehensible debug()s and syslog()s
%patch1 -p1

#fix calls to tcp wrappers
%patch2 -p1

# fix and make timeout more verbose
%patch3 -p1

#changes to make clean up compilation, include missing time.h include
%patch4 -p1

#properly allocate copyloop buffer
%patch5 -p1

#cosmestic only patch
%patch6 -p1

#add tcp_wrapper support
%patch7 -p1

#description of redir
%patch8 -p1

#comestic only patch
%patch9 -p1

# do not stripping needed for debug-info package
%patch10 -p1

#make usage os setsockopt more verbose
%patch11 -p1

#Clean up questionable formatting in man page
%patch12 -p1

#fix compile warning with gcc 4.4
%patch13 -p2

# fix location of transproxy.txt
%patch14 -p2

# Convert to utf-8
for file in CHANGES; do
    mv $file timestamp
    iconv -f ISO-8859-1 -t UTF-8 -o $file timestamp
    touch -r timestamp $file
done

%build
make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_OPT_FLAGS"

%install
rm -rf $RPM_BUILD_ROOT
install -Dp -m 755 %{name} $RPM_BUILD_ROOT%{_sbindir}/%{name}
install -Dp -m 644 %{name}.man $RPM_BUILD_ROOT%{_mandir}/man1/%{name}.1


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc README CHANGES COPYING trans*.txt
%{_sbindir}/%{name}
%{_mandir}/man1/%{name}.1*

%changelog
* Sat Apr 04 2009 Itamar Reis Peixoto - 2.2.1-3
- fix compile warning with gcc 4.4
- include README and COPYING into %%doc section
- remove attr from files section
- convert CHANGES TO utf-8
- fix location of transproxy.txt file in manpage

* Wed Apr 01 2009 Itamar Reis Peixoto - 2.2.1-2
- Include Debian Patches

* Tue Mar 31 2009 Itamar Reis Peixoto - 2.2.1-1
- Initial RPM version

redir_gcc4.4-signedness.patch:

--- NEW FILE redir_gcc4.4-signedness.patch ---
Binary files a/redir-2.2.1/redir and b/redir-2.2.1/redir differ
diff -ruNp a/redir-2.2.1/redir.c b/redir-2.2.1/redir.c
--- a/redir-2.2.1/redir.c	2009-04-04 16:36:24.000000000 -0300
+++ b/redir-2.2.1/redir.c	2009-04-04 16:46:06.000000000 -0300
@@ -461,7 +461,7 @@ void ftp_clean(int send, char *buf, unsi
 	int lport, rport;
 	int remip[4];
 	int localsock;
-	size_t socksize = sizeof(struct sockaddr_in);
+	unsigned int socksize = sizeof(struct sockaddr_in);
 
 	struct sockaddr_in newsession;
 	struct sockaddr_in sockname;
@@ -721,7 +721,7 @@ do_accept(int servsock, struct sockaddr_
 	int clisock;
 	int targetsock;
 	struct sockaddr_in client;
-	size_t clientlen = sizeof(client);
+	unsigned int clientlen = sizeof(client);
 	int accept_errno;
      
 	debug("top of accept loop\n");
@@ -1080,7 +1080,7 @@ main(int argc, char *argv[])
 	if (inetd) {
 		int targetsock;
 		struct sockaddr_in client;
-		size_t client_size = sizeof(client);
+		unsigned int client_size = sizeof(client);
 
 #ifdef USE_TCP_WRAPPERS
 		request_init(&request, RQ_DAEMON, ident, RQ_FILE, 0, 0);
Binary files a/redir-2.2.1/redir.o and b/redir-2.2.1/redir.o differ


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/redir/F-9/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	7 Apr 2009 03:26:26 -0000	1.1
+++ .cvsignore	7 Apr 2009 10:31:02 -0000	1.2
@@ -0,0 +1 @@
+redir-2.2.1.tar.gz


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/redir/F-9/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	7 Apr 2009 03:26:27 -0000	1.1
+++ sources	7 Apr 2009 10:31:02 -0000	1.2
@@ -0,0 +1 @@
+4342fadac30504c86c8db7beefe01995  redir-2.2.1.tar.gz




More information about the fedora-extras-commits mailing list