Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2000:
[Freeciv-Dev] Re: Hostname lookups again.
Home

[Freeciv-Dev] Re: Hostname lookups again.

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Hostname lookups again.
From: Gaute B Strokkenes <gs234@xxxxxxxxx>
Date: 20 Sep 2000 14:37:50 +0200

Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx> writes:

> On 20 Sep 2000, Gaute B Strokkenes wrote:
> 
> Such a marvelous extensible function that it isn't MT Safe and you
> can't tell it which address family you want to lookup for the
> address.  I'm pretty certain all future programs which support IPv6
> will use it eh?

On my system, /usr/include/bits/socket.h defines 23 different PF_*
macros.  Can you guarantee that none of these will ever show up in
gethostbyname() and that none ever will?  Maybe you can--I can't.

> > So the experts are not agreed, or there are conflicting standards
> > and/or implementations out there.  And you can bet that whatever
> > reference is correct, if there is misleading documentation out there,
> > there will be similarly demented implementations.  Accept, check, and
> > deflect.  Simple.
> 
> I dunno if you checked that W. Stevens (R.I.P.) was in the name list in
> the top of the document.  If that name doesn't tell you anything, go find
> out who he was and you'll see how much weight he had in the community.
> And this is RFC 2553 even if it's "informational".  You know what an RFC
> is right?

Yes, I know what a RFC is.  I also know that RFCs are often
misinterpreted or the protocols described misimplemented, or even
worse, simply ignored by besserwissers.  I also know that occasionally
RFCs are superseded by largely, but not quite, upwards compatible
versions, and that sometimes support is written before a RFC is
finalised.  All of which happens without old and obsolete
implementations magically vanishing in a puff of smoke.

Looking at my manpage, it would appear that I have found such a
system.  You shouldn't be yelling at me about RFCs, you should be
yelling at the people who put my system together.

> I just want to see it to believe it.  Prove me: show me a real case.

The manpage tells me that gethostbyname() might very well return a
non-AF_INET address.  I think that's sufficient grounds for a check.

> Sure, but if all people checked for every screwball error that could
> exist you would have more error checking code than real program
> code.

Sensible people apply sensible metrics and weigh the usefulness of the
test against the added complexity.  Not every condition is worth
testing for.

> Especially something as remote as this and which wouldn't cause any
> major problem if it did exist (and you haven't proven me that).

Assuming that nothing will go wrong just because you can't prove that
something will go wrong is poor engineering.  In this case, there is
the choice between between simply assuming that there never will be
any trouble on any platform, past, present or future, or just adding
an incredibly simple, half-a-line-long test and put the matter to rest
for all eternity.

> > <bastard-mode>I thought you just said that we shouldn't support broken
> > systems?</bastard-mode>But then again, if someone can't connect to a
> > DNS server they're probably either not connected or too busy fixing
> > their broken setup to play Freeciv.
> 
> I didn't say that.  If you had bothered to read what i said you would have
> noticed that i said we shouldn't check for security flaws on libc, that's
> libc's problem.

I did read it, which is why I enclosed the sentence in <bastard-mode>
tags.  Please don't be offended.

> As far as me not taking notice of your complaints...

I'm sorry, but when did I complain?

> I don't care about them until i hear someone complain with a real
> problem, i never heard real complaints about this and i've been
> around for a bit.

Until last week you didn't hear complaints about the isdigit() call,
either.  I really find it hard to believe that you can get so worked
up about this simple, straightforward test.  It's not like you're
being asked to make fundamental changes.

In any case, I have prepared another patch which uses inet_aton(),
falling back to inet_addr() if that's not available.  It also moves
this stuff into a function called look_up_host() since it has grown a
bit long, but that is probably a good idea anyway.  It also changes
the check that we've been arguing about to asserts, a compromise which
I hope will please everyone.

I'll post it after I've given it a bit more testing.

-- 
Big Gaute (not to be confused with LG)
All of a sudden, I want to THROW OVER my promising ACTING CAREER,
 grow a LONG BLACK BEARD and wear a BASEBALL HAT!!
 ...  Although I don't know WHY!!



[Prev in Thread] Current Thread [Next in Thread]