rwrap: Add support for res_ninit().

Signed-off-by: Andreas Schneider <asn@samba.org>
rwrap: Add support for res_nclose().

Signed-off-by: Andreas Schneider <asn@samba.org>
rwrap: Add support for res_nquery().

Signed-off-by: Andreas Schneider <asn@samba.org>
rwrap: Add support for res_nsearch().

Signed-off-by: Andreas Schneider <asn@samba.org>
rwrap: Add support to read a resolv.conf.

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Pair-Programmed-With: Andreas Schneider <asn@samba.org>
tests: Add a test for parsing resolv.conf

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
doc: Update the manpage.

Signed-off-by: Andreas Schneider <asn@samba.org>
Add TODO file.

Signed-off-by: Andreas Schneider <asn@samba.org>
tests: Add a simple DNS server

This DNS server will be usable for testing. Currently only supports A
records.

The server responds to any A query with the value of RWRAP_TEST_A_REC
environment variable. If undefined, the server always replies with
127.0.10.10.

Please note the server does *not* perform many security checks and is
completely unsuitable outside a test suite! Check out servers like
dnsmasq for anything more complex.

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
tests: Add torture library from socket_wrapper

Pretty much a blatant copy of the torture library from socket_wrapper,
just s/echo_srv/dns_srv/

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
tests: Add generating resolv.conf to torture

Adds a setup/teardown functions that allow a unit test to easily
generate a resolv.conf pointing to our test DNS server.

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
tests: Add a unit test for res_nquery and res_nsearch

Adds a test that connects to a test DNS server and searches it using
res_query and res_search.

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
cmake: Rely on the cmake config cmocka provides.
resolv: Implement faking A and AAAA DNS replies

Adds the possibility of faking a DNS reply based on a hosts-like file.
resolv: Implement SRV faking
resolv: Implement SOA faking
resolv: Implement CNAME faking
doc: Update manpage.

Signed-off-by: Andreas Schneider <asn@samba.org>
Allow SRV records without port or weight