Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37576923
en ru br
ALT Linux repos
S:3.3-alt1
5.0: 3.0.5-alt2
4.1: 3.0.5-alt1
4.0: 3.0.5-alt1
3.0: 3.0.5-alt1

Group :: Networking/Other
RPM: httptunnel

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: httptunnel-3.0.5.bind.patch
Download


diff -urN httptunnel-3.0.5-orig/common.c httptunnel-3.0.5/common.c
--- httptunnel-3.0.5-orig/common.c	Thu Aug 31 15:48:23 2000
+++ httptunnel-3.0.5/common.c	Fri Feb 13 13:19:14 2004
@@ -115,7 +115,7 @@
 #endif
 
 int
-server_socket (int port, int backlog)
+server_socket (int port, int backlog, const char * bind_addr)
 {
   struct sockaddr_in address;
   int i, s;
@@ -133,7 +133,7 @@
 
   address.sin_family = PF_INET;
   address.sin_port = htons ((short)port);
-  address.sin_addr.s_addr = INADDR_ANY;
+  address.sin_addr.s_addr = bind_addr ? inet_addr( bind_addr ) : INADDR_ANY;
   
   if (bind (s, (struct sockaddr *)&address, sizeof (address)) == -1)
     {
diff -urN httptunnel-3.0.5-orig/common.h httptunnel-3.0.5/common.h
--- httptunnel-3.0.5-orig/common.h	Thu Aug 31 15:43:40 2000
+++ httptunnel-3.0.5/common.h	Fri Feb 13 13:19:39 2004
@@ -54,7 +54,7 @@
 static inline void log_annoying () {}
 #endif
 
-extern int server_socket (int port, int backlog);
+extern int server_socket (int port, int backlog, const char * bind_addr);
 extern int set_address (struct sockaddr_in *address,
 			const char *host, int port);
 extern int open_device (char *device);
diff -urN httptunnel-3.0.5-orig/htc.c httptunnel-3.0.5/htc.c
--- httptunnel-3.0.5-orig/htc.c	Thu Aug 31 15:43:40 2000
+++ httptunnel-3.0.5/htc.c	Fri Feb 13 13:31:36 2004
@@ -33,6 +33,7 @@
   int proxy_buffer_timeout;
   size_t content_length;
   int forward_port;
+  char *bind_address;
   int strict_content_length;
   int keep_alive;
   int max_connection_age;
@@ -66,6 +67,7 @@
 "  -D, --debug [LEVEL]            enable debugging mode\n"
 #endif
 "  -F, --forward-port PORT        use TCP port PORT for input and output\n"
+"  -b, --bind-address IP          bind to specified IP-address\n"
 "  -h, --help                     display this help and exit\n"
 "  -k, --keep-alive SECONDS       send keepalive bytes every SECONDS seconds\n"
 "                                 (default is %d)\n"
@@ -124,6 +126,7 @@
   arg->max_connection_age = DEFAULT_CONNECTION_MAX_TIME;
   arg->proxy_authorization = NULL;
   arg->user_agent = NULL;
+  arg->bind_address = "127.0.0.1";
   
   for (;;)
     {
@@ -148,10 +151,11 @@
 	{ "proxy-authorization", required_argument, 0, 'A' },
 	{ "max-connection-age", required_argument, 0, 'M' },
 	{ "proxy-authorization-file", required_argument, 0, 'z' },
+	{ "bind-address", required_argument, 0, 'b' },
 	{ 0, 0, 0, 0 }
       };
 
-      static const char *short_options = "A:B:c:d:F:hk:M:P:ST:U:Vz:"
+      static const char *short_options = "A:B:c:d:F:hk:M:P:ST:U:Vz:b:"
 #ifdef DEBUG_MODE
 	"D:l:"
 #endif
@@ -246,6 +250,10 @@
 	  printf ("htc (%s) %s\n", PACKAGE, VERSION);
 	  exit (0);
 
+	case 'b':
+	  arg->bind_address = optarg;
+	  break;
+
 	case 'z':
 	  {
 	    struct stat s;
@@ -413,11 +421,11 @@
 	      arg.proxy_authorization ? arg.proxy_authorization : "(null)");
   log_notice ("  user_agent = %s", arg.user_agent ? arg.user_agent : "(null)");
   log_notice ("  debug_level = %d", debug_level);
-
+  log_notice ("  bind_address = %s", arg.bind_address);
 
   if (arg.forward_port != -1)
     {
-      s = server_socket (arg.forward_port, 0);
+      s = server_socket (arg.forward_port, 0, arg.bind_address );
       log_debug ("server_socket (%d) = %d", arg.forward_port, s);
       if (s == -1)
 	{
diff -urN httptunnel-3.0.5-orig/tunnel.c httptunnel-3.0.5/tunnel.c
--- httptunnel-3.0.5-orig/tunnel.c	Thu Sep 14 16:27:27 2000
+++ httptunnel-3.0.5/tunnel.c	Fri Feb 13 13:20:37 2004
@@ -1265,7 +1265,7 @@
   tunnel->out_total_data = 0;
   tunnel->strict_content_length = FALSE;
 
-  tunnel->server_socket = server_socket (tunnel->dest.host_port, 1);
+  tunnel->server_socket = server_socket (tunnel->dest.host_port, 1, 0 );
   if (tunnel->server_socket == -1)
     {
       log_error ("tunnel_new_server: server_socket (%d) = -1",
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin