diff lib/protocols.c @ 451:83cfffb2878a

2004-3-26 Brian Masney <masneyb@gftp.org> * lib/ftps.c lib/gftp.h lib/rfc959.c - when reestablishing a connection to a FTPS host, make sure the initial commands are sent over in plaintext * lib/protocols.c - make sure the port is displayed to the user in the proper byte order when getaddrinfo() is not included on the system * lib/misc.c (gftp_copy_request) - make sure req->init is not NULL before attempting to initialize the new request structure. This fixes a segfault that happened when viewing/editing a local file (from Chelban Vasile <mail4509@pochtamt.ru>) * docs/website/generate-gftp-website.pl - updated the STABLE_I386DEB filename * docs/website/index.html.in - updated the main website * docs/website/announce.txt - announcement for the 2.0.17 release
author masneyb
date Fri, 26 Mar 2004 21:03:51 +0000
parents 6b1e4bd20ae4
children 075f89b4395c
line wrap: on
line diff
--- a/lib/protocols.c	Wed Mar 24 11:06:41 2004 +0000
+++ b/lib/protocols.c	Fri Mar 26 21:03:51 2004 +0000
@@ -2076,16 +2076,14 @@
           close (sock);
           return (GFTP_EFATAL);
         }
-      else
-        {
-          port = serv_struct.s_port;
-          request->port = ntohs (serv_struct.s_port);
-        }
+
+      port = ntohs (serv_struct.s_port);
 
       if (!request->use_proxy)
-        request->port = ntohs (port);
+        request->port = port;
     }
-  remote_address.sin_port = port;
+
+  remote_address.sin_port = htons (port);
 
   if (request->hostp == NULL)
     {
@@ -2110,7 +2108,7 @@
               request->host.h_length);
       request->logging_function (gftp_logging_misc, request,
                                  _("Trying %s:%d\n"),
-                                 request->host.h_name, ntohs (port));
+                                 request->host.h_name, port);
 
       if (connect (sock, (struct sockaddr *) &remote_address,
                    sizeof (remote_address)) == -1)
@@ -2127,7 +2125,6 @@
       close (sock);
       return (GFTP_ERETRYABLE);
     }
-  port = ntohs (port);
 #endif /* HAVE_GETADDRINFO */
 
   if (fcntl (sock, F_SETFD, 1) == -1)