[chrony-dev] nameserv.c unused #ifdef and getnameinfo result ignored

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


In the file nameserver.c in the function DNS_IPAddress2Name
the program starts out with an
#ifdef HAVE_IPV6 .....
#else
....
#ifdef HAVE_IPV6
....
#endif
....
#endif

That second block of #ifdef HAVE_IPV6 will never be used since it is in a
block that is run only if HAVE_IPV6 is not set.

Also, this routine simply accepts anything that the getnameinfo throws at it
without doing any error checking.

I suspect that Lord's problem with the sources command giving him IP addresses
rather than names is in the use of the getnameinfo() rather than the old
getnamebyaddr, and perhaps some buffer length problem.

Ie he has HAVE_IPV6 set, and the getnameinfo is returning some error result (eg
buffer to small) which results in the DNS_IPAddress2Name returning the IP. At least one should have
 if(result)
   LOG(LOGS_INFO,LOGF_Sources,"Could not determine name from ip:%s",gai_strerror(result));
after the result=getnameinfo(... lines.

to tell us what error is occuring in the name translation.



--
William G. Unruh   |  Canadian Institute for|     Tel: +1(604)822-3273
Physics&Astronomy  |     Advanced Research  |     Fax: +1(604)822-5324
UBC, Vancouver,BC  |   Program in Cosmology |     unruh@xxxxxxxxxxxxxx
Canada V6T 1Z1     |      and Gravity       |  www.theory.physics.ubc.ca/

---
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/