in reply to Re: DNS aliases
in thread DNS aliases

Not quite - when you do a gethostbyaddr, it returns a few different things... from perldoc:

($name,$aliases,$addrtype,$length,@addrs) = gethost*

if I gethostbyname, however, it populates $aliases with the same name you specified in the initial call to gethostbyname...


No freaking way it compiled on the first try...

Replies are listed 'Best First'.
Re^3: DNS aliases
by ikegami (Patriarch) on Dec 21, 2004 at 18:08 UTC

    Did you try those commands? They support what I said.

    gethostbyname("unix.unb.ca") (an alias) returns jupiter.sun.csd.unb.ca for name, unix.unb.ca for alias and 131.202.3.8 for address.

    gethostbyname("jupiter.sun.csd.unb.ca") returns jupiter.sun.csd.unb.ca for name, nothing for alias (even though it has unix.unb.ca for alias) and 131.202.3.8 for address.

    gethostbyaddr(inet_aton("131.202.3.8"), AF_INET)) returns jupiter.sun.csd.unb.ca for name, nothing for alias (even though it has unix.unb.ca for alias) and 131.202.3.8 for address.

    DNS simply does not provide the means to specify or query the information needed. You could parse the zone file if you had access to it, but the OP indicated he does not (at least, not via DNS).

    There's also the scenario where domains from different zone files point to the same address:
    cosplay.ca.  A 63.111.28.139
    adaelis.com. A 63.111.28.139
    Unless you had the zone files for every domain out in existance -- and no machine ever does or ever could -- you'd never be sure that you knew all the domains that point to an address. However, this paragraph is probably beyond the scope of the OP's question.