Author: des Date: Tue Sep 27 18:42:09 2011 New Revision: 225812 URL: http://svn.freebsd.org/changeset/base/225812
Log: Think first, commit second. 1. Allow the caller to select active mode. 2. Fix the envar logic so it *always* overrides the caller's flags. 3. Document the change from active to passive. Modified: head/lib/libfetch/fetch.3 head/lib/libfetch/ftp.c Modified: head/lib/libfetch/fetch.3 ============================================================================== --- head/lib/libfetch/fetch.3 Tue Sep 27 18:40:13 2011 (r225811) +++ head/lib/libfetch/fetch.3 Tue Sep 27 18:42:09 2011 (r225812) @@ -318,9 +318,19 @@ and implement the FTP protocol as described in RFC959. .Pp If the +.Ql P +(not passive) flag is specified, an active (rather than passive) +connection will be attempted. +.Pp +The .Ql p -(passive) flag is specified, a passive (rather than active) connection -will be attempted. +flag is supported for compatibility with earlier versions where active +connections were the default. +It has precedence over the +.Ql P +flag, so if both are specified, +.Nm +will use a passive connection. .Pp If the .Ql l @@ -475,9 +485,11 @@ connections will be bound. .It Ev FTP_LOGIN Default FTP login if none was provided in the URL. .It Ev FTP_PASSIVE_MODE -If set to anything but +If set to .Ql no , -forces the FTP code to use passive mode. +forces the FTP code to use active mode. +If set to any other value, forces passive mode even if the application +requested active mode. .It Ev FTP_PASSWORD Default FTP password if the remote server requests one and none was provided in the URL. Modified: head/lib/libfetch/ftp.c ============================================================================== --- head/lib/libfetch/ftp.c Tue Sep 27 18:40:13 2011 (r225811) +++ head/lib/libfetch/ftp.c Tue Sep 27 18:42:09 2011 (r225812) @@ -633,13 +633,12 @@ ftp_transfer(conn_t *conn, const char *o /* check flags */ low = CHECK_FLAG('l'); - pasv = CHECK_FLAG('p'); + pasv = CHECK_FLAG('p') || !CHECK_FLAG('P'); verbose = CHECK_FLAG('v'); /* passive mode */ - if (!pasv) - pasv = ((s = getenv("FTP_PASSIVE_MODE")) == NULL || - strncasecmp(s, "no", 2) == 0); + if ((s = getenv("FTP_PASSIVE_MODE")) != NULL) + pasv = (strncasecmp(s, "no", 2) != 0); /* isolate filename */ filename = ftp_filename(file, &filenamelen, &type); _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"