summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
Jakub Hrozek [Tue, 25 Nov 2014 17:34:45 +0000 (18:34 +0100)]
tests: Query A record via CNAME
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Jakub Hrozek [Tue, 25 Nov 2014 17:34:28 +0000 (18:34 +0100)]
rwrap: Support asking for A via CNAME
Adds support for querying for an A record using a name that only expands
into a CNAME.
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Jakub Hrozek [Tue, 25 Nov 2014 17:33:29 +0000 (18:33 +0100)]
tests: test that CNAME and SRV records can recurse
Add tests for recursing into a CNAME record.
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Jakub Hrozek [Tue, 25 Nov 2014 17:33:21 +0000 (18:33 +0100)]
rwrap: Recursively add additional data
Change how we construct the fake answer such that the header and
question are added first, then the answers and finally additional data.
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Jakub Hrozek [Tue, 18 Nov 2014 10:33:42 +0000 (11:33 +0100)]
rwrap: Make the rwrap_fake_* functions only fake RRs
The rwrap_fake_common() function did too much. Remove it and use
separate functions to add fake header and question sections. The
rwrap_fake_$RR functions will receive packet including the header and
question and only add its RR data.
This will allow recursive processing later.
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Jakub Hrozek [Sun, 23 Nov 2014 16:40:57 +0000 (17:40 +0100)]
rwrap: CNAME record can recurse into A, AAAA or CNAME
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Jakub Hrozek [Sun, 23 Nov 2014 16:40:32 +0000 (17:40 +0100)]
rwrap: SRV record can recurse into A or AAAA
When querying for a SRV record, we'll need to include A or AAAA records
in additional section. Therefore, keep querying the host file until we
can either recurse the A/AAAA records or reach the recursion limit
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Jakub Hrozek [Sun, 23 Nov 2014 15:57:32 +0000 (16:57 +0100)]
rwrap: Use the rwrap_fake_rr structure instead of raw uint8_t pointers
Currently only one instance of the rwrap_fake_rr structure is used. Recursion
will be implemented in a future patch.
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Jakub Hrozek [Sun, 23 Nov 2014 15:47:55 +0000 (16:47 +0100)]
Add data structures and functions to represent and manipulate RRs
Adds a structure that, using unions represents all supported RRs. Add a
bunch of utility functions that can be used to create these structures.
Currently the functions are unused.
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Andreas Schneider [Wed, 5 Nov 2014 12:48:49 +0000 (13:48 +0100)]
tests: Add a test which talks to real nameservers.
This is to inspect the answer buffer and be able to compare it.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Andreas Schneider [Tue, 4 Nov 2014 16:14:22 +0000 (17:14 +0100)]
rwrap: Correctly calculate the response size and return it.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Andreas Schneider [Tue, 4 Nov 2014 14:20:11 +0000 (15:20 +0100)]
rwrap: Handle trailing dot in dns names.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Jakub Hrozek [Tue, 4 Nov 2014 14:00:17 +0000 (15:00 +0100)]
rwrap: Compare dns names case insensitive.
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Andreas Schneider [Tue, 4 Nov 2014 15:25:02 +0000 (16:25 +0100)]
torture: Increase time to wait for pid file.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Andreas Schneider [Fri, 24 Oct 2014 13:35:19 +0000 (15:35 +0200)]
cmake: Do not remove libresolv from required libraries.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Fri, 24 Oct 2014 08:13:23 +0000 (10:13 +0200)]
Add ChangeLog file.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Fri, 24 Oct 2014 08:13:01 +0000 (10:13 +0200)]
Add Jakub to AUTHORS file.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Fri, 24 Oct 2014 09:16:09 +0000 (11:16 +0200)]
rwrap: Fix the cleanup of the ns ext resources.
We should never set nssocks to something different than -1. And we only
should set it in the init function!
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Thu, 23 Oct 2014 10:41:52 +0000 (12:41 +0200)]
cmake: Fix tests on Solaris.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Thu, 23 Oct 2014 10:30:50 +0000 (12:30 +0200)]
torture: Fix socket directory name.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Thu, 23 Oct 2014 05:51:04 +0000 (07:51 +0200)]
tests: Fix test_res_ninit() with IPv4 only support.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Thu, 23 Oct 2014 05:46:53 +0000 (07:46 +0200)]
rwrap: Fix symbol binding on Solaris.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Jakub Hrozek [Tue, 21 Oct 2014 16:42:44 +0000 (18:42 +0200)]
tests: Use the right array size in tests.
Several unit tests used the wrong array size, which might cause buffer
overflows. This patch unifies on using sizeof(array) since all the
arrays are allocated on stack.
CID #68270
CID #68269
CID #68267
CID #68265
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Jakub Hrozek [Tue, 21 Oct 2014 15:23:30 +0000 (17:23 +0200)]
rwrap: Don't use htons for bitfields.
On FreeBSD, using htons to set the bitfield led to warnings such as:
resolv_wrapper.c:162:8: warning: implicit truncation from '__uint16_t'
(aka 'unsigned short') to bitfield changes value from 256 to 0
[-Wbitfield-constant-conversion]
h->qr = htons(1); /* response flag */
^ ~~~~~~~~
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Jakub Hrozek [Tue, 21 Oct 2014 13:34:28 +0000 (15:34 +0200)]
rwrap: Explicitly zero out sin_zero to silence gcc warnings.
On some platforms, failure to set the sin_zero structure lead to
warnings such as:
resolv_wrapper.c:969:5: warning: missing initializer for field ‘sin_zero’
of ‘struct sockaddr_in’ [-Wmissing-field-initializers]
};
^
In file included from /usr/include/arpa/inet.h:22:0,
from /.../source/src/resolv_wrapper.c:38:
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Jakub Hrozek [Tue, 21 Oct 2014 13:27:54 +0000 (15:27 +0200)]
tests: Call res_nclose() in test_res_query_search.c.
The res_query and res_nsearch unit tests didn't call res_nclose as
appropriate, leading to a resource leak.
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Jakub Hrozek [Tue, 21 Oct 2014 13:11:16 +0000 (15:11 +0200)]
rwrap: Close the resolv.conf file handle.
CID #68264
The file descriptor of resolv.conf wasn't closed properly.
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Jakub Hrozek [Tue, 21 Oct 2014 13:00:36 +0000 (15:00 +0200)]
rwrap: Free IPv6 name servers on close.
rwrap's res_ninit allocates IPv6 name servers, but res_nclose didn't
free them, leading to a resource leak detectable with valgrind.
Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Tue, 21 Oct 2014 12:43:48 +0000 (14:43 +0200)]
rwrap: Move NEXT_KEY out of the NDEBUG ifdef.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Andreas Schneider [Sun, 12 Oct 2014 18:04:11 +0000 (20:04 +0200)]
doc: Add section for dns faking to manpage.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Jakub Hrozek [Sat, 4 Oct 2014 16:10:42 +0000 (18:10 +0200)]
resolv: Implement CNAME faking
Signed-off-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Jakub Hrozek [Sat, 4 Oct 2014 15:55:50 +0000 (17:55 +0200)]
resolv: Implement SOA faking
Signed-off-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>