bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] wget-1.17: undefined references in ftp.c


From: Darshit Shah
Subject: Re: [Bug-wget] wget-1.17: undefined references in ftp.c
Date: Tue, 17 Nov 2015 09:30:24 +0100
User-agent: Mutt/1.5.24+27 (c799162691b2) (2015-08-30)

This issue is affecting a lot mmore people. I'm going to push this patch in a couple of hours and add another test for the --disable-ipv6 configure option to check-hard. It seems to be a popularly used configure option that we don't check for.

On 11/17, Darshit Shah wrote:
Hi Lars,

Thanks for reporting the issue. I've debugged it and identified the issue. The functions were defined inside another #ifdef block by mistake which based on your configure settings caused the compiler to not see the definations.

Please find attached a patch that should fix the problem. If nobody on this list complains, I'll push it to master tomorrow.

On 11/16, Lars Wendler wrote:
Hello list,

I am unable to compile wget-1.17 on my Gentoo system. I've already
tried both, gnutls and openssl as ssl provider but that doesn't seem
to have any influence on the outcome:

x86_64-pc-linux-gnu-gcc  -DHAVE_LIBGNUTLS  -DNDEBUG -march=native
-mtune=native -O2 -pipe  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common
-Wl,--as-needed -o wget connect.o convert.o cookies.o ftp.o css_.o
css-url.o ftp-basic.o ftp-ls.o hash.o host.o hsts.o html-parse.o
html-url.o http.o init.o log.o main.o netrc.o progress.o ptimer.o
recur.o res.o retr.o spider.o url.o warc.o utils.o exits.o build_info.o
iri.o  version.o ftp-opie.o gnutls.o ../lib/libgnu.a -lpcre -lgnutls
-lz  -lidn
ftp.o: In function `init_control_ssl_connection.isra.0':
ftp.c:(.text+0x246): undefined reference to `ftp_auth'
ftp.o: In function `getftp':
ftp.c:(.text+0x2971): undefined reference to `ftp_pbsz'
ftp.c:(.text+0x2995): undefined reference to `ftp_prot'
collect2: error: ld returned 1 exit status
Makefile:1492: recipe for target 'wget' failed
make[3]: *** [wget] Error 1


This error didn't appear in wget-1.16.3
Any hint what's going wrong here? In case it helps I have attached the
full build log file (xz compressed).

Kind regards
Lars


P.S.: Please CC me on answers as I am not subscribed to this list.

--
Lars Wendler
Gentoo package maintainer
GPG: 4DD8 C47C CDFA 5295 E1A6 3FC8 F696 74AB 981C A6FC





--
Thanking You,
Darshit Shah

From 6b078e5b4343ca4011228c114d4ec21bd7623d89 Mon Sep 17 00:00:00 2001
From: Darshit Shah <address@hidden>
Date: Tue, 17 Nov 2015 00:16:25 +0100
Subject: [PATCH 2/2] Fix compile error when IPv6 is disabled

* src/ftp-basic.c: The code for the new FTPS functionality was unintentionally
inside a #ifdef IPV6 block. Move the code around so that it is defined even when
IPV6 isn't used
---
src/ftp-basic.c | 118 ++++++++++++++++++++++++++++----------------------------
1 file changed, 59 insertions(+), 59 deletions(-)

diff --git a/src/ftp-basic.c b/src/ftp-basic.c
index bcb7847..378374c 100644
--- a/src/ftp-basic.c
+++ b/src/ftp-basic.c
@@ -429,6 +429,65 @@ ip_address_to_eprt_repr (const ip_address *addr, int port, 
char *buf,
  buf[buflen - 1] = '\0';
}

+/* Bind a port and send the appropriate PORT command to the FTP
+   server.  Use acceptport after RETR, to get the socket of data
+   connection.  */
+uerr_t
+ftp_eprt (int csock, int *local_sock)
+{
+  uerr_t err;
+  char *request, *respline;
+  ip_address addr;
+  int nwritten;
+  int port;
+  /* Must contain the argument of EPRT (of the form |af|addr|port|).
+   * 4 chars for the | separators, INET6_ADDRSTRLEN chars for addr
+   * 1 char for af (1-2) and 5 chars for port (0-65535) */
+  char bytes[4 + INET6_ADDRSTRLEN + 1 + 5 + 1];
+
+  /* Get the address of this side of the connection. */
+  if (!socket_ip_address (csock, &addr, ENDPOINT_LOCAL))
+    return FTPSYSERR;
+
+  /* Setting port to 0 lets the system choose a free port.  */
+  port = 0;
+
+  /* Bind the port.  */
+  *local_sock = bind_local (&addr, &port);
+  if (*local_sock < 0)
+    return FTPSYSERR;
+
+  /* Construct the argument of EPRT (of the form |af|addr|port|). */
+  ip_address_to_eprt_repr (&addr, port, bytes, sizeof (bytes));
+
+  /* Send PORT request.  */
+  request = ftp_request ("EPRT", bytes);
+  nwritten = fd_write (csock, request, strlen (request), -1);
+  if (nwritten < 0)
+    {
+      xfree (request);
+      fd_close (*local_sock);
+      return WRITEFAILED;
+    }
+  xfree (request);
+  /* Get appropriate response.  */
+  err = ftp_response (csock, &respline);
+  if (err != FTPOK)
+    {
+      fd_close (*local_sock);
+      return err;
+    }
+  if (*respline != '2')
+    {
+      xfree (respline);
+      fd_close (*local_sock);
+      return FTPPORTERR;
+    }
+  xfree (respline);
+  return FTPOK;
+}
+#endif
+
#ifdef HAVE_SSL
/*
 * The following three functions defined into this #ifdef block
@@ -542,65 +601,6 @@ bail:
}
#endif /* HAVE_SSL */

-/* Bind a port and send the appropriate PORT command to the FTP
-   server.  Use acceptport after RETR, to get the socket of data
-   connection.  */
-uerr_t
-ftp_eprt (int csock, int *local_sock)
-{
-  uerr_t err;
-  char *request, *respline;
-  ip_address addr;
-  int nwritten;
-  int port;
-  /* Must contain the argument of EPRT (of the form |af|addr|port|).
-   * 4 chars for the | separators, INET6_ADDRSTRLEN chars for addr
-   * 1 char for af (1-2) and 5 chars for port (0-65535) */
-  char bytes[4 + INET6_ADDRSTRLEN + 1 + 5 + 1];
-
-  /* Get the address of this side of the connection. */
-  if (!socket_ip_address (csock, &addr, ENDPOINT_LOCAL))
-    return FTPSYSERR;
-
-  /* Setting port to 0 lets the system choose a free port.  */
-  port = 0;
-
-  /* Bind the port.  */
-  *local_sock = bind_local (&addr, &port);
-  if (*local_sock < 0)
-    return FTPSYSERR;
-
-  /* Construct the argument of EPRT (of the form |af|addr|port|). */
-  ip_address_to_eprt_repr (&addr, port, bytes, sizeof (bytes));
-
-  /* Send PORT request.  */
-  request = ftp_request ("EPRT", bytes);
-  nwritten = fd_write (csock, request, strlen (request), -1);
-  if (nwritten < 0)
-    {
-      xfree (request);
-      fd_close (*local_sock);
-      return WRITEFAILED;
-    }
-  xfree (request);
-  /* Get appropriate response.  */
-  err = ftp_response (csock, &respline);
-  if (err != FTPOK)
-    {
-      fd_close (*local_sock);
-      return err;
-    }
-  if (*respline != '2')
-    {
-      xfree (respline);
-      fd_close (*local_sock);
-      return FTPPORTERR;
-    }
-  xfree (respline);
-  return FTPOK;
-}
-#endif
-
/* Similar to ftp_port, but uses `PASV' to initiate the passive FTP
   transfer.  Reads the response from server and parses it.  Reads the
   host and port addresses and returns them.  */
--
2.6.2





--
Thanking You,
Darshit Shah

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]