"Ted Unangst" <t...@tedunangst.com> writes:

> stop testing for stuff we have.

ok, but there's possible concern over one chunk.

> Index: ftpd.c
> ===================================================================
> RCS file: /cvs/src/libexec/ftpd/ftpd.c,v
> retrieving revision 1.219
> diff -u -p -r1.219 ftpd.c
> --- ftpd.c    26 Aug 2016 06:32:10 -0000      1.219
> +++ ftpd.c    30 Aug 2016 12:50:04 -0000
> @@ -151,9 +151,6 @@ char      remotehost[HOST_NAME_MAX+1];
>  char dhostname[HOST_NAME_MAX+1];
>  char *guestpw;
>  char ttyline[20];
> -#if 0
> -char *tty = ttyline;         /* for klogin */
> -#endif
>  static struct utmp utmp;     /* for utmp */
>  static       login_cap_t *lc;
>  static       auth_session_t *as;
> @@ -529,7 +526,6 @@ main(int argc, char *argv[])
>       }
>       if (his_addr.su_family == AF_INET6 &&
>           IN6_IS_ADDR_V4MAPPED(&his_addr.su_sin6.sin6_addr)) {
> -#if 1
>               /*
>                * IPv4 control connection arrived to AF_INET6 socket.
>                * I hate to do this, but this is the easiest solution.
> @@ -554,33 +550,18 @@ main(int argc, char *argv[])
>                   &tmp_addr.su_sin6.sin6_addr.s6_addr[off],
>                   sizeof(ctrl_addr.su_sin.sin_addr));
>               ctrl_addr.su_sin.sin_port = tmp_addr.su_sin6.sin6_port;

Here the code attempts to deal with IPv4-mapped IPv6 addresses,
something that won't show up on OpenBSD.  We don't support them on
purpose, to avoid surprises and this kind of ugly code.

One could argue that if someone ported the ftpd code to another OS, he
should make sure that IPv6 sockets can't receive connections from IPv4
peers (the IPV6_V6ONLY setsockopt).  The code below could be a better
hint, but it's still dead code on OpenBSD.

> -#else
> -             while (fgets(line, sizeof(line), fd) != NULL) {
> -                     line[strcspn(line, "\n")] = '\0';
> -                     lreply(530, "%s", line);
> -             }
> -             (void) fflush(stdout);
> -             (void) close(fd);
> -             reply(530,
> -                     "Connection from IPv4 mapped address is not 
> supported.");
> -             exit(0);
> -#endif

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to