[SCM] Resolv Wrapper Repository - branch master updated

Andreas Schneider asn at samba.org
Tue Aug 18 10:28:52 UTC 2015


The branch, master has been updated
       via  671691a doc: Use kinit instead of dig in the manpage example
       via  113c211 tests: Add tests for res_query and res_search
       via  c78b81b Change my e-mail address
      from  538f2b9 rwrap: Fix strict aliasing warnings for symbol binding

https://git.samba.org/?p=resolv_wrapper.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 671691a7b08ec60baa2dd5d339bdcb46635d61e4
Author: Jakub Hrozek <jhrozek at redhat.com>
Date:   Mon Feb 9 17:26:10 2015 +0100

    doc: Use kinit instead of dig in the manpage example
    
    Signed-off-by: Jakub Hrozek <jakub.hrozek at posteo.se>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 113c211dc903f90bf6ef5c12cf9c746d8265f70c
Author: Jakub Hrozek <jhrozek at redhat.com>
Date:   Tue Aug 18 11:22:14 2015 +0200

    tests: Add tests for res_query and res_search
    
    Signed-off-by: Jakub Hrozek <jakub.hrozek at posteo.se>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit c78b81b4c41b7e22a2801e9d96af07b63ed0d1ce
Author: Jakub Hrozek <jhrozek at redhat.com>
Date:   Tue Aug 18 11:21:59 2015 +0200

    Change my e-mail address
    
    Signed-off-by: Jakub Hrozek <jakub.hrozek at posteo.se>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 doc/resolv_wrapper.1          |  8 +++--
 doc/resolv_wrapper.1.txt      |  6 +++-
 src/resolv_wrapper.c          |  4 +--
 tests/dns_srv.c               |  2 +-
 tests/test_dns_fake.c         |  2 +-
 tests/test_real_res_query.c   |  2 +-
 tests/test_res_query_search.c | 69 +++++++++++++++++++++++++++++++++++++++++--
 7 files changed, 81 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/doc/resolv_wrapper.1 b/doc/resolv_wrapper.1
index 5482b3d..2691964 100644
--- a/doc/resolv_wrapper.1
+++ b/doc/resolv_wrapper.1
@@ -2,12 +2,12 @@
 .\"     Title: resolv_wrapper
 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
 .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 10/12/2014
+.\"      Date: 2015-08-18
 .\"    Manual: \ \&
 .\"    Source: \ \&
 .\"  Language: English
 .\"
-.TH "RESOLV_WRAPPER" "1" "10/12/2014" "\ \&" "\ \&"
+.TH "RESOLV_WRAPPER" "1" "2015\-08\-18" "\ \&" "\ \&"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -147,11 +147,13 @@ If you need to see what is going on in resolv_wrapper itself or try to find a bu
 .RE
 .SH "EXAMPLE"
 .sp
+The following command would trick \fIkinit(1)\fR into using DNS servers from "\&./resolv\&.conf" for Kerberos service resolution:
+.sp
 .if n \{\
 .RS 4
 .\}
 .nf
-$ LD_PRELOAD=libresolv_wrapper\&.so RESOLV_WRAPPER_CONF="\&./resolv\&.conf" dig test\&.example\&.site
+$ LD_PRELOAD=libresolv_wrapper\&.so RESOLV_WRAPPER_CONF="\&./resolv\&.conf" kinit user at EXAMPLE\&.COM
 .fi
 .if n \{\
 .RE
diff --git a/doc/resolv_wrapper.1.txt b/doc/resolv_wrapper.1.txt
index a9e4ec5..e2e6837 100644
--- a/doc/resolv_wrapper.1.txt
+++ b/doc/resolv_wrapper.1.txt
@@ -1,5 +1,6 @@
 resolv_wrapper(1)
 =================
+:revdate: 2015-08-18
 
 NAME
 ----
@@ -61,4 +62,7 @@ debug symbols.
 EXAMPLE
 -------
 
-  $ LD_PRELOAD=libresolv_wrapper.so RESOLV_WRAPPER_CONF="./resolv.conf" dig test.example.site
+The following command would trick 'kinit(1)' into using DNS servers from "./resolv.conf"
+for Kerberos service resolution:
+
+  $ LD_PRELOAD=libresolv_wrapper.so RESOLV_WRAPPER_CONF="./resolv.conf" kinit user at EXAMPLE.COM
diff --git a/src/resolv_wrapper.c b/src/resolv_wrapper.c
index d36d080..d6a17cf 100644
--- a/src/resolv_wrapper.c
+++ b/src/resolv_wrapper.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2014      Andreas Schneider <asn at samba.org>
- * Copyright (c) 2014      Jakub Hrozek <jakub.hrozek at gmail.com>
+ * Copyright (c) 2014      Jakub Hrozek <jakub.hrozek at posteo.se>
  *
  * All rights reserved.
  *
@@ -1690,7 +1690,7 @@ int __res_nsearch(struct __res_state *state,
 }
 
 /****************************************************************************
- *   RES_QUERY
+ *   RES_SEARCH
  ***************************************************************************/
 
 static int rwrap_res_search(const char *dname,
diff --git a/tests/dns_srv.c b/tests/dns_srv.c
index b2e6aa3..94e5c3d 100644
--- a/tests/dns_srv.c
+++ b/tests/dns_srv.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) Jakub Hrozek 2014 <jakub.hrozek at gmail.com>
+ * Copyright (C) Jakub Hrozek 2014 <jakub.hrozek at posteo.se>
  *
  * All rights reserved.
  *
diff --git a/tests/test_dns_fake.c b/tests/test_dns_fake.c
index 9bc92cd..8d1dd0c 100644
--- a/tests/test_dns_fake.c
+++ b/tests/test_dns_fake.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) Jakub Hrozek 2014 <jakub.hrozek at gmail.com>
+ * Copyright (C) Jakub Hrozek 2014 <jakub.hrozek at posteo.se>
  *
  * All rights reserved.
  *
diff --git a/tests/test_real_res_query.c b/tests/test_real_res_query.c
index 04ade89..f563a3d 100644
--- a/tests/test_real_res_query.c
+++ b/tests/test_real_res_query.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) Jakub Hrozek 2014 <jakub.hrozek at gmail.com>
+ * Copyright (C) Jakub Hrozek 2014 <jakub.hrozek at posteo.se>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/tests/test_res_query_search.c b/tests/test_res_query_search.c
index 395cb0c..616772c 100644
--- a/tests/test_res_query_search.c
+++ b/tests/test_res_query_search.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) Jakub Hrozek 2014 <jakub.hrozek at gmail.com>
+ * Copyright (C) Jakub Hrozek 2014 <jakub.hrozek at posteo.se>
  *
  * All rights reserved.
  *
@@ -66,7 +66,7 @@ static int teardown(void **state)
 	return 0;
 }
 
-static void test_res_query(void **state)
+static void test_res_nquery(void **state)
 {
 	int rv;
 	struct __res_state dnsstate;
@@ -102,7 +102,36 @@ static void test_res_query(void **state)
 	res_nclose(&dnsstate);
 }
 
-static void test_res_search(void **state)
+static void test_res_query(void **state)
+{
+	int rv;
+	unsigned char answer[ANSIZE];
+	char addr[INET_ADDRSTRLEN];
+	ns_msg handle;
+	ns_rr rr;   /* expanded resource record */
+
+	(void) state; /* unused */
+
+	rv = res_query("www.cwrap.org", ns_c_in, ns_t_a,
+			answer, sizeof(answer));
+	assert_int_not_equal(rv, -1);
+
+	ns_initparse(answer, sizeof(answer), &handle);
+	/*
+	 * The query must finish w/o an error, have one answer and the answer
+	 * must be a parseable RR of type A and have the address that our
+	 * test server sends.
+	 */
+	assert_int_equal(ns_msg_getflag(handle, ns_f_rcode), ns_r_noerror);
+	assert_int_equal(ns_msg_count(handle, ns_s_an), 1);
+	assert_int_equal(ns_parserr(&handle, ns_s_an, 0, &rr), 0);
+	assert_int_equal(ns_rr_type(rr), ns_t_a);
+	assert_non_null(inet_ntop(AF_INET, ns_rr_rdata(rr),
+			addr, sizeof(addr)));
+	assert_string_equal(addr, "127.0.10.10");
+}
+
+static void test_res_nsearch(void **state)
 {
 	int rv;
 	struct __res_state dnsstate;
@@ -137,14 +166,48 @@ static void test_res_search(void **state)
 	res_nclose(&dnsstate);
 }
 
+static void test_res_search(void **state)
+{
+	int rv;
+	unsigned char answer[ANSIZE];
+	char addr[INET_ADDRSTRLEN];
+	ns_msg handle;
+	ns_rr rr;   /* expanded resource record */
+
+	(void) state; /* unused */
+
+	rv = res_search("www.cwrap.org", ns_c_in, ns_t_a,
+			answer, sizeof(answer));
+	assert_int_not_equal(rv, -1);
+
+	ns_initparse(answer, sizeof(answer), &handle);
+	/* The query must finish w/o an error, have one answer and the answer
+	 * must be a parseable RR of type A and have the address that our
+	 * test server sends
+	 */
+	assert_int_equal(ns_msg_getflag(handle, ns_f_rcode), ns_r_noerror);
+	assert_int_equal(ns_msg_count(handle, ns_s_an), 1);
+	assert_int_equal(ns_parserr(&handle, ns_s_an, 0, &rr), 0);
+	assert_int_equal(ns_rr_type(rr), ns_t_a);
+	assert_non_null(inet_ntop(AF_INET, ns_rr_rdata(rr),
+			addr, sizeof(addr)));
+	assert_string_equal(addr, "127.0.10.10");
+}
+
 int main(void)
 {
 	int rc;
 
 	const struct CMUnitTest res_tests[] = {
+		cmocka_unit_test_setup_teardown(test_res_nquery,
+						setup_dns_srv_ipv4,
+						teardown),
 		cmocka_unit_test_setup_teardown(test_res_query,
 						setup_dns_srv_ipv4,
 						teardown),
+		cmocka_unit_test_setup_teardown(test_res_nsearch,
+						setup_dns_srv_ipv4,
+						teardown),
 		cmocka_unit_test_setup_teardown(test_res_search,
 						setup_dns_srv_ipv4,
 						teardown),


-- 
Resolv Wrapper Repository



More information about the samba-cvs mailing list