From 9aa2cb8613615b1982a464ee4c66e494b3bb9e11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Tue, 13 Jun 2006 10:21:03 +0000 Subject: [PATCH] Respect FETCH_BIND_ADDRESS when opening the data connection. PR: misc/98872 --- lib/libfetch/ftp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c index 61165936264..92c51ed5ec9 100644 --- a/lib/libfetch/ftp.c +++ b/lib/libfetch/ftp.c @@ -596,6 +596,7 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file, struct sockaddr_storage sa; struct sockaddr_in6 *sin6; struct sockaddr_in *sin4; + const char *bindaddr; const char *filename; int filenamelen, type; int low, pasv, verbose; @@ -740,6 +741,10 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file, /* connect to data port */ if (verbose) _fetch_info("opening data connection"); + bindaddr = getenv("FETCH_BIND_ADDRESS"); + if (bindaddr != NULL && *bindaddr != '\0' && + _fetch_bind(sd, sa.ss_family, bindaddr) != 0) + goto sysouch; if (connect(sd, (struct sockaddr *)&sa, sa.ss_len) == -1) goto sysouch;