]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
hfaxd: Make source port for active connections be ctrl port - 1
authorAidan Van Dyk <mountie@cherry.home.highrise.ca>
Thu, 3 Nov 2011 15:46:40 +0000 (11:46 -0400)
committerAidan Van Dyk <mountie@cherry.home.highrise.ca>
Thu, 3 Nov 2011 15:46:40 +0000 (11:46 -0400)
Traditionally, active FTP data connections come from port-1 (4558 by default).
Even though firewalls now don't usually rely on that, but do active control connection
inspection to find ports being used, let's try and be as nice as we can to
non FTP-aware firewalls.

This was subtracting 1 before the bites swap, causing it to be 4303 on little
endian machines.

Noticed by Amin Mozafari.

hfaxd/InetFaxServer.c++

index 8a2d253a00193d689d63631f72287be8e66806c7..ee122a889e968aaed3f2e0ca5265a3a6a081f807 100644 (file)
@@ -267,7 +267,7 @@ InetFaxServer::setupNetwork(int fd)
 #endif
     /* anchor socket to avoid multi-homing problems */
     data_source = ctrl_addr;
-    Socket::port(data_source) = htons(ntohs(Socket::port(ctrl_addr)-1));
+    Socket::port(data_source) = htons(ntohs(Socket::port(ctrl_addr))-1);
 #ifdef  F_SETOWN
     if (fcntl(fd, F_SETOWN, getpid()) == -1)
         logError("fcntl (F_SETOWN): %m");