[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: check for conflicting *Port directives



On Sat, Jun 23, 2007 at 08:45:04PM +0100, Robert Hogan wrote:
> 
> if someone does something like:
> 
> ORPort 9031
> SocksPort 9031
> 
> this will tell them where they've screwed up, rather than attempting
> to bind to the port and fail for the second of the two options.
> 
> possibly a case of sledgehammer meets walnut (it's a large patch for
> what it's fixing). If the idea is right it will need some cleaning
> to be up to standard, but hopefully this will be less than the time
> required to write from scratch.

Hi, Robert!  This is a good idea, but I think I see an issue with this
patch. It keeps you from doing stuff like the following, which _is_
legal:

        ORPort 9031
        SocksPort 9031
        ORListenAddress 1.2.3.4
        SocksListenAddress 127.0.0.1

And it doesn't stop you from doing stuff like this, which gives a port
conflict:

        ORPort 9031
        SocksPort 9032
        ORListenAddress 0.0.0.0:9031
        SocksListenAddress 127.0.0.1:9031

Minor issues to consider during the cleanup:

   1) It doesn't pass make check-spaces.
   2) It isn't indented like the rest of config.c.
   3) It doesn't even come close to building under ./configure
      --enable-gcc-warnings.
   4) Consider using the smartlist mechanism for dynamically growing
      arrays.
   5) Port_add is probably misnamed; it doesn't add a port.

peace,
-- 
Nick Mathewson

Attachment: pgp5LiG3evMAL.pgp
Description: PGP signature