branch Attitude Adjustment packages
[12.09/packages.git] / net / redir / patches / 02_use_ntohs.patch
1 diff -Nur a/redir.c b/redir.c
2 --- a/redir.c   1999-12-26 15:50:06.000000000 -0500
3 +++ b/redir.c   2005-10-22 21:29:55.491735272 -0400
4 @@ -745,7 +745,7 @@
5         }
6       
7         debug1("peer IP is %s\n", inet_ntoa(client.sin_addr));
8 -       debug1("peer socket is %d\n", client.sin_port);
9 +       debug1("peer socket is %d\n", ntohs(client.sin_port));
10  
11         /*
12          * Double fork here so we don't have to wait later
13 @@ -871,8 +871,8 @@
14                 strcpy(tmp2, inet_ntoa(target->sin_addr));
15           
16                 syslog(LOG_NOTICE, "connecting %s/%d to %s/%d",
17 -                      tmp1, client.sin_port,
18 -                      tmp2, target->sin_port);
19 +                      tmp1, ntohs(client.sin_port),
20 +                      tmp2, ntohs(target->sin_port));
21         }
22  
23         /* do proxy stuff */
24 @@ -1066,7 +1066,7 @@
25  
26                 if (!getpeername(0, (struct sockaddr *) &client, &client_size)) {
27                         debug1("peer IP is %s\n", inet_ntoa(client.sin_addr));
28 -                       debug1("peer socket is %d\n", client.sin_port);
29 +                       debug1("peer socket is %d\n", ntohs(client.sin_port));
30                 }
31                 if ((targetsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
32                         perror("target: socket");
33 @@ -1109,8 +1109,8 @@
34  
35                 if (dosyslog) {
36                         syslog(LOG_NOTICE, "connecting %s/%d to %s/%d",
37 -                              inet_ntoa(client.sin_addr), client.sin_port,
38 -                              target_ip, target.sin_port);
39 +                              inet_ntoa(client.sin_addr), ntohs(client.sin_port),
40 +                              target_ip, ntohs(target.sin_port));
41                 }
42  
43                 /* Just start copying - one side of the loop is stdin - 0 */