]> granicus.if.org Git - curl/commitdiff
before using if2ip(), check if the address is an ip address and skip it if
authorDaniel Stenberg <daniel@haxx.se>
Tue, 13 May 2003 12:11:31 +0000 (12:11 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 13 May 2003 12:11:31 +0000 (12:11 +0000)
it is.

lib/ftp.c

index 5b79662c2f25e640216a457c912174d491716e60..7b4d8abab67c48bfe7bbceba1d0a0235de53b208 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1212,7 +1212,13 @@ CURLcode ftp_use_port(struct connectdata *conn)
   bool sa_filled_in = FALSE;
 
   if(data->set.ftpport) {
-    if(Curl_if2ip(data->set.ftpport, myhost, sizeof(myhost))) {
+    in_addr_t in;
+
+    /* First check if the given name is an IP address */
+    in=inet_addr(data->set.ftpport);
+
+    if((in == CURL_INADDR_NONE) &&
+       Curl_if2ip(data->set.ftpport, myhost, sizeof(myhost))) {
       h = Curl_resolv(data, myhost, 0);
     }
     else {