On Thu, Feb 25, 2016 at 10:53:43AM +0100, Sumit Bose wrote:
On Wed, Feb 24, 2016 at 05:19:50PM -0500, Justin Stephenson wrote:
First patch, see attached.
This is for easy fix from ticket https://fedorahosted.org/sssd/ticket/2789
I am going on the assumption that if the first 2 characters of ad_server are digits then it is likely an IP address and not hostname. If you have a better idea for this please let me know.
I think the check should be more elaborate, IPv6 addreses must not start with a number and e.g. 123.com is a valid domain name.
You can try to use getaddrinfo() with AI_NUMERICHOST as hint. I would expect that getaddrinfo() returns an error if the input is not a IPv4 or IPv6 address. It would be nice if you can wrap the call to getaddrinfo() in an extra function and write some unit tests for this function. This way you can easily make sure getaddrinfo() really behaves as I suspect/hope.
I think you can just make the resolv_is_address() function of our resolver public and write some tests.
btw the check would be better done in _ad_servers_init() and _ipa_servers_init().