Hello community,

here is the log from the commit of package resolv_wrapper for openSUSE:Factory 
checked in at 2016-06-09 16:12:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/resolv_wrapper (Old)
 and      /work/SRC/openSUSE:Factory/.resolv_wrapper.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "resolv_wrapper"

Changes:
--------
--- /work/SRC/openSUSE:Factory/resolv_wrapper/resolv_wrapper.changes    
2016-02-17 12:23:57.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.resolv_wrapper.new/resolv_wrapper.changes       
2016-06-09 16:16:29.000000000 +0200
@@ -1,0 +2,7 @@
+Tue May 31 07:00:11 UTC 2016 - [email protected]
+
+- Update to version 1.1.4
+  * Added support for faking NS entries
+  * Fixed some platform compatibility bugs
+
+-------------------------------------------------------------------

Old:
----
  resolv_wrapper-1.1.3.tar.gz

New:
----
  resolv_wrapper-1.1.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ resolv_wrapper.spec ++++++
--- /var/tmp/diff_new_pack.kxF1pv/_old  2016-06-09 16:16:31.000000000 +0200
+++ /var/tmp/diff_new_pack.kxF1pv/_new  2016-06-09 16:16:31.000000000 +0200
@@ -24,7 +24,7 @@
 ############################# NOTE ##################################
 
 Name:           resolv_wrapper
-Version:        1.1.3
+Version:        1.1.4
 Release:        0
 
 Summary:        A wrapper for DNS name resolving or DNS faking

++++++ resolv_wrapper-1.1.3.tar.gz -> resolv_wrapper-1.1.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/resolv_wrapper-1.1.3/CMakeLists.txt 
new/resolv_wrapper-1.1.4/CMakeLists.txt
--- old/resolv_wrapper-1.1.3/CMakeLists.txt     2015-08-24 15:17:00.000000000 
+0200
+++ new/resolv_wrapper-1.1.4/CMakeLists.txt     2016-05-31 08:21:08.000000000 
+0200
@@ -8,7 +8,7 @@
 
 set(APPLICATION_VERSION_MAJOR "1")
 set(APPLICATION_VERSION_MINOR "1")
-set(APPLICATION_VERSION_PATCH "3")
+set(APPLICATION_VERSION_PATCH "4")
 
 set(APPLICATION_VERSION 
"${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
 
@@ -19,7 +19,7 @@
 #     Increment AGE. Set REVISION to 0
 #   If the source code was changed, but there were no interface changes:
 #     Increment REVISION.
-set(LIBRARY_VERSION "0.0.3")
+set(LIBRARY_VERSION "0.0.4")
 set(LIBRARY_SOVERSION "0")
 
 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is 
checked
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/resolv_wrapper-1.1.3/ChangeLog 
new/resolv_wrapper-1.1.4/ChangeLog
--- old/resolv_wrapper-1.1.3/ChangeLog  2015-08-24 15:17:00.000000000 +0200
+++ new/resolv_wrapper-1.1.4/ChangeLog  2016-05-31 08:22:02.000000000 +0200
@@ -1,6 +1,10 @@
 ChangeLog
 ==========
 
+version 1.1.4 (released 2016-05-31)
+  * Added support for faking NS entries
+  * Fixed some platform compatibility bugs
+
 version 1.1.3 (released 2015-01-13)
   * Fixed symbol detection if macros are used for res_* functions
   * Fixed strict aliasing warnings for symbol binding
@@ -14,7 +18,7 @@
   * Fix a possible segfault.
 
 version 1.1.0 (released 2014-12-02)
-  * Added case insensitive comparsion of dns names (dns faking).
+  * Added case insensitive comparison of dns names (dns faking).
   * Added support complete dns names (trailing dot) (dns faking).
   * Added support for recursive name resolving (dns faking).
   * Fixed calculation of response size (dns faking).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/resolv_wrapper-1.1.3/ConfigureChecks.cmake 
new/resolv_wrapper-1.1.4/ConfigureChecks.cmake
--- old/resolv_wrapper-1.1.3/ConfigureChecks.cmake      2015-01-13 
15:11:34.000000000 +0100
+++ new/resolv_wrapper-1.1.4/ConfigureChecks.cmake      2016-03-02 
13:07:30.000000000 +0100
@@ -49,6 +49,7 @@
 # HEADERS
 check_include_file(sys/types.h HAVE_SYS_TYPES_H)
 check_include_file(resolv.h HAVE_RESOLV_H)
+check_include_file(arpa/nameser.h HAVE_ARPA_NAMESER_H)
 
 # FUNCTIONS
 set(CMAKE_REQUIRED_LIBRARIES)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/resolv_wrapper-1.1.3/config.h.cmake 
new/resolv_wrapper-1.1.4/config.h.cmake
--- old/resolv_wrapper-1.1.3/config.h.cmake     2015-01-12 17:31:20.000000000 
+0100
+++ new/resolv_wrapper-1.1.4/config.h.cmake     2016-03-02 13:08:39.000000000 
+0100
@@ -15,6 +15,8 @@
 /************************** HEADER FILES *************************/
 
 #cmakedefine HAVE_SYS_TYPES_H 1
+#cmakedefine HAVE_RESOLV_H 1
+#cmakedefine HAVE_ARPA_NAMESER_H 1
 
 /*************************** FUNCTIONS ***************************/
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/resolv_wrapper-1.1.3/doc/resolv_wrapper.1 
new/resolv_wrapper-1.1.4/doc/resolv_wrapper.1
--- old/resolv_wrapper-1.1.3/doc/resolv_wrapper.1       2015-08-18 
12:28:45.000000000 +0200
+++ new/resolv_wrapper-1.1.4/doc/resolv_wrapper.1       2015-10-12 
16:31:34.000000000 +0200
@@ -34,7 +34,7 @@
 LD_PRELOAD=libresolv_wrapper\&.so RESOLV_WRAPPER_CONF="/path/to/resolv\&.conf" 
\fB\&./myapplication\fR
 .SH "DESCRIPTION"
 .sp
-resolv_wrapper makes it possible on most UNIX platforms to contact your own 
DNS implmentation in your test environment\&. It requires socket_wrapper to be 
able to contact it\&. If it doesn\(cqt work on a special platform the wrapper 
is able to fake DNS queries and return valid responses to your application\&.
+resolv_wrapper makes it possible on most UNIX platforms to contact your own 
DNS implementation in your test environment\&. It requires socket_wrapper to be 
able to contact it\&. If it doesn\(cqt work on a special platform the wrapper 
is able to fake DNS queries and return valid responses to your application\&.
 .sp
 .RS 4
 .ie n \{\
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/resolv_wrapper-1.1.3/doc/resolv_wrapper.1.txt 
new/resolv_wrapper-1.1.4/doc/resolv_wrapper.1.txt
--- old/resolv_wrapper-1.1.3/doc/resolv_wrapper.1.txt   2015-08-18 
12:28:45.000000000 +0200
+++ new/resolv_wrapper-1.1.4/doc/resolv_wrapper.1.txt   2015-10-12 
16:31:34.000000000 +0200
@@ -16,7 +16,7 @@
 -----------
 
 resolv_wrapper makes it possible on most UNIX platforms to contact your own DNS
-implmentation in your test environment. It requires socket_wrapper to be able
+implementation in your test environment. It requires socket_wrapper to be able
 to contact it.
 If it doesn't work on a special platform the wrapper is able to fake DNS 
queries
 and return valid responses to your application.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/resolv_wrapper-1.1.3/look 
new/resolv_wrapper-1.1.4/look
--- old/resolv_wrapper-1.1.3/look       1970-01-01 01:00:00.000000000 +0100
+++ new/resolv_wrapper-1.1.4/look       2015-10-12 16:31:30.000000000 +0200
@@ -0,0 +1,77 @@
+From cb5f73d269f22ecad026caaff7a27e38abc4d15b Mon Sep 17 00:00:00 2001
+From: Jakub Wilk <[email protected]>
+Date: Mon, 12 Oct 2015 14:59:01 +0200
+Subject: [PATCH] Fix typos
+
+Signed-off-by: Jakub Wilk <[email protected]>
+---
+ ChangeLog                | 2 +-
+ doc/resolv_wrapper.1     | 2 +-
+ doc/resolv_wrapper.1.txt | 2 +-
+ src/resolv_wrapper.c     | 4 ++--
+ 4 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 08cbfa6..0c4e25b 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -14,7 +14,7 @@ version 1.1.1 (released 2015-01-12)
+   * Fix a possible segfault.
+ 
+ version 1.1.0 (released 2014-12-02)
+-  * Added case insensitive comparsion of dns names (dns faking).
++  * Added case insensitive comparison of dns names (dns faking).
+   * Added support complete dns names (trailing dot) (dns faking).
+   * Added support for recursive name resolving (dns faking).
+   * Fixed calculation of response size (dns faking).
+diff --git a/doc/resolv_wrapper.1 b/doc/resolv_wrapper.1
+index 2691964..5219713 100644
+--- a/doc/resolv_wrapper.1
++++ b/doc/resolv_wrapper.1
+@@ -34,7 +34,7 @@ resolv_wrapper \- A wrapper for dns name resolving or dns 
faking\&.
+ LD_PRELOAD=libresolv_wrapper\&.so 
RESOLV_WRAPPER_CONF="/path/to/resolv\&.conf" \fB\&./myapplication\fR
+ .SH "DESCRIPTION"
+ .sp
+-resolv_wrapper makes it possible on most UNIX platforms to contact your own 
DNS implmentation in your test environment\&. It requires socket_wrapper to be 
able to contact it\&. If it doesn\(cqt work on a special platform the wrapper 
is able to fake DNS queries and return valid responses to your application\&.
++resolv_wrapper makes it possible on most UNIX platforms to contact your own 
DNS implementation in your test environment\&. It requires socket_wrapper to be 
able to contact it\&. If it doesn\(cqt work on a special platform the wrapper 
is able to fake DNS queries and return valid responses to your application\&.
+ .sp
+ .RS 4
+ .ie n \{\
+diff --git a/doc/resolv_wrapper.1.txt b/doc/resolv_wrapper.1.txt
+index e2e6837..12f96d0 100644
+--- a/doc/resolv_wrapper.1.txt
++++ b/doc/resolv_wrapper.1.txt
+@@ -16,7 +16,7 @@ DESCRIPTION
+ -----------
+ 
+ resolv_wrapper makes it possible on most UNIX platforms to contact your own 
DNS
+-implmentation in your test environment. It requires socket_wrapper to be able
++implementation in your test environment. It requires socket_wrapper to be able
+ to contact it.
+ If it doesn't work on a special platform the wrapper is able to fake DNS 
queries
+ and return valid responses to your application.
+diff --git a/src/resolv_wrapper.c b/src/resolv_wrapper.c
+index d6a17cf..77baa45 100644
+--- a/src/resolv_wrapper.c
++++ b/src/resolv_wrapper.c
+@@ -340,7 +340,7 @@ static ssize_t rwrap_fake_header(uint8_t **header_blob, 
size_t remaining,
+       h->id = res_randomid();         /* random query ID */
+       h->qr = 1;                      /* response flag */
+       h->rd = 1;                      /* recursion desired */
+-      h->ra = 1;                      /* resursion available */
++      h->ra = 1;                      /* recursion available */
+ 
+       h->qdcount = htons(1);          /* no. of questions */
+       h->ancount = htons(ancount);    /* no. of answers */
+@@ -911,7 +911,7 @@ static ssize_t rwrap_fake_answer(struct rwrap_fake_rr *rrs,
+ /* Reads in a file in the following format:
+  * TYPE RDATA
+  *
+- * Malformed entried are silently skipped.
++ * Malformed entries are silently skipped.
+  * Allocates answer buffer of size anslen that has to be freed after use.
+  */
+ static int rwrap_res_fake_hosts(const char *hostfile,
+-- 
+2.6.1
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/resolv_wrapper-1.1.3/src/resolv_wrapper.c 
new/resolv_wrapper-1.1.4/src/resolv_wrapper.c
--- old/resolv_wrapper-1.1.3/src/resolv_wrapper.c       2015-08-18 
12:28:45.000000000 +0200
+++ new/resolv_wrapper-1.1.4/src/resolv_wrapper.c       2016-05-24 
16:35:42.000000000 +0200
@@ -36,7 +36,11 @@
 
 #include <errno.h>
 #include <arpa/inet.h>
+#ifdef HAVE_ARPA_NAMESER_H
+#include <arpa/nameser.h>
+#endif /* HAVE_ARPA_NAMESER_H */
 #include <netinet/in.h>
+#include <sys/socket.h>
 #include <sys/types.h>
 #include <stdarg.h>
 #include <stdlib.h>
@@ -227,6 +231,15 @@
        rr->type = ns_t_aaaa;
        return 0;
 }
+static int rwrap_create_fake_ns_rr(const char *key,
+                                  const char *value,
+                                  struct rwrap_fake_rr *rr)
+{
+       memcpy(rr->rrdata.srv_rec.hostname, value, strlen(value) + 1);
+       memcpy(rr->key, key, strlen(key) + 1);
+       rr->type = ns_t_ns;
+       return 0;
+}
 
 static int rwrap_create_fake_srv_rr(const char *key,
                                    const char *value,
@@ -340,7 +353,7 @@
        h->id = res_randomid();         /* random query ID */
        h->qr = 1;                      /* response flag */
        h->rd = 1;                      /* recursion desired */
-       h->ra = 1;                      /* resursion available */
+       h->ra = 1;                      /* recursion available */
 
        h->qdcount = htons(1);          /* no. of questions */
        h->ancount = htons(ancount);    /* no. of answers */
@@ -469,6 +482,47 @@
        return resp_size;
 }
 
+static ssize_t rwrap_fake_ns(struct rwrap_fake_rr *rr,
+                            uint8_t *answer,
+                           size_t anslen)
+{
+       uint8_t *a = answer;
+       ssize_t resp_size = 0;
+       size_t rdata_size;
+       unsigned char hostname_compressed[MAXDNAME];
+       ssize_t compressed_len;
+
+       if (rr == NULL || rr->type != ns_t_ns) {
+               RWRAP_LOG(RWRAP_LOG_ERROR,
+                         "Malformed record, no or wrong value!\n");
+               return -1;
+       }
+       RWRAP_LOG(RWRAP_LOG_TRACE, "Adding NS RR");
+
+       /* Prepare the data to write */
+       compressed_len = ns_name_compress(rr->rrdata.srv_rec.hostname,
+                                         hostname_compressed,
+                                         MAXDNAME,
+                                         NULL,
+                                         NULL);
+       if (compressed_len < 0) {
+               return -1;
+       }
+
+       /* Is this enough? */
+       rdata_size = compressed_len;
+
+       resp_size = rwrap_fake_rdata_common(ns_t_ns, rdata_size,
+                                           rr->key, anslen, &a);
+       if (resp_size < 0) {
+               return -1;
+       }
+
+       memcpy(a, hostname_compressed, compressed_len);
+
+       return resp_size;
+}
+
 static ssize_t rwrap_fake_srv(struct rwrap_fake_rr *rr,
                              uint8_t *answer,
                              size_t anslen)
@@ -662,7 +716,8 @@
        }
 
        RWRAP_LOG(RWRAP_LOG_TRACE,
-                 "Searching in fake hosts file %s\n", hostfile);
+                 "Searching in fake hosts file %s for %s:%d\n", hostfile,
+                 query, type);
 
        fp = fopen(hostfile, "r");
        if (fp == NULL) {
@@ -702,6 +757,10 @@
                                      rec_type, "AAAA", key, query)) {
                        rc = rwrap_create_fake_aaaa_rr(key, value, rr);
                        break;
+               } else if (TYPE_MATCH(type, ns_t_ns,
+                                     rec_type, "NS", key, query)) {
+                       rc = rwrap_create_fake_ns_rr(key, value, rr);
+                       break;
                } else if (TYPE_MATCH(type, ns_t_srv,
                                      rec_type, "SRV", key, query)) {
                        rc = rwrap_create_fake_srv_rr(key, value, rr);
@@ -776,6 +835,7 @@
        switch (type) {
        case ns_t_a:
        case ns_t_aaaa:
+       case ns_t_ns:
        case ns_t_srv:
        case ns_t_soa:
        case ns_t_cname:
@@ -835,6 +895,9 @@
        case ns_t_aaaa:
                resp_data = rwrap_fake_aaaa(rr, answer, anslen);
                break;
+       case ns_t_ns:
+               resp_data = rwrap_fake_ns(rr, answer, anslen);
+               break;
        case ns_t_srv:
                resp_data = rwrap_fake_srv(rr, answer, anslen);
                break;
@@ -911,7 +974,7 @@
 /* Reads in a file in the following format:
  * TYPE RDATA
  *
- * Malformed entried are silently skipped.
+ * Malformed entries are silently skipped.
  * Allocates answer buffer of size anslen that has to be freed after use.
  */
 static int rwrap_res_fake_hosts(const char *hostfile,
@@ -1421,8 +1484,8 @@
                        state->nscount = 0;
                        memset(state->nsaddr_list, 0, 
sizeof(state->nsaddr_list));
 
-                       state->_u._ext.nscount = 0;
 #ifdef HAVE_RESOLV_IPV6_NSADDRS
+                       state->_u._ext.nscount = 0;
                        for (i = 0; i < state->_u._ext.nscount; i++) {
                                SAFE_FREE(state->_u._ext.nsaddrs[i]);
                        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/resolv_wrapper-1.1.3/tests/fake_hosts.in 
new/resolv_wrapper-1.1.4/tests/fake_hosts.in
--- old/resolv_wrapper-1.1.3/tests/fake_hosts.in        2014-12-03 
10:54:58.000000000 +0100
+++ new/resolv_wrapper-1.1.4/tests/fake_hosts.in        2016-05-24 
16:35:51.000000000 +0200
@@ -1,3 +1,5 @@
+NS cwrap.org ns1.cwrap.org
+NS cwrap.org ns2.cwrap.org
 A brokenrecord.com
 A cwrap.org 127.0.0.21
 AAAA cwrap6.org 2a00:1450:4013:c01::63
@@ -8,3 +10,5 @@
 CNAME web.cwrap.org www.cwrap.org
 A www.cwrap.org 127.0.0.22
 A krb5.cwrap.org 127.0.0.23
+A ns1.cwrap.org 127.0.0.24
+A ns2.cwrap.org 127.0.0.25
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/resolv_wrapper-1.1.3/tests/test_real_res_query.c 
new/resolv_wrapper-1.1.4/tests/test_real_res_query.c
--- old/resolv_wrapper-1.1.3/tests/test_real_res_query.c        2015-08-18 
12:28:45.000000000 +0200
+++ new/resolv_wrapper-1.1.4/tests/test_real_res_query.c        2016-05-24 
16:35:51.000000000 +0200
@@ -130,6 +130,42 @@
        assert_string_equal(addr, "78.46.80.163");
 }
 
+static void test_res_query_ns_record(void **state)
+{
+       int rv;
+       struct __res_state dnsstate;
+       unsigned char answer[ANSIZE] = { 0 };
+       char addr[INET_ADDRSTRLEN];
+       ns_msg handle;
+       ns_rr rr;   /* expanded resource record */
+
+       (void) state; /* unused */
+
+       memset(&dnsstate, 0, sizeof(struct __res_state));
+       rv = res_ninit(&dnsstate);
+       assert_int_equal(rv, 0);
+
+       rv = res_nquery(&dnsstate, "cwrap.org", ns_c_in, ns_t_ns,
+                       answer, sizeof(answer));
+       assert_in_range(rv, 1, 150);
+
+       printf("dump answer:\n");
+       dump_data(answer, rv);
+
+       ns_initparse(answer, sizeof(answer), &handle);
+       /* The query must finish w/o an error, have two answers and the answer
+        * must be a parseable RR of type A and have the address that our
+        * fake hosts file contains
+        */
+       assert_int_equal(ns_msg_getflag(handle, ns_f_rcode), ns_r_noerror);
+       assert_int_equal(ns_msg_count(handle, ns_s_an), 2);
+       assert_int_equal(ns_parserr(&handle, ns_s_an, 0, &rr), 0);
+       assert_int_equal(ns_rr_type(rr), ns_t_ns);
+       assert_non_null(inet_ntop(AF_INET, ns_rr_rdata(rr),
+                       addr, sizeof(addr)));
+       /*assert_string_equal(addr, "3.110.115.50");*/
+}
+
 static void test_res_query_srv_record(void **state)
 {
        int rv;
@@ -191,6 +227,7 @@
 
        const struct CMUnitTest real_tests[] = {
                cmocka_unit_test(test_res_query_a_record),
+               cmocka_unit_test(test_res_query_ns_record),
                cmocka_unit_test(test_res_query_srv_record),
        };
 


Reply via email to