summaryrefslogtreecommitdiff
path: root/usr.bin/ftp/ftp.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-12-13 21:01:30 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-12-13 21:01:30 +0000
commit0c9a6d88e767f46f5aadfc2505fbc0f083b127cb (patch)
treef65b02e557768930f1aa8c0cf5019c98572fa17f /usr.bin/ftp/ftp.c
parentb54b0fd90e8994e918017b66eadbd7a12338f3f7 (diff)
Fall back from passive to active if connect() fails. This can happen if the remote server has an ip filter in place (live cvs does).
Diffstat (limited to 'usr.bin/ftp/ftp.c')
-rw-r--r--usr.bin/ftp/ftp.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.bin/ftp/ftp.c b/usr.bin/ftp/ftp.c
index d41bb3eec8f..2d8896e6eeb 100644
--- a/usr.bin/ftp/ftp.c
+++ b/usr.bin/ftp/ftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftp.c,v 1.32 1998/09/19 23:00:50 deraadt Exp $ */
+/* $OpenBSD: ftp.c,v 1.33 1998/12/13 21:01:29 millert Exp $ */
/* $NetBSD: ftp.c,v 1.27 1997/08/18 10:20:23 lukem Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94";
#else
-static char rcsid[] = "$OpenBSD: ftp.c,v 1.32 1998/09/19 23:00:50 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ftp.c,v 1.33 1998/12/13 21:01:29 millert Exp $";
#endif
#endif /* not lint */
@@ -1167,6 +1167,13 @@ reinit:
sizeof(data_addr)) < 0) {
if (errno == EINTR)
continue;
+ if (activefallback) {
+ (void)close(data);
+ data = -1;
+ passivemode = 0;
+ activefallback = 0;
+ goto reinit;
+ }
warn("connect");
goto bad;
}