Maybe you are wrong. or may be I am but:
in reply to RE: Resolve addresses in web access logs (risk of gethostbyaddr)
in thread Resolve addresses in web access logs
gethostbyaddr returns the names matching the ip.
reverse name entries is as secure as dns gets. if
the ip has a reverse name, the ip for that name
will match the ip.
the discussion in the Cookbook is about
looking, whether the ipaddress you got when looking up by
name, matches the original name. which it
will not, unless you have a reverse entry for the same name.