resolv_wrapper.git
9 years agoresolv: Implement SRV faking
Jakub Hrozek [Sat, 4 Oct 2014 14:26:58 +0000 (16:26 +0200)]
resolv: Implement SRV faking

Signed-off-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoresolv: Implement faking A and AAAA DNS replies
Jakub Hrozek [Sun, 14 Sep 2014 09:12:56 +0000 (11:12 +0200)]
resolv: Implement faking A and AAAA DNS replies

Adds the possibility of faking a DNS reply based on a hosts-like file.

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agocmake: Rely on the cmake config cmocka provides.
Andreas Schneider [Tue, 16 Sep 2014 13:37:38 +0000 (15:37 +0200)]
cmake: Rely on the cmake config cmocka provides.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agotests: Add a unit test for res_nquery and res_nsearch
Jakub Hrozek [Fri, 12 Sep 2014 13:49:01 +0000 (15:49 +0200)]
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>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agotests: Add generating resolv.conf to torture
Jakub Hrozek [Sat, 13 Sep 2014 15:09:30 +0000 (17:09 +0200)]
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>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agotests: Add torture library from socket_wrapper
Jakub Hrozek [Fri, 12 Sep 2014 12:49:16 +0000 (14:49 +0200)]
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>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agotests: Add a simple DNS server
Jakub Hrozek [Mon, 8 Sep 2014 07:48:17 +0000 (09:48 +0200)]
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>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agodoc: Update the manpage for resolv.conf.
Andreas Schneider [Thu, 4 Sep 2014 09:19:04 +0000 (11:19 +0200)]
doc: Update the manpage for resolv.conf.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agodoc: Add instructions how to point cmake to socket_wrapper
Michael Adam [Wed, 15 Oct 2014 09:52:08 +0000 (11:52 +0200)]
doc: Add instructions how to point cmake to socket_wrapper

This is needed for unit testing.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agotests: Add a test for parsing resolv.conf
Jakub Hrozek [Wed, 3 Sep 2014 15:32:27 +0000 (17:32 +0200)]
tests: Add a test for parsing resolv.conf

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agorwrap: Add support to read a resolv.conf.
Jakub Hrozek [Wed, 3 Sep 2014 12:34:15 +0000 (14:34 +0200)]
rwrap: Add support to read a resolv.conf.

For now, only "nameserver" entries are interpreted.

Pair-Programmed-With: Andreas Schneider <asn@samba.org>

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agorwrap: Add support for res_[n]search().
Andreas Schneider [Tue, 2 Sep 2014 12:19:32 +0000 (14:19 +0200)]
rwrap: Add support for res_[n]search().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agorwrap: Add support for res_[n]query().
Andreas Schneider [Tue, 2 Sep 2014 12:06:00 +0000 (14:06 +0200)]
rwrap: Add support for res_[n]query().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agorwrap: Add support for res_nclose().
Andreas Schneider [Mon, 1 Sep 2014 15:23:13 +0000 (17:23 +0200)]
rwrap: Add support for res_nclose().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agorwrap: Add initial support for res_[n]init().
Andreas Schneider [Mon, 1 Sep 2014 10:41:17 +0000 (12:41 +0200)]
rwrap: Add initial support for res_[n]init().

This first approach does not parse a resolv.conf file
but instead takes a nameserver address from the environment
variable RESOLV_WRAPPER_NAMESERVER.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agorwrap: Add .gitignore.
Andreas Schneider [Thu, 4 Sep 2014 05:57:11 +0000 (07:57 +0200)]
rwrap: Add .gitignore.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agorwrap: Big bang!
Andreas Schneider [Thu, 28 Aug 2014 15:47:06 +0000 (17:47 +0200)]
rwrap: Big bang!

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>