Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Apr 2000 20:09:37 -0700 (PDT)
From:      efutch@nyct.net
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/18103: [PATCH] FTP_PASSIVE_MODE and libftpio
Message-ID:  <200004200309.UAA83431@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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 <sean@stat.Duke.EDU> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200004200309.UAA83431>