make LPRT on IPv4 work.

make LPSV on IPv6 work.
This commit is contained in:
itojun 1999-07-11 20:03:41 +00:00
parent 3e29511219
commit e983200c64
2 changed files with 51 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ftpcmd.y,v 1.33 1999/07/02 07:11:36 itojun Exp $ */
/* $NetBSD: ftpcmd.y,v 1.34 1999/07/11 20:03:41 itojun Exp $ */
/*
* Copyright (c) 1985, 1988, 1993, 1994
@ -47,7 +47,7 @@
#if 0
static char sccsid[] = "@(#)ftpcmd.y 8.3 (Berkeley) 4/6/94";
#else
__RCSID("$NetBSD: ftpcmd.y,v 1.33 1999/07/02 07:11:36 itojun Exp $");
__RCSID("$NetBSD: ftpcmd.y,v 1.34 1999/07/11 20:03:41 itojun Exp $");
#endif
#endif /* not lint */
@ -243,15 +243,37 @@ cmd
}
}
| LPRT check_login SP host_long_port CRLF
| LPRT check_login SP host_long_port4 CRLF
{
/* be paranoid, if told so */
if (curclass.checkportcmd &&
((ntohs(data_dest.su_port) <
IPPORT_RESERVED) ||
memcmp(&data_dest.su_sin6.sin6_addr,
&his_addr.su_sin6.sin6_addr,
sizeof(data_dest.su_sin6.sin6_addr)) != 0)) {
((ntohs(data_dest.su_port) < IPPORT_RESERVED) ||
memcmp(&data_dest.su_sin.sin_addr,
&his_addr.su_sin.sin_addr,
sizeof(data_dest.su_sin.sin_addr)) != 0)) {
reply(500, "Illegal LPRT command rejected");
return (NULL);
}
if (epsvall)
reply(501, "LPRT disallowed after EPSV ALL");
else {
usedefault = 0;
if (pdata >= 0) {
(void) close(pdata);
pdata = -1;
}
reply(200, "LPRT command successful.");
}
}
| LPRT check_login SP host_long_port6 CRLF
{
/* be paranoid, if told so */
if (curclass.checkportcmd &&
((ntohs(data_dest.su_port) < IPPORT_RESERVED) ||
memcmp(&data_dest.su_sin6.sin6_addr,
&his_addr.su_sin6.sin6_addr,
sizeof(data_dest.su_sin6.sin6_addr)) != 0)) {
reply(500, "Illegal LPRT command rejected");
return (NULL);
}
@ -392,7 +414,7 @@ cmd
if (epsvall)
reply(501, "LPSV disallowed after EPSV ALL");
else
long_passive("LPSV", AF_INET6);
long_passive("LPSV", PF_UNSPEC);
}
| EPSV SP NUMBER CRLF
@ -893,7 +915,24 @@ host_port
}
;
host_long_port
host_long_port4
: NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
NUMBER
{
char *a, *p;
data_dest.su_sin.sin_len =
sizeof(struct sockaddr_in);
data_dest.su_family = AF_INET;
p = (char *)&data_dest.su_port;
p[0] = $15; p[1] = $17;
a = (char *)&data_dest.su_sin.sin_addr;
a[0] = $5; a[1] = $7; a[2] = $9; a[3] = $11;
}
;
host_long_port6
: NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA

View File

@ -1,4 +1,4 @@
.\" $NetBSD: ftpd.8,v 1.38 1999/07/02 05:54:21 itojun Exp $
.\" $NetBSD: ftpd.8,v 1.39 1999/07/11 20:03:41 itojun Exp $
.\"
.\" Copyright (c) 1985, 1988, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -672,14 +672,10 @@ recommended.
When running on IPv6, connection from IPv4 mapped address
.Pq IPv4 connection to IPv6 socket
is not supported yet.
Please run two daemons, one for IPv4 and one for IPv6, for the moment.
Please run two daemons, one for IPv4 and one for IPv6.
.Pp
Don't create
.Pa ~ftp/tmp
if you don't want anonymous users to upload files there.
That directory is only necessary if you want to display the error
messages of conversion commands to the user.
.Pp
.Nm
Does not accept LPRT on IPv4 at this moment, which it should.
.\" EPSV/EPRT is the way to go so it is non-issue.