diff options
Diffstat (limited to 'network/redir/patches/02_use_ntohs.dpatch')
-rw-r--r-- | network/redir/patches/02_use_ntohs.dpatch | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/network/redir/patches/02_use_ntohs.dpatch b/network/redir/patches/02_use_ntohs.dpatch new file mode 100644 index 0000000000..58622b0ddf --- /dev/null +++ b/network/redir/patches/02_use_ntohs.dpatch @@ -0,0 +1,50 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 02_use_ntohs.dpatch by Daniel Kahn Gillmor <dkg@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 */ |