From 0c9a6d88e767f46f5aadfc2505fbc0f083b127cb Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 13 Dec 1998 21:01:30 +0000 Subject: 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). --- usr.bin/ftp/ftp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'usr.bin') 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; } -- cgit v1.2.3