resolv_wrapper.git
4 years agorwrap: split out a rwrap_reset_nameservers() function
Stefan Metzmacher [Tue, 10 Mar 2020 12:07:25 +0000 (13:07 +0100)]
rwrap: split out a rwrap_reset_nameservers() function

This will make it easier to add support for ipv6 nameservers
on FreeBSD in the following commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agorwrap: let configure use define HAVE_RES_STATE_U_EXT_NSADDRS
Stefan Metzmacher [Wed, 18 Mar 2020 16:01:48 +0000 (17:01 +0100)]
rwrap: let configure use define HAVE_RES_STATE_U_EXT_NSADDRS

The configure check should describe what it checked for.
Let the code logic decide if that means we expect
HAVE_RESOLV_IPV6_NSADDRS to be defined.

We'll get another condition that sets HAVE_RESOLV_IPV6_NSADDRS
in the following commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agorwrap: fix resolv wrapper with ipv6 addresses and old glibc versions
Stefan Metzmacher [Thu, 14 Feb 2019 14:46:22 +0000 (15:46 +0100)]
rwrap: fix resolv wrapper with ipv6 addresses and old glibc versions

The handling of __res_state._u._ext was different before
this glibc commit (e.g. glibc-2.19):

  commit 2212c1420c92a33b0e0bd9a34938c9814a56c0f7
  Author:     Andreas Schwab <schwab@suse.de>
  AuthorDate: Thu Feb 19 15:52:08 2015 +0100
  Commit:     Andreas Schwab <schwab@suse.de>
  CommitDate: Thu May 21 15:16:37 2015 +0200

      Simplify handling of nameserver configuration in resolver

      Remove use of ext.nsmap member of struct __res_state and always use
      an identity mapping betwen the nsaddr_list array and the ext.nsaddrs
      array.  The fact that a nameserver has an IPv6 address is signalled by
      setting nsaddr_list[].sin_family to zero.

As a result of fixing this, it's now possible to run 'test_res_init'
even without using resolv_wrapper.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agotests/test_res_init.c: avoid using public ipv6 addresses from google in tests
Stefan Metzmacher [Fri, 15 Feb 2019 16:24:57 +0000 (17:24 +0100)]
tests/test_res_init.c: avoid using public ipv6 addresses from google in tests

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agorwrap: improve logging messages by including getprogname()
Stefan Metzmacher [Wed, 11 Mar 2020 16:12:22 +0000 (17:12 +0100)]
rwrap: improve logging messages by including getprogname()

This it basically the same as used in socket_wrapper.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agorwrap: fix warning where %s is always passed a NULL pointer in rwrap_create_fake_uri_rr()
Stefan Metzmacher [Thu, 19 Mar 2020 08:54:48 +0000 (09:54 +0100)]
rwrap: fix warning where %s is always passed a NULL pointer in rwrap_create_fake_uri_rr()

This happens in Samba's gitlab pipeline on Fedora 30/31:

 [3203/4410] Compiling third_party/resolv_wrapper/resolv_wrapper.c
==> /builds/samba-team/devel/samba/samba-o3.stderr <==
../../third_party/resolv_wrapper/resolv_wrapper.c: In function ‘rwrap_create_fake_uri_rr’:
../../third_party/resolv_wrapper/resolv_wrapper.c:104:33: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  104 | # define RWRAP_LOG(dbglvl, ...) rwrap_log((dbglvl), __func__, __VA_ARGS__)
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../third_party/resolv_wrapper/resolv_wrapper.c:340:3: note: in expansion of macro ‘RWRAP_LOG’
  340 |   RWRAP_LOG(RWRAP_LOG_ERROR,
      |   ^~~~~~~~~
../../third_party/resolv_wrapper/resolv_wrapper.c:341:28: note: format string is defined here
  341 |      "Malformed URI entry [%s]\n", value);
      |                            ^~
cc1: all warnings being treated as errors

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agoConfigureChecks.cmake: remove unused [__]res_send checks
Stefan Metzmacher [Wed, 18 Mar 2020 14:06:36 +0000 (15:06 +0100)]
ConfigureChecks.cmake: remove unused [__]res_send checks

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
4 years agocmake: Update cmake defaults for out of source build
Andreas Schneider [Fri, 31 Jan 2020 12:10:51 +0000 (13:10 +0100)]
cmake: Update cmake defaults for out of source build

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agodoc: Set author for manpage
Andreas Schneider [Fri, 31 Jan 2020 11:51:51 +0000 (12:51 +0100)]
doc: Set author for manpage

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Fix path of cmake config files and pkgconfig
Andreas Schneider [Fri, 15 Nov 2019 12:20:02 +0000 (13:20 +0100)]
cmake: Fix path of cmake config files and pkgconfig

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agotests: Fix coverity warning that sock could be negative
Andreas Schneider [Mon, 21 Oct 2019 06:59:57 +0000 (08:59 +0200)]
tests: Fix coverity warning that sock could be negative

CID 263708

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agogitlab-ci: Setup CI for resolv_wrapper
Andreas Schneider [Thu, 17 Oct 2019 14:59:28 +0000 (16:59 +0200)]
gitlab-ci: Setup CI for resolv_wrapper

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Use GNUInstallDirs
Andreas Schneider [Thu, 17 Oct 2019 14:06:36 +0000 (16:06 +0200)]
cmake: Use GNUInstallDirs

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Use target_include_directories()
Andreas Schneider [Thu, 17 Oct 2019 13:57:17 +0000 (15:57 +0200)]
cmake: Use target_include_directories()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Update AddCMockaTest.cmake
Andreas Schneider [Thu, 17 Oct 2019 13:53:01 +0000 (15:53 +0200)]
cmake: Update AddCMockaTest.cmake

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Require at least cmocka 1.1.0
Andreas Schneider [Thu, 17 Oct 2019 13:49:48 +0000 (15:49 +0200)]
cmake: Require at least cmocka 1.1.0

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Support running the tests with AddressSanitizer
Andreas Schneider [Thu, 17 Oct 2019 13:48:16 +0000 (15:48 +0200)]
cmake: Support running the tests with AddressSanitizer

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Add AddressSanitizer and UndefinedSanitizer
Andreas Schneider [Thu, 17 Oct 2019 13:37:28 +0000 (15:37 +0200)]
cmake: Add AddressSanitizer and UndefinedSanitizer

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Move Compiler flags to new file
Andreas Schneider [Thu, 17 Oct 2019 13:37:05 +0000 (15:37 +0200)]
cmake: Move Compiler flags to new file

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Improve checks for compiler flags
Andreas Schneider [Thu, 17 Oct 2019 13:34:21 +0000 (15:34 +0200)]
cmake: Improve checks for compiler flags

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Update defaults for cmake
Andreas Schneider [Thu, 17 Oct 2019 13:26:05 +0000 (15:26 +0200)]
cmake: Update defaults for cmake

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Use unset() instead of setting an empty string
Andreas Schneider [Thu, 17 Oct 2019 13:25:05 +0000 (15:25 +0200)]
cmake: Use unset() instead of setting an empty string

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Use _REQUIRED_LIBRARIES for system libs
Andreas Schneider [Thu, 17 Oct 2019 13:24:16 +0000 (15:24 +0200)]
cmake: Use _REQUIRED_LIBRARIES for system libs

This drops support for Solaris as we can't test it in CI anyway.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agocmake: Require at least cmake 3.5.0
Andreas Schneider [Thu, 17 Oct 2019 13:18:38 +0000 (15:18 +0200)]
cmake: Require at least cmake 3.5.0

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoREADME: Rename to a markdown file
Andreas Schneider [Thu, 17 Oct 2019 13:12:29 +0000 (15:12 +0200)]
README: Rename to a markdown file

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agotests: Wait longer for dns_srv to start
Andreas Schneider [Thu, 17 Oct 2019 15:44:51 +0000 (17:44 +0200)]
tests: Wait longer for dns_srv to start

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agotests: Set socket_wrapper to be required for testing
Andreas Schneider [Fri, 15 Feb 2019 13:41:11 +0000 (14:41 +0100)]
tests: Set socket_wrapper to be required for testing

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agoAdded fake resolving of TXT records
Carson Reinke [Sun, 30 Dec 2018 00:03:43 +0000 (19:03 -0500)]
Added fake resolving of TXT records

Signed-off-by: Carson Reinke <carson@reinke.co>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agorwrap: Fix alignment issues on FreeBSD
Andreas Schneider [Thu, 17 Oct 2019 15:49:47 +0000 (17:49 +0200)]
rwrap: Fix alignment issues on FreeBSD

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agodoc: Document RESOLV_WRAPPER_DISABLE_DEEPBIND
Andreas Schneider [Fri, 4 Jan 2019 07:40:44 +0000 (08:40 +0100)]
doc: Document RESOLV_WRAPPER_DISABLE_DEEPBIND

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
4 years agorwrap: Don't do a deep bind if we run with libasan
Andreas Schneider [Sat, 1 Sep 2018 17:47:35 +0000 (19:47 +0200)]
rwrap: Don't do a deep bind if we run with libasan

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agorwrap: Always build with rwrap_str_lib()
Andreas Schneider [Wed, 29 Aug 2018 14:42:16 +0000 (16:42 +0200)]
rwrap: Always build with rwrap_str_lib()

This fixes the Release build!

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agocmake: Fix function detection
Andreas Schneider [Wed, 29 Aug 2018 06:28:10 +0000 (08:28 +0200)]
cmake: Fix function detection

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agocmake: Do not misuse CMAKE_REQUIRED_LIBRARIES
Andreas Schneider [Tue, 28 Aug 2018 09:44:38 +0000 (11:44 +0200)]
cmake: Do not misuse CMAKE_REQUIRED_LIBRARIES

This will lead to issues detecting features.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agoctest: Move to new dashboard
Andreas Schneider [Thu, 5 Jul 2018 08:17:02 +0000 (10:17 +0200)]
ctest: Move to new dashboard

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agorwrap: Update header
Andreas Schneider [Fri, 22 Jun 2018 07:12:01 +0000 (09:12 +0200)]
rwrap: Update header

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agoUpdate LICENSE
Andreas Schneider [Fri, 22 Jun 2018 07:11:33 +0000 (09:11 +0200)]
Update LICENSE

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agoRename COPYING to LICENSE
Andreas Schneider [Fri, 22 Jun 2018 07:09:38 +0000 (09:09 +0200)]
Rename COPYING to LICENSE

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agocpack: Do not package build dirs in source tarball
Andreas Schneider [Fri, 22 Jun 2018 07:06:59 +0000 (09:06 +0200)]
cpack: Do not package build dirs in source tarball

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agocmake: Replace deprecated get_target_property()
Andreas Schneider [Fri, 22 Jun 2018 07:08:28 +0000 (09:08 +0200)]
cmake: Replace deprecated get_target_property()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agorwrap: Only report a notice when a search doesn't have a result
Andreas Schneider [Tue, 18 Jul 2017 08:23:20 +0000 (10:23 +0200)]
rwrap: Only report a notice when a search doesn't have a result

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agorwrap: Only warn if we can't open the dns hosts file
Andreas Schneider [Tue, 18 Jul 2017 08:22:38 +0000 (10:22 +0200)]
rwrap: Only warn if we can't open the dns hosts file

It is possible that it hasn't been created yet. At least in Samba when
we start the test environment.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agorwrap: Add NOTICE as log level
Andreas Schneider [Tue, 18 Jul 2017 08:16:21 +0000 (10:16 +0200)]
rwrap: Add NOTICE as log level

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agorwrap: Do an early return if log level doesn't match
Andreas Schneider [Tue, 18 Jul 2017 08:12:39 +0000 (10:12 +0200)]
rwrap: Do an early return if log level doesn't match

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
5 years agorwrap: Always enable logging
Andreas Schneider [Tue, 18 Jul 2017 08:11:22 +0000 (10:11 +0200)]
rwrap: Always enable logging

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agoBump version to 1.1.5 resolv_wrapper-1.1.5
Andreas Schneider [Thu, 8 Sep 2016 06:51:03 +0000 (08:51 +0200)]
Bump version to 1.1.5

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
7 years agoTest a URI query with multiple answers
Matt Rogers [Thu, 25 Aug 2016 16:59:31 +0000 (12:59 -0400)]
Test a URI query with multiple answers

Signed-off-by: Matt Rogers <mrogers@redhat.com
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
7 years agoSupport multiple URI answers
Matt Rogers [Thu, 25 Aug 2016 16:57:09 +0000 (12:57 -0400)]
Support multiple URI answers

Add URI record use of recursion to rwrap_get_record(), for collecting
multiple URI answers under a single query.  Increase the
RWRAP_MAX_RECURSION limit to handle more URI records.

Signed-off-by: Matt Rogers <mrogers@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
7 years agorwrap: Remove name compression from URI RR
Matt Rogers [Tue, 23 Aug 2016 04:56:14 +0000 (00:56 -0400)]
rwrap: Remove name compression from URI RR

Compression is wrong for URI records.

Signed-off-by: Matt Rogers <mrogers@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
7 years agoAdd support for the PTR DNS Resource Record type
Jakub Hrozek [Thu, 18 Aug 2016 15:49:00 +0000 (17:49 +0200)]
Add support for the PTR DNS Resource Record type

Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
7 years agorwrap: improve debug error messages
Michael Adam [Mon, 29 Aug 2016 06:16:25 +0000 (08:16 +0200)]
rwrap: improve debug error messages

Signed-off-by: Michael Adam <obnox@samba.org>
7 years agoAdd support for the URI DNS Resource Record type
Nathaniel McCallum [Tue, 16 Aug 2016 21:38:32 +0000 (17:38 -0400)]
Add support for the URI DNS Resource Record type

For more information, see RFC 7553.

Signed-off-by: Nathaniel McCallum <npmccallum@redhat.com>
Reviewed-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoBump version to 1.1.4 resolv_wrapper-1.1.4
Andreas Schneider [Tue, 31 May 2016 06:22:04 +0000 (08:22 +0200)]
Bump version to 1.1.4

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agotests: Add a test for the NS record handling.
Richard Sharpe [Fri, 20 May 2016 13:36:05 +0000 (06:36 -0700)]
tests: Add a test for the NS record handling.

Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jakub.hrozek@posteo.se>
7 years agorwrap: Add support to handle NS records
Richard Sharpe [Fri, 20 May 2016 13:31:32 +0000 (06:31 -0700)]
rwrap: Add support to handle NS records

Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jakub.hrozek@posteo.se>
8 years agocmake: Add missing HAVE_RESOLV_H define
Andreas Schneider [Wed, 2 Mar 2016 12:08:48 +0000 (13:08 +0100)]
cmake: Add missing HAVE_RESOLV_H define

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 years agorwrap: AIX compatibility fix, missing headers, bad directive
Guillaume Xavier Taillon [Tue, 1 Mar 2016 16:13:34 +0000 (11:13 -0500)]
rwrap: AIX compatibility fix, missing headers, bad directive

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11765

Signed-off-by: Guillaume Xavier Taillon <gtaillon@ca.ibm.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 years agoFix typos
Jakub Wilk [Mon, 12 Oct 2015 12:59:01 +0000 (14:59 +0200)]
Fix typos

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 years agoBump version to 1.1.3 resolv_wrapper-1.1.3
Andreas Schneider [Fri, 21 Aug 2015 10:17:45 +0000 (12:17 +0200)]
Bump version to 1.1.3

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agotests: Call res_close in res_query and res_search tests
Jakub Hrozek [Thu, 20 Aug 2015 09:49:35 +0000 (11:49 +0200)]
tests: Call res_close in res_query and res_search tests

This fixes two memory leaks in the tests.

Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agodoc: Use kinit instead of dig in the manpage example
Jakub Hrozek [Mon, 9 Feb 2015 16:26:10 +0000 (17:26 +0100)]
doc: Use kinit instead of dig in the manpage example

Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agotests: Add tests for res_query and res_search
Jakub Hrozek [Tue, 18 Aug 2015 09:22:14 +0000 (11:22 +0200)]
tests: Add tests for res_query and res_search

Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agoChange my e-mail address
Jakub Hrozek [Tue, 18 Aug 2015 09:21:59 +0000 (11:21 +0200)]
Change my e-mail address

Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agorwrap: Fix strict aliasing warnings for symbol binding
Andreas Schneider [Wed, 12 Aug 2015 13:59:53 +0000 (15:59 +0200)]
rwrap: Fix strict aliasing warnings for symbol binding

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agotests: Migrate to new cmocka API
Andreas Schneider [Wed, 12 Aug 2015 14:07:27 +0000 (16:07 +0200)]
tests: Migrate to new cmocka API

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agoFind the correct symbol when res_* is a define to __res_*
Andrew Bartlett [Wed, 12 Aug 2015 01:50:48 +0000 (13:50 +1200)]
Find the correct symbol when res_* is a define to __res_*

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agocmake: Drop test results via https.
Andreas Schneider [Wed, 25 Feb 2015 10:20:59 +0000 (11:20 +0100)]
cmake: Drop test results via https.

Signed-off-by: Andreas Schneider <asn@samba.org>
9 years agoBump version to 1.1.2. resolv_wrapper-1.1.2
Andreas Schneider [Tue, 13 Jan 2015 10:39:13 +0000 (11:39 +0100)]
Bump version to 1.1.2.

9 years agocmake: Fix ns_name_compress detection.
Andreas Schneider [Tue, 13 Jan 2015 10:37:31 +0000 (11:37 +0100)]
cmake: Fix ns_name_compress detection.

On some platforms it is a macro and not a function. So we need to check
if the macro exists.

Signed-off-by: Andreas Schneider <asn@samba.org>
9 years agoBump version to 1.1.1. resolv_wrapper-1.1.1
Andreas Schneider [Mon, 12 Jan 2015 11:48:38 +0000 (12:48 +0100)]
Bump version to 1.1.1.

Reviewed-by: Guenther Deschner <gd@samba.org>
9 years agorwrap: Fix a possible NULL dereference.
Andreas Schneider [Mon, 12 Jan 2015 11:45:38 +0000 (12:45 +0100)]
rwrap: Fix a possible NULL dereference.

CID: #84271

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
9 years agorwrap: If we do not have ns_name_compress() use dn_comp().
Andreas Schneider [Thu, 8 Jan 2015 15:32:19 +0000 (16:32 +0100)]
rwrap: If we do not have ns_name_compress() use dn_comp().

This should fix older Linux versions which do not export
ns_name_compress(). In newer glibc versions dn_comp() calls
ns_name_compress().

Reviewed-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoBump version to 1.1.0. resolv_wrapper-1.1.0
Andreas Schneider [Tue, 2 Dec 2014 14:43:58 +0000 (15:43 +0100)]
Bump version to 1.1.0.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agotests: Add an invalid record to the fake_hosts file for tests
Jakub Hrozek [Tue, 2 Dec 2014 09:37:01 +0000 (10:37 +0100)]
tests: Add an invalid record to the fake_hosts file for tests

To make sure rwrap is able to skip invalid records as appropriate.

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agorwrap: Don't dereference NULL when skipping broken records
Jakub Hrozek [Tue, 2 Dec 2014 09:35:49 +0000 (10:35 +0100)]
rwrap: Don't dereference NULL when skipping broken records

CID: 83426
CID: 83425

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agotests: Define MIN if not available.
Andreas Schneider [Fri, 28 Nov 2014 07:49:12 +0000 (08:49 +0100)]
tests: Define MIN if not available.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agotests: Query A record via CNAME
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>
9 years agorwrap: Support asking for A via CNAME
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>
9 years agotests: test that CNAME and SRV records can recurse
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>
9 years agorwrap: Recursively add additional data
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>
9 years agorwrap: Make the rwrap_fake_* functions only fake RRs
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>
9 years agorwrap: CNAME record can recurse into A, AAAA or CNAME
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>
9 years agorwrap: SRV record can recurse into A or AAAA
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>
9 years agorwrap: Use the rwrap_fake_rr structure instead of raw uint8_t pointers
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>
9 years agoAdd data structures and functions to represent and manipulate RRs
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>
9 years agotests: Add a test which talks to real nameservers.
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>
9 years agorwrap: Correctly calculate the response size and return it.
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>
9 years agorwrap: Handle trailing dot in dns names.
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>
9 years agorwrap: Compare dns names case insensitive.
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>
9 years agotorture: Increase time to wait for pid file.
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>
9 years agocmake: Do not remove libresolv from required libraries.
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>
9 years agoAdd ChangeLog file. resolv_wrapper-1.0.0
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>
9 years agoAdd Jakub to AUTHORS file.
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>
9 years agorwrap: Fix the cleanup of the ns ext resources.
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>
9 years agocmake: Fix tests on Solaris.
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>
9 years agotorture: Fix socket directory name.
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>
9 years agotests: Fix test_res_ninit() with IPv4 only support.
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>
9 years agorwrap: Fix symbol binding on Solaris.
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>
9 years agotests: Use the right array size in tests.
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>
9 years agorwrap: Don't use htons for bitfields.
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>