]> git.pld-linux.org Git - packages/redir.git/blob - redir-debian.patch
Up to 3.3.
[packages/redir.git] / redir-debian.patch
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 01_fix_max_bandwidth_docs.dpatch by Daniel Kahn Gillmor <dkg@fifthhorseman.net>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: Fix docs and --help to show --max_bandwidth instead of --maxbandwidth
6
7 @DPATCH@
8 diff -urNad redir-2.2.1~/redir.c redir-2.2.1/redir.c
9 --- redir-2.2.1~/redir.c        1999-12-26 15:50:06.000000000 -0500
10 +++ redir-2.2.1/redir.c 2005-10-22 21:21:56.849499952 -0400
11 @@ -233,7 +233,7 @@
12  #ifndef NO_SHAPER
13          /* options for bandwidth */
14          fprintf(stderr, "\t\t--bufsize=<octets>\tsize of the buffer\n");
15 -        fprintf(stderr, "\t\t--maxbandwidth=<bit-per-sec>\tlimit the bandwidth\n");
16 +        fprintf(stderr, "\t\t--max_bandwidth=<bit-per-sec>\tlimit the bandwidth\n");
17          fprintf(stderr, "\t\t--random_wait=<millisec>\twait before each packet\n");
18          fprintf(stderr, "\t\t--wait_in_out=<flag>\t1 wait for in, 2 out, 3 in&out\n");
19          /* end options for bandwidth */
20 diff -urNad redir-2.2.1~/redir.man redir-2.2.1/redir.man
21 --- redir-2.2.1~/redir.man      1999-12-26 15:52:24.000000000 -0500
22 +++ redir-2.2.1/redir.man       2005-10-22 21:22:28.882630176 -0400
23 @@ -18,7 +18,7 @@
24  .I --lport=port
25  .I --cport=port
26  .RB [ \--bufsize=n ]
27 -.RB [ \--maxbandwidth=n ]
28 +.RB [ \--max_bandwidth=n ]
29  .RB [ \--random_wait=n ]
30  .RB [ \--wait_in_out=n ]
31  .ll -8
32 @@ -35,7 +35,7 @@
33  .RB [ \--connect=host:port ]
34  .I --cport=port
35  .RB [ \--bufsize=n ]
36 -.RB [ \--maxbandwidth=n ]
37 +.RB [ \--max_bandwidth=n ]
38  .RB [ \--random_wait=n ]
39  .RB [ \--wait_in_out=n ]
40  .ll -8
41 @@ -102,9 +102,9 @@
42  .TP
43  .B \--bufsize n
44  Set the bufsize (defaut 4096) in bytes. Can be used combined with
45 ---maxbandwidth or --random_wait to simulate a slow connection.
46 +--max_bandwidth or --random_wait to simulate a slow connection.
47  .TP
48 -.B \--maxbandwidth n
49 +.B \--max_bandwidth n
50  Reduce the bandwidth to be no more than n bits/sec.  The algorithme is
51  basic, the goal is to simulate a slow connection, so there is no pic
52  acceptance.
53 @@ -115,7 +115,7 @@
54  than the bufsize (see also --bufsize).
55  .TP
56  .B \--wait_in_out n
57 -Apply --maxbandwidth and --random_wait for input if n=1, output if n=2 and
58 +Apply --max_bandwidth and --random_wait for input if n=1, output if n=2 and
59  both if n=3.
60  .SH "SEE ALSO"
61  inetd(1)
62 #! /bin/sh /usr/share/dpatch/dpatch-run
63 ## 02_use_ntohs.dpatch by Daniel Kahn Gillmor <dkg@fifthhorseman.net>
64 ##
65 ## All lines beginning with `## DP:' are a description of the patch.
66 ## DP: use ntohs() to generate comprehensible debug()s and syslog()s.
67
68 @DPATCH@
69 diff -urNad redir-2.2.1~/redir.c redir-2.2.1/redir.c
70 --- redir-2.2.1~/redir.c        1999-12-26 15:50:06.000000000 -0500
71 +++ redir-2.2.1/redir.c 2005-10-22 21:29:55.491735272 -0400
72 @@ -745,7 +745,7 @@
73         }
74       
75         debug1("peer IP is %s\n", inet_ntoa(client.sin_addr));
76 -       debug1("peer socket is %d\n", client.sin_port);
77 +       debug1("peer socket is %d\n", ntohs(client.sin_port));
78  
79         /*
80          * Double fork here so we don't have to wait later
81 @@ -871,8 +871,8 @@
82                 strcpy(tmp2, inet_ntoa(target->sin_addr));
83           
84                 syslog(LOG_NOTICE, "connecting %s/%d to %s/%d",
85 -                      tmp1, client.sin_port,
86 -                      tmp2, target->sin_port);
87 +                      tmp1, ntohs(client.sin_port),
88 +                      tmp2, ntohs(target->sin_port));
89         }
90  
91         /* do proxy stuff */
92 @@ -1066,7 +1066,7 @@
93  
94                 if (!getpeername(0, (struct sockaddr *) &client, &client_size)) {
95                         debug1("peer IP is %s\n", inet_ntoa(client.sin_addr));
96 -                       debug1("peer socket is %d\n", client.sin_port);
97 +                       debug1("peer socket is %d\n", ntohs(client.sin_port));
98                 }
99                 if ((targetsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
100                         perror("target: socket");
101 @@ -1109,8 +1109,8 @@
102  
103                 if (dosyslog) {
104                         syslog(LOG_NOTICE, "connecting %s/%d to %s/%d",
105 -                              inet_ntoa(client.sin_addr), client.sin_port,
106 -                              target_ip, target.sin_port);
107 +                              inet_ntoa(client.sin_addr), ntohs(client.sin_port),
108 +                              target_ip, ntohs(target.sin_port));
109                 }
110  
111                 /* Just start copying - one side of the loop is stdin - 0 */
112 #! /bin/sh /usr/share/dpatch/dpatch-run
113 ## 03_fix_tcp_wrappers.dpatch by Daniel Kahn Gillmor <dkg@fifthhorseman.net>
114 ##
115 ## All lines beginning with `## DP:' are a description of the patch.
116 ## DP: fix calls to tcp wrappers
117
118 @DPATCH@
119 diff -urNad redir-2.2.1~/redir.c redir-2.2.1/redir.c
120 --- redir-2.2.1~/redir.c        2005-10-22 22:10:11.439455392 -0400
121 +++ redir-2.2.1/redir.c 2005-10-22 22:10:51.625346208 -0400
122 @@ -802,8 +802,8 @@
123  #ifdef USE_TCP_WRAPPERS
124         request_init(&request, RQ_DAEMON, ident, RQ_FILE, clisock, 0);
125         sock_host(&request);
126 -       sock_hostname(&request);
127 -       sock_hostaddr(&request);
128 +       sock_hostname(request.client);
129 +       sock_hostaddr(request.client);
130  
131         if (!hosts_access(&request)) {
132                 refuse(&request);
133 @@ -1057,8 +1057,8 @@
134  #ifdef USE_TCP_WRAPPERS
135                 request_init(&request, RQ_DAEMON, ident, RQ_FILE, 0, 0);
136                 sock_host(&request);
137 -               sock_hostname(&request);
138 -               sock_hostaddr(&request);
139 +               sock_hostname(request.client);
140 +               sock_hostaddr(request.client);
141         
142                 if (!hosts_access(&request))
143                         refuse(&request);
144 #! /bin/sh /usr/share/dpatch/dpatch-run
145 ## 04_fix_timeouts.dpatch by Daniel Kahn Gillmor <dkg@fifthhorseman.net>
146 ##
147 ## All lines beginning with `## DP:' are a description of the patch.
148 ## DP: Apply a close approximation of Robert de Bath's patch for bug #142382
149
150 @DPATCH@
151 diff -urNad redir-2.2.1~/redir.c redir-2.2.1/redir.c
152 --- redir-2.2.1~/redir.c        2005-10-22 22:44:39.504061784 -0400
153 +++ redir-2.2.1/redir.c 2005-10-22 22:47:14.746461352 -0400
154 @@ -598,10 +598,6 @@
155         /* Record start time */
156         start_time = (unsigned int) time(NULL);
157  
158 -       /* Set up timeout */
159 -       timeout.tv_sec = timeout_secs;
160 -       timeout.tv_usec = 0;
161 -
162         /* file descriptor bits */
163         FD_ZERO(&iofds);
164         FD_SET(insock, &iofds);
165 @@ -618,14 +614,21 @@
166         while(1) {
167                 (void) memcpy(&c_iofds, &iofds, sizeof(iofds));
168  
169 +               /* Set up timeout, Linux returns seconds left in this structure
170 +                * so we have to reset it before each select(). */
171 +               timeout.tv_sec = timeout_secs;
172 +               timeout.tv_usec = 0;
173 +
174  
175                 if (select(max_fd + 1,
176                            &c_iofds,
177                            (fd_set *)0,
178                            (fd_set *)0,
179                            (timeout_secs ? &timeout : NULL)) <= 0) {
180 -                       /*          syslog(LLEV,"connection timeout: %d sec",timeout.tv_sec);*/
181 -                       break;
182 +                 if (dosyslog) {
183 +                   syslog(LOG_NOTICE,"connection timeout: %d sec",timeout_secs);
184 +                 }
185 +                 break;
186                 }
187  
188                 if(FD_ISSET(insock, &c_iofds)) {
189 #! /bin/sh /usr/share/dpatch/dpatch-run
190 ## 05_pedantic.dpatch by Daniel Kahn Gillmor <dkg@fifthhorseman.net>
191 ##
192 ## All lines beginning with `## DP:' are a description of the patch.
193 ## DP: changes to make clean up compilation
194
195 @DPATCH@
196 diff -urNad redir-2.2.1~/Makefile redir-2.2.1/Makefile
197 --- redir-2.2.1~/Makefile       2005-10-22 23:11:41.000000000 -0400
198 +++ redir-2.2.1/Makefile        2005-10-22 23:11:48.818368360 -0400
199 @@ -32,7 +32,7 @@
200  # if your system lacks getopt_long, remove the comment from this line
201  OBJS = redir.o $(GETOPT_OBJS)
202  
203 -CFLAGS = -O2 -Wall $(STR_CFLAGS) $(WRAP_CFLAGS) $(EXTRA_CFLAGS)
204 +CFLAGS = -O2 -Wall --pedantic $(STR_CFLAGS) $(WRAP_CFLAGS) $(EXTRA_CFLAGS)
205  LDFLAGS = -s
206  
207  # solaris, and others, may also need these libraries to link
208 diff -urNad redir-2.2.1~/redir.c redir-2.2.1/redir.c
209 --- redir-2.2.1~/redir.c        2005-10-22 23:11:48.282449832 -0400
210 +++ redir-2.2.1/redir.c 2005-10-22 23:12:23.201141384 -0400
211 @@ -73,6 +73,7 @@
212  #include <sys/types.h>
213  #include <sys/socket.h>
214  #include <sys/time.h>
215 +#include <time.h>
216  #include <sys/wait.h>
217  #include <netinet/in.h>
218  #include <arpa/inet.h>
219 @@ -460,7 +461,7 @@
220         int lport, rport;
221         int remip[4];
222         int localsock;
223 -       int socksize = sizeof(struct sockaddr_in);
224 +       size_t socksize = sizeof(struct sockaddr_in);
225  
226         struct sockaddr_in newsession;
227         struct sockaddr_in sockname;
228 @@ -509,7 +510,7 @@
229         if(getsockname(localsock, (struct sockaddr *)&sockname, &socksize) < 0) {
230                 perror("getsockname");
231                 if (dosyslog)
232 -                       syslog(LOG_ERR, "getsockname failed: %m");
233 +                       syslog(LOG_ERR, "getsockname failed: %s",strerror(errno));
234                 exit(1);
235         }
236  
237 @@ -562,7 +563,7 @@
238         switch(fork())
239         {
240         case -1: /* Error */
241 -               syslog(LOG_ERR, "Couldn't fork: %m");
242 +               syslog(LOG_ERR, "Couldn't fork: %s",strerror(errno));
243                 _exit(1);
244         case 0:  /* Child */
245         {
246 @@ -723,7 +724,7 @@
247         int clisock;
248         int targetsock;
249         struct sockaddr_in client;
250 -       int clientlen = sizeof(client);
251 +       size_t clientlen = sizeof(client);
252         int accept_errno;
253       
254         debug("top of accept loop\n");
255 @@ -734,7 +735,7 @@
256                 perror("server: accept");
257  
258                 if (dosyslog)
259 -                       syslog(LOG_ERR, "accept failed: %m");
260 +                       syslog(LOG_ERR, "accept failed: %s",strerror(errno));
261  
262                 /* determine if this error is fatal */
263                 switch(accept_errno) {
264 @@ -768,7 +769,7 @@
265                 perror("(server) fork");
266  
267                 if (dosyslog)
268 -                       syslog(LOG_ERR, "(server) fork failed: %m");
269 +                       syslog(LOG_ERR, "(server) fork failed: %s",strerror(errno));
270  
271                 _exit(1);
272         case 0:  /* Child */
273 @@ -795,7 +796,7 @@
274                 perror("(child) fork");
275  
276                 if (dosyslog)
277 -                       syslog(LOG_ERR, "(child) fork failed: %m");
278 +                       syslog(LOG_ERR, "(child) fork failed: %s",strerror(errno));
279  
280                 _exit(1);
281         case 0:  /* Child */
282 @@ -826,7 +827,7 @@
283                 perror("target: socket");
284           
285                 if (dosyslog)
286 -                       syslog(LOG_ERR, "socket failed: %m");
287 +                       syslog(LOG_ERR, "socket failed: %s",strerror(errno));
288                 
289                 _exit(1);
290         }
291 @@ -850,7 +851,7 @@
292     only be different if the input value is 0 (let the system pick a 
293     port) */
294                         if (dosyslog)
295 -                               syslog(LOG_ERR, "bind failed: %m");
296 +                               syslog(LOG_ERR, "bind failed: %s",strerror(errno));
297  
298                         _exit(1);
299                 }
300 @@ -862,7 +863,7 @@
301                 perror("target: connect");
302  
303                 if (dosyslog)
304 -                       syslog(LOG_ERR, "bind failed: %m");
305 +                       syslog(LOG_ERR, "bind failed: %s",strerror(errno));
306  
307                 _exit(1);
308         }
309 @@ -923,7 +924,7 @@
310                         perror("server: socket");
311  
312                         if (dosyslog)
313 -                               syslog(LOG_ERR, "socket failed: %m");
314 +                               syslog(LOG_ERR, "socket failed: %s",strerror(errno));
315  
316                         exit(1);
317                 }
318 @@ -962,7 +963,7 @@
319                         perror("server: bind");
320  
321                         if (dosyslog)
322 -                               syslog(LOG_ERR, "bind failed: %m");
323 +                               syslog(LOG_ERR, "bind failed: %s",strerror(errno));
324  
325                         exit(1);
326                 }
327 @@ -980,7 +981,7 @@
328                         perror("server: listen");
329  
330                         if (dosyslog)
331 -                               syslog(LOG_ERR, "listen failed: %m");
332 +                               syslog(LOG_ERR, "listen failed: %s",strerror(errno));
333  
334                         exit(1);
335                 }
336 @@ -1059,7 +1060,7 @@
337         if (inetd) {
338                 int targetsock;
339                 struct sockaddr_in client;
340 -               int client_size = sizeof(client);
341 +               size_t client_size = sizeof(client);
342  
343  #ifdef USE_TCP_WRAPPERS
344                 request_init(&request, RQ_DAEMON, ident, RQ_FILE, 0, 0);
345 @@ -1079,7 +1080,7 @@
346                         perror("target: socket");
347  
348                         if (dosyslog)
349 -                               syslog(LOG_ERR, "targetsock failed: %m");
350 +                               syslog(LOG_ERR, "targetsock failed: %s",strerror(errno));
351  
352                         exit(1);
353                 }
354 @@ -1097,7 +1098,7 @@
355                                 perror("bind_addr: cannot bind to forcerd outgoing addr");
356                                  
357                                 if (dosyslog)
358 -                                       syslog(LOG_ERR, "bind failed: %m");
359 +                                       syslog(LOG_ERR, "bind failed: %s",strerror(errno));
360                                  
361                                 exit(1);
362                         }
363 @@ -1109,7 +1110,7 @@
364                         perror("target: connect");
365  
366                         if (dosyslog)
367 -                               syslog(LOG_ERR, "connect failed: %m");
368 +                               syslog(LOG_ERR, "connect failed: %s",strerror(errno));
369  
370                         exit(1);
371                 }
372 #! /bin/sh /usr/share/dpatch/dpatch-run
373 ## 06_fix_shaper_buffer.dpatch by Daniel Kahn Gillmor <dkg@fifthhorseman.net>
374 ##
375 ## All lines beginning with `## DP:' are a description of the patch.
376 ## DP: properly allocate copyloop buffer
377
378 @DPATCH@
379 diff -urNad redir-2.2.1~/redir.c redir-2.2.1/redir.c
380 --- redir-2.2.1~/redir.c        2005-10-22 23:20:05.235901424 -0400
381 +++ redir-2.2.1/redir.c 2005-10-22 23:22:20.198384008 -0400
382 @@ -260,7 +260,7 @@
383  #endif
384            int *transproxy,
385  #ifndef NO_SHAPER
386 -           unsigned int * bufsize,
387 +           unsigned int * bufsizeout,
388             int * max_bandwidth,
389             int * random_wait,
390             int * wait_in_out,
391 @@ -367,7 +367,7 @@
392  
393  #ifndef NO_SHAPER
394                  case 'z':
395 -                  *bufsize = (unsigned int)atol(optarg);
396 +                  *bufsizeout = (unsigned int)atol(optarg);
397                    break;
398   
399                  case 'm':
400 @@ -594,7 +594,7 @@
401         unsigned long bytes_in = 0;
402         unsigned long bytes_out = 0;
403         unsigned int start_time, end_time;
404 -       char buf[bufsize];
405 +       char* buf = malloc(bufsize);
406  
407         /* Record start time */
408         start_time = (unsigned int) time(NULL);
409 @@ -637,7 +637,7 @@
410                 }
411  
412                 if(FD_ISSET(insock, &c_iofds)) {
413 -                       if((bytes = read(insock, buf, sizeof(buf))) <= 0)
414 +                       if((bytes = read(insock, buf, bufsize)) <= 0)
415                                 break;
416  #ifndef NO_FTP
417                         if (ftp & FTP_PORT)
418 @@ -652,7 +652,7 @@
419                         bytes_out += bytes;
420                 }
421                 if(FD_ISSET(outsock, &c_iofds)) {
422 -                       if((bytes = read(outsock, buf, sizeof(buf))) <= 0)
423 +                       if((bytes = read(outsock, buf, bufsize)) <= 0)
424                                 break;
425                         /* if we're correcting for PASV on ftp redirections, then
426                            fix buf and bytes to have the new address, among other
427 @@ -689,6 +689,7 @@
428                 syslog(LOG_NOTICE, "disconnect %d secs, %ld in %ld out",
429                        (end_time - start_time), bytes_in, bytes_out);
430         }
431 +       free(buf);
432         return;
433  }
434  
435 #! /bin/sh /usr/share/dpatch/dpatch-run
436 ## 07_cosmetics.dpatch by Daniel Kahn Gillmor <dkg@fifthhorseman.net>
437 ##
438 ## All lines beginning with `## DP:' are a description of the patch.
439 ## DP: Cosmetic fixes which could be applied upstream
440
441 @DPATCH@
442 diff -urNad redir-2.2.1~/redir.man redir-2.2.1/redir.man
443 --- redir-2.2.1~/redir.man      2005-10-22 21:41:51.284918168 -0400
444 +++ redir-2.2.1/redir.man       2005-10-22 21:42:42.115190792 -0400
445 @@ -73,7 +73,7 @@
446  Specify program name to be used for TCP wrapper checks and syslog logging.
447  .TP
448  .B --timeout
449 -Timeout and close the connection after n seconds on inactivity.
450 +Timeout and close the connection after n seconds of inactivity.
451  .TP
452  .B \--syslog
453  Log information to syslog.
454 @@ -90,7 +90,7 @@
455  undesirable. 
456  .TP
457  .B \--transproxy
458 -On a linux system with transparany proxying enables, causes redir to
459 +On a linux system with transparent proxying enabled, causes redir to
460  make connections appear as if they had come from their true origin.
461  (see transproxy.txt in the source archive)
462  .TP
463 #! /bin/sh /usr/share/dpatch/dpatch-run
464 ## 08_add_wrappers.dpatch by Daniel Kahn Gillmor <dkg@fifthhorseman.net>
465 ##
466 ## All lines beginning with `## DP:' are a description of the patch.
467 ## DP: Enabling TCP wrapper support
468
469 @DPATCH@
470
471 --- redir-2.2.1.orig/Makefile
472 +++ redir-2.2.1/Makefile
473 @@ -9,8 +9,8 @@
474  # if you would like support for TCP wrappers (and have libwrap.a
475  # installed), remove these comments.
476  
477 -WRAP_CFLAGS = # -DUSE_TCP_WRAPPERS 
478 -WRAP_LIBS = # -lwrap
479 +WRAP_CFLAGS = -DUSE_TCP_WRAPPERS 
480 +WRAP_LIBS = -lwrap
481  
482  # if your system needs any additional libraries (solaris, for example, 
483  # needs the ones commented out below), edit this line.
484
485 #! /bin/sh /usr/share/dpatch/dpatch-run
486 ## 09_add_linux_software_map.dpatch by Daniel Kahn Gillmor <dkg@fifthhorseman.net>
487 ##
488 ## All lines beginning with `## DP:' are a description of the patch.
489 ## DP: Add linux software map file
490
491 @DPATCH@
492
493 --- redir-2.2.1.orig/redir-2.2.lsm
494 +++ redir-2.2.1/redir-2.2.lsm
495 @@ -0,0 +1,11 @@
496 +Begin3
497 +Title:   redir
498 +Version:  2.2
499 +Entered-date:  15DEC1999
500 +Description:  TCP Port redirector (for firewalls etc).
501 +Keywords:  tcp port redirector bouncer proxy
502 +Author:   sammy@oh.verio.com
503 +Primary-site:  sunsite.unc.edu /pub/Linux/system/Network/daemons
504 +   39936 redir-2.2.tar.gz
505 +Copying-policy:  GPL
506 +End
507
508 #! /bin/sh /usr/share/dpatch/dpatch-run
509 ## 15_deb_cosmetics.dpatch by Daniel Kahn Gillmor <dkg@fifthhorseman.net>
510 ##
511 ## All lines beginning with `## DP:' are a description of the patch.
512 ## DP: Cosmetic changes applicable only to debian
513
514 @DPATCH@
515 diff -urNad redir-2.2.1~/redir.man redir-2.2.1/redir.man
516 --- redir-2.2.1~/redir.man      2005-10-22 21:47:44.067287096 -0400
517 +++ redir-2.2.1/redir.man       2005-10-22 21:48:34.218662928 -0400
518 @@ -92,7 +92,7 @@
519  .B \--transproxy
520  On a linux system with transparent proxying enabled, causes redir to
521  make connections appear as if they had come from their true origin.
522 -(see transproxy.txt in the source archive)
523 +(see /usr/share/doc/redir/transproxy.txt)
524  .TP
525  .B \--connect
526  Redirects connections through an HTTP proxy which supports the CONNECT 
527 #! /bin/sh /usr/share/dpatch/dpatch-run
528 ## 20_do_not_strip.dpatch by Daniel Kahn Gillmor <dkg@fifthhorseman.net>
529 ##
530 ## All lines beginning with `## DP:' are a description of the patch.
531 ## DP: don't strip by default.  let dh_strip take care of it.
532
533 @DPATCH@
534 diff -urNad redir-2.2.1~/Makefile redir-2.2.1/Makefile
535 --- redir-2.2.1~/Makefile       2007-08-15 14:53:41.908911693 -0400
536 +++ redir-2.2.1/Makefile        2007-08-15 14:53:59.409909018 -0400
537 @@ -33,7 +33,7 @@
538  OBJS = redir.o $(GETOPT_OBJS)
539  
540  CFLAGS = -O2 -Wall --pedantic $(STR_CFLAGS) $(WRAP_CFLAGS) $(EXTRA_CFLAGS)
541 -LDFLAGS = -s
542 +LDFLAGS = # -s
543  
544  # solaris, and others, may also need these libraries to link
545  # also edit here if you're using the TCP wrappers code
546 #! /bin/sh /usr/share/dpatch/dpatch-run
547 ## 25_fix_setsockopt.dpatch by Daniel Kahn Gillmor <dkg@fifthhorseman.net>
548 ##
549 ## All lines beginning with `## DP:' are a description of the patch.
550 ## DP: Ensure that the server socket has SO_REUSEADDR and SO_LINGER set properly.
551
552 @DPATCH@
553 diff -urNad redir~/redir.c redir/redir.c
554 --- redir~/redir.c      2009-03-03 17:35:12.022427586 -0500
555 +++ redir/redir.c       2009-03-03 17:45:28.998426896 -0500
556 @@ -90,8 +90,8 @@
557  /* let's set up some globals... */
558  int dodebug = 0;
559  int dosyslog = 0;
560 -unsigned char reuse_addr = 1;
561 -unsigned char linger_opt = 0;
562 +int reuse_addr = 1; /* allow address reuse */
563 +struct linger linger_opt = { 0, 0}; /* do not linger */
564  char * bind_addr = NULL;
565  struct sockaddr_in addr_out;
566  int timeout = 0;
567 @@ -906,6 +906,7 @@
568  
569         int servsock;
570         struct sockaddr_in server;
571 +       int ret;
572       
573         /*
574          * Get a socket to work with.  This socket will
575 @@ -944,8 +945,30 @@
576                 server.sin_addr.s_addr = htonl(inet_addr("0.0.0.0"));
577         }
578       
579 -       setsockopt(servsock, SOL_SOCKET, SO_REUSEADDR, &reuse_addr, sizeof(reuse_addr));
580 -       setsockopt(servsock, SOL_SOCKET, SO_LINGER, &linger_opt, sizeof(SO_LINGER)); 
581 +       ret = setsockopt(servsock, SOL_SOCKET, SO_REUSEADDR, &reuse_addr, sizeof(reuse_addr));
582 +       if (ret != 0) {
583 +               if(fail) {
584 +                       return -1;
585 +               }
586 +               else {
587 +                       perror("server: setsockopt (SO_REUSEADDR)");
588 +                       if (dosyslog)
589 +                               syslog(LOG_ERR, "setsockopt failed with SO_REUSEADDR: %s",strerror(errno));
590 +                       exit(1);
591 +               }
592 +       }
593 +       ret = setsockopt(servsock, SOL_SOCKET, SO_LINGER, &linger_opt, sizeof(linger_opt)); 
594 +       if (ret != 0) {
595 +               if(fail) {
596 +                       return -1;
597 +               }
598 +               else {
599 +                       perror("server: setsockopt (SO_LINGER)");
600 +                       if (dosyslog)
601 +                               syslog(LOG_ERR, "setsockopt failed with SO_LINGER: %s",strerror(errno));
602 +                       exit(1);
603 +               }
604 +       }
605       
606         /*
607          * Try to bind the address to the socket.
608 #! /bin/sh /usr/share/dpatch/dpatch-run
609 ## 30_fix_manpage.dpatch by Daniel Kahn Gillmor <dkg@fifthhorseman.net>
610 ##
611 ## All lines beginning with `## DP:' are a description of the patch.
612 ## DP: Clean up questionable formatting in man page.
613
614 @DPATCH@
615 diff -urNad redir~/redir.man redir/redir.man
616 --- redir~/redir.man    2009-03-03 18:55:37.790428922 -0500
617 +++ redir/redir.man     2009-03-03 18:58:48.486428715 -0500
618 @@ -1,43 +1,42 @@
619 -.PU
620  .TH REDIR 1 local
621  .SH NAME
622 -redir \- redirect tcp connections
623 +redir - redirect tcp connections
624  .SH SYNOPSIS
625  .ll +8
626  .B redir
627 -.RB [ \--laddr=incoming.ip.address ]
628 -.RB [ \--caddr=host ]
629 -.RB [ \--debug ]
630 -.RB [ \--syslog 
631 -.RB [ \--name=str ] 
632 -.RB [ \--timeout=n ]
633 -.RB [ \--bind_addr=my.other.ip.address ]
634 -.RB [ \--ftp=type ]
635 -.RB [ \--transproxy ]
636 -.RB [ \--connect=host:port ]
637 -.I --lport=port
638 -.I --cport=port
639 -.RB [ \--bufsize=n ]
640 -.RB [ \--max_bandwidth=n ]
641 -.RB [ \--random_wait=n ]
642 -.RB [ \--wait_in_out=n ]
643 +.RB [ \-\-laddr=incoming.ip.address ]
644 +.RB [ \-\-caddr=host ]
645 +.RB [ \-\-debug ]
646 +.RB [ \-\-syslog 
647 +.RB [ \-\-name=str ] 
648 +.RB [ \-\-timeout=n ]
649 +.RB [ \-\-bind_addr=my.other.ip.address ]
650 +.RB [ \-\-ftp=type ]
651 +.RB [ \-\-transproxy ]
652 +.RB [ \-\-connect=host:port ]
653 +.I \-\-lport=port
654 +.I \-\-cport=port
655 +.RB [ \-\-bufsize=n ]
656 +.RB [ \-\-max_bandwidth=n ]
657 +.RB [ \-\-random_wait=n ]
658 +.RB [ \-\-wait_in_out=n ]
659  .ll -8
660  .br
661  .B redir
662 -.RB \--inetd
663 -.RB [ \--caddr=host ]
664 -.RB [ \--debug ]
665 -.RB [ \--syslog 
666 -.RB [ \--name=str ] 
667 -.RB [ \--timeout=n ]
668 -.RB [ \--ftp=type ]
669 -.RB [ \--transproxy ]
670 -.RB [ \--connect=host:port ]
671 -.I --cport=port
672 -.RB [ \--bufsize=n ]
673 -.RB [ \--max_bandwidth=n ]
674 -.RB [ \--random_wait=n ]
675 -.RB [ \--wait_in_out=n ]
676 +.RB \-\-inetd
677 +.RB [ \-\-caddr=host ]
678 +.RB [ \-\-debug ]
679 +.RB [ \-\-syslog ]
680 +.RB [ \-\-name=str ] 
681 +.RB [ \-\-timeout=n ]
682 +.RB [ \-\-ftp=type ]
683 +.RB [ \-\-transproxy ]
684 +.RB [ \-\-connect=host:port ]
685 +.I \-\-cport=port
686 +.RB [ \-\-bufsize=n ]
687 +.RB [ \-\-max_bandwidth=n ]
688 +.RB [ \-\-random_wait=n ]
689 +.RB [ \-\-wait_in_out=n ]
690  .ll -8
691  .br
692  .SH DESCRIPTION
693 @@ -49,74 +48,73 @@
694  Depending on how redir was compiled, not all options may be available.
695  .SH OPTIONS
696  .TP
697 -.B \--lport
698 +.B \-\-lport
699  Specifies port to listen for connections on (when not running from inetd)
700  .TP
701 -.B \--laddr
702 +.B \-\-laddr
703  IP address to bind to when listening for connections (when not
704  running from inetd) 
705  .TP
706 -.B \--cport
707 +.B \-\-cport
708  Specifies port to connect to.
709  .TP
710 -.B \--caddr
711 +.B \-\-caddr
712  Specifies remote host to connect to. (localhost if omitted)
713  .TP
714 -.B \--inetd
715 +.B \-\-inetd
716  Run as a process started from inetd, with the connection passed as stdin
717  and stdout on startup.
718  .TP
719 -.B \--debug
720 +.B \-\-debug
721  Write debug output to stderr or syslog.
722  .TP
723 -.B \--name
724 +.B \-\-name
725  Specify program name to be used for TCP wrapper checks and syslog logging.
726  .TP
727 -.B --timeout
728 +.B \-\-timeout
729  Timeout and close the connection after n seconds of inactivity.
730  .TP
731 -.B \--syslog
732 +.B \-\-syslog
733  Log information to syslog.
734  .TP
735 -.B \--bind_addr
736 +.B \-\-bind_addr
737  Forces redir to pick a specific address/interface to bind to when it listens 
738  for incoming connections. 
739  .TP
740 -.B \--ftp
741 +.B \-\-ftp
742  When using redir for an FTP server, this will cause redir to also
743  redirect ftp connections.  Type should be specified as either "port",
744  "pasv", or "both", to specify what type of FTP connection to handle.
745 -Note that --transproxy often makes one or the other (generally port)
746 +Note that \-\-transproxy often makes one or the other (generally port)
747  undesirable. 
748  .TP
749 -.B \--transproxy
750 +.B \-\-transproxy
751  On a linux system with transparent proxying enabled, causes redir to
752  make connections appear as if they had come from their true origin.
753  (see /usr/share/doc/redir/transproxy.txt)
754  .TP
755 -.B \--connect
756 +.B \-\-connect
757  Redirects connections through an HTTP proxy which supports the CONNECT 
758 -command.  Specify the address and port of the proxy using --caddr and
759 ---cport.  --connect requires the hostname and port which the HTTP
760 +command.  Specify the address and port of the proxy using \-\-caddr and
761 +\-\-cport.  \-\-connect requires the hostname and port which the HTTP
762  proxy will be asked to connect to.
763  .TP
764 -.B \--bufsize n
765 +.B \-\-bufsize n
766  Set the bufsize (defaut 4096) in bytes. Can be used combined with
767 ---max_bandwidth or --random_wait to simulate a slow connection.
768 +\-\-max_bandwidth or \-\-random_wait to simulate a slow connection.
769  .TP
770 -.B \--max_bandwidth n
771 +.B \-\-max_bandwidth n
772  Reduce the bandwidth to be no more than n bits/sec.  The algorithme is
773  basic, the goal is to simulate a slow connection, so there is no pic
774  acceptance.
775  .TP
776 -.B \--random_wait n
777 +.B \-\-random_wait n
778  Wait between 0 and 2 x n milliseconds before each "packet". A "packet" is
779  a bloc of data read in one time by redir. A "packet" size is always less
780 -than the bufsize (see also --bufsize).
781 +than the bufsize (see also \-\-bufsize).
782  .TP
783 -.B \--wait_in_out n
784 -Apply --max_bandwidth and --random_wait for input if n=1, output if n=2 and
785 +.B \-\-wait_in_out n
786 +Apply \-\-max_bandwidth and \-\-random_wait for input if n=1, output if n=2 and
787  both if n=3.
788  .SH "SEE ALSO"
789  inetd(1)
790 -
This page took 0.169044 seconds and 3 git commands to generate.