From owner-freebsd-bugs Wed Apr 19 20:20: 6 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id EF91637BDA1 for ; Wed, 19 Apr 2000 20:20:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id UAA84451; Wed, 19 Apr 2000 20:20:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id E45B637B792 for ; Wed, 19 Apr 2000 20:10:02 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: (from nobody@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id UAA83431; Wed, 19 Apr 2000 20:09:37 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Message-Id: <200004200309.UAA83431@freefall.freebsd.org> Date: Wed, 19 Apr 2000 20:09:37 -0700 (PDT) From: efutch@nyct.net To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: bin/18103: [PATCH] FTP_PASSIVE_MODE and libftpio Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 18103 >Category: bin >Synopsis: [PATCH] FTP_PASSIVE_MODE and libftpio >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Apr 19 20:20:00 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Eric Futch >Release: 4.0-STABLE >Organization: New York Connect >Environment: FreeBSD quake.nyct.net 4.0-STABLE FreeBSD 4.0-STABLE #5: Mon Mar 27 20:39:24 EST 2000 efutch@quake.nyct.net:/usr/src/sys/compile/QUAKE i386 >Description: I was just digging around in the libftpio source code. It does only check to see if the FTP_PASSIVE_MODE environment variable is defined at all. I made this small patch to it that I think makes enough sense almost to have it comitted. With this patch it makes libftpio also understand the YES or NO value of FTP_PASSIVE_MODE. It's a diff against src/lib/libftpio.c rev 1.33 from 4.0-STABLE. Check out this patch and let me know if it works for you. The if statements could probably be cleaned up a little :), but it works. It was in reference to a problem someone mentioned on the freebsd-mobile mailing list. I think this would help people who expect FTP_PASSIVE_MODE=NO to acutally NOT use passive mode :) Sean O'Connell mentions: This might be worthy of a PR. The way fetch currently works is a bit wrong (certainly violates POLA). So here it is :) >How-To-Repeat: (tcsh) setenv FTP_PASSIVE_MODE=NO fetch -v ftp://someurl.com/something And notice that it will use passive ftp no matter what. >Fix: Apply this patch. Patch can also be found at: http://quake.nyct.net/~efutch/FreeBSD/ftpio.c.patch Index: src/lib/libftpio/ftpio.c =================================================================== RCS file: /home/ncvs/src/lib/libftpio/ftpio.c,v retrieving revision 1.33 diff -u -r1.33 ftpio.c --- src/lib/libftpio/ftpio.c 1999/09/28 13:33:13 1.33 +++ src/lib/libftpio/ftpio.c 2000/04/20 02:28:20 @@ -498,8 +498,13 @@ static void check_passive(FILE *fp) { - if (getenv("FTP_PASSIVE_MODE")) - ftpPassive(fp, TRUE); + char *cp; + cp = getenv("FTP_PASSIVE_MODE"); + printf("debug: cp(%s)",cp); + if (!cp || (cp && (strncmp(cp,"NO",2)==0))) + ftpPassive(fp, FALSE); + if (cp && (strncmp(cp,"YES",3)==0)) + ftpPassive(fp, TRUE); } static void >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message