diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-06-12 12:02:56 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2000-06-12 12:02:56 +0000 |
commit | 4be3342329c0842fd44b1cd8cf5f1c708e725174 (patch) | |
tree | f3670ef7d94eba5e7d2bbe09e7b6ac9339419735 /libexec/ftpd | |
parent | f484936899e3bfdc54f56853c734ebb4ab2d9ec3 (diff) |
address PR 1274 (-h does not work on EPSV).
the committed code handles IPv6 case too.
Diffstat (limited to 'libexec/ftpd')
-rw-r--r-- | libexec/ftpd/ftpd.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 8038513c5bb..57165a640ee 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpd.c,v 1.71 2000/04/29 14:02:59 deraadt Exp $ */ +/* $OpenBSD: ftpd.c,v 1.72 2000/06/12 12:02:55 itojun Exp $ */ /* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */ /* @@ -2150,7 +2150,7 @@ pasv_error: void long_passive(char *cmd, int pf) { - int len; + int len, on; register u_char *p, *a; if (!logged_in) { @@ -2202,6 +2202,27 @@ long_passive(char *cmd, int pf) perror_reply(425, "Can't open passive connection"); return; } + + switch (ctrl_addr.su_family) { + case AF_INET: +#ifdef IP_PORTRANGE + on = high_data_ports ? IP_PORTRANGE_HIGH : IP_PORTRANGE_DEFAULT; + if (setsockopt(pdata, IPPROTO_IP, IP_PORTRANGE, + (char *)&on, sizeof(on)) < 0) + goto pasv_error; +#endif + break; + case AF_INET6: +#ifdef IPV6_PORTRANGE + on = high_data_ports ? IPV6_PORTRANGE_HIGH + : IPV6_PORTRANGE_DEFAULT; + if (setsockopt(pdata, IPPROTO_IPV6, IPV6_PORTRANGE, + (char *)&on, sizeof(on)) < 0) + goto pasv_error; +#endif + break; + } + pasv_addr = ctrl_addr; pasv_addr.su_port = 0; (void) seteuid((uid_t) 0); |