Date: Fri, 23 Mar 2001 13:44:56 -0800 (PST) From: Peter Wemm <peter@yahoo-inc.com> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/26038: libfetch does not use IP_PORTRANGE_HIGH by default Message-ID: <200103232144.f2NLiuS81327@daintree.yahoo.com>
next in thread | raw e-mail | index | archive | help
>Number: 26038 >Category: bin >Synopsis: libfetch does not use IP_PORTRANGE_HIGH by default >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Mar 23 13:50:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Peter Wemm >Release: FreeBSD 5.0-CURRENT i386 >Organization: FreeBSD.org >Environment: System: FreeBSD daintree.yahoo.com 5.0-CURRENT FreeBSD 5.0-CURRENT #21: Mon Mar 19 13:09:28 PST 2001 peter@daintree.yahoo.com:/home/src/sys/compile/DAINTREE i386 FreeBSD-current as of a few days ago. >Description: The old fetch(1)/libftpio library unconditionally used the RFC sanctioned high port range. This space is intentionally intended to be used so that proxy libraries can rewrite the PORT tcp packets on data streams on NATs, and so that firewalls have a safe target range that can allow incoming connections that is free from the ephemeral ports that are used by things like rpc services. The new fetch/libfetch has regressed to requiring an option to use this. >How-To-Repeat: Old code (unconditional use of IP_PORTRANGE_HIGH): portrange = IP_PORTRANGE_HIGH; if (setsockopt(s, IPPROTO_IP, IP_PORTRANGE, (char *) &portrange, sizeof(portrange)) < 0) { close(s); return FAILURE; }; New code (broken): high = CHECK_FLAG('h'); arg = high ? IP_PORTRANGE_HIGH : IP_PORTRANGE_DEFAULT; if (setsockopt(sd, IPPROTO_IP, IP_PORTRANGE, (char *)&arg, sizeof arg) == -1) goto sysouch; break; (where the 'h' flag is off by default :-( ) >Fix: Minimal fix, minus man page and some comment updates. Index: fetch.c =================================================================== RCS file: /home/ncvs/src/usr.bin/fetch/fetch.c,v retrieving revision 1.26 diff -u -r1.26 fetch.c --- fetch.c 2001/03/07 05:33:50 1.26 +++ fetch.c 2001/03/23 21:43:39 @@ -55,7 +55,7 @@ int d_flag; /* -d: direct connection */ int F_flag; /* -F: restart without checking mtime */ char *f_filename; /* -f: file to fetch */ -int H_flag; /* -H: use high port */ +int H_flag = 1; /* -H: use high port */ char *h_hostname; /* -h: host to fetch from */ int l_flag; /* -l: link rather than copy file: URLs */ int m_flag; /* -[Mm]: mirror mode */ @@ -537,7 +537,7 @@ int c, e, r; while ((c = getopt(argc, argv, - "146AaB:bc:dFf:h:lHMmnPpo:qRrS:sT:tvw:")) != EOF) + "146AaB:bc:dFf:h:lHMmnPpo:qRrS:sT:tUvw:")) != EOF) switch (c) { case '1': once_flag = 1; @@ -625,6 +625,9 @@ case 't': t_flag = 1; warnx("warning: the -t option is deprecated"); + break; + case 'U': + H_flag = 0; break; case 'v': v_level++; >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?200103232144.f2NLiuS81327>