From dd799f02088c9c7d57bcf030d7552122d34b8229 Mon Sep 17 00:00:00 2001 From: nsayer Date: Tue, 30 Mar 1999 22:06:08 +0000 Subject: [PATCH] Cause PORT commands to use the high IP port range. This makes fetch (and its friends) more firewall friendly. PR: 10580 Submitted by: nsayer --- lib/libftpio/ftpio.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/libftpio/ftpio.c b/lib/libftpio/ftpio.c index 23cc5d2cb298..6a1d7ab86228 100644 --- a/lib/libftpio/ftpio.c +++ b/lib/libftpio/ftpio.c @@ -14,7 +14,7 @@ * Turned inside out. Now returns xfers as new file ids, not as a special * `state' of FTP_t * - * $Id: ftpio.c,v 1.29 1997/12/20 04:06:05 jb Exp $ + * $Id: ftpio.c,v 1.30 1998/04/11 07:28:53 phk Exp $ * */ @@ -809,7 +809,16 @@ ftp_file_op(FTP_t ftp, char *operation, char *file, FILE **fp, char *mode, off_t *fp = fdopen(s, mode); } else { - int fd; + int fd,portrange; + +#ifdef IP_PORTRANGE + portrange = IP_PORTRANGE_HIGH; + if (setsockopt(s, IPPROTO_IP, IP_PORTRANGE, (char *) + &portrange, sizeof(portrange)) < 0) { + close(s); + return FAILURE; + }; +#endif i = sizeof sin; getsockname(ftp->fd_ctrl, (struct sockaddr *)&sin, &i);