chiark / gitweb /
noip (decode_inet_addr): Be more careful when converting addresses.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 12 Jan 2009 17:53:35 +0000 (17:53 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 12 Jan 2009 17:53:35 +0000 (17:53 +0000)
commit00a98a8ab227c8a3fc658ddb6e1bdc9d3cc71466
treeac1b2d7533c022b1fba34d920177a402f3176d94
parent8ce11853751d12c81fdd71a67af21e7c176c15e0
noip (decode_inet_addr): Be more careful when converting addresses.

The old version of decode_inet_addr would convert empty Unix-domain
addresses to wildcard Internet addresses, which is erroneous in a number
of situations.  In particular, this causes problems in some servers
which maintain parallel Unix-domain and Internet listening sockets, and
use the address family reported by accept(2) to decide what to do: if
the incoming connection is from an unbound (but real) Unix-domain
socket, it gets misinterpreted.

This fixes decode_inet_addr to be more selective about its decoding of
empty addresses.  It must do the decoding when swapping in a genuine IP
socket, but when called via return_fake_name it's wrong to do this: a
remote socket which ought to be decoded will have been bound either
explicitly by the peer or implicitly by do_implicit_bind.  (Actually,
getsockname might now be wrong when called on an unbound socket, but
that's probably a small price to pay -- and there's no way of returning
the right answer in this case anyway.)
noip.c