[SCM] NSS Wrapper Repository - branch master updated

Andreas Schneider asn at samba.org
Fri Mar 14 04:01:19 MDT 2014


The branch, master has been updated
       via  93db9fd README: Fix prefix env variable name.
       via  f24dbf6 tests: Add test_gethostent.c
      from  b928fe9 tests: Add test_gethostent.

http://gitweb.samba.org/?p=nss_wrapper.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 93db9fd01cf556c49e4109c5901d4b4886bc1229
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Mar 13 14:58:23 2014 +0100

    README: Fix prefix env variable name.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit f24dbf643575c764eb74bbc08de2ececc35f1659
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Mar 13 13:46:22 2014 +0100

    tests: Add test_gethostent.c
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 README                  |    6 ++++-
 tests/test_gethostent.c |   61 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 1 deletions(-)
 create mode 100644 tests/test_gethostent.c


Changeset truncated at 500 lines:

diff --git a/README b/README
index 3edef91..2ffa564 100644
--- a/README
+++ b/README
@@ -47,4 +47,8 @@ NSS_WRAPPER_MODULE_SO_PATH=/path/to/libnss_yourmodule.so
 As each nss module has a special prefix like _nss_winbind_getpwnam() you need
 to set the prefix too so nss_wrapper can load the functions with:
 
-NSS_WRAPPER_MODULE_FN_NAME=<prefix>
+NSS_WRAPPER_MODULE_FN_PREFIX=<prefix>
+
+For _nss_winbind_getpwnam() this would be:
+
+NSS_WRAPPER_MODULE_FN_PREFIX=winbind
diff --git a/tests/test_gethostent.c b/tests/test_gethostent.c
new file mode 100644
index 0000000..e95195f
--- /dev/null
+++ b/tests/test_gethostent.c
@@ -0,0 +1,61 @@
+#include "config.h"
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+
+static void test_nwrap_gethostent(void **state)
+{
+	struct hostent *he;
+	uint32_t i;
+
+	(void)state; /* unused */
+
+	sethostent(0);
+
+	for (he = gethostent(); he != NULL; he = gethostent()) {
+		assert_non_null(he->h_addr_list);
+		assert_non_null(he->h_aliases);
+
+		for (i = 0; he->h_addr_list[i] != NULL; i++) {
+			char buf[INET6_ADDRSTRLEN];
+			uint32_t j;
+			const char *ip;
+			
+			ip = inet_ntop(he->h_addrtype,
+				       he->h_addr_list[i],
+				       buf,
+				       sizeof(buf));
+
+			printf("ip: %s\n", ip);
+
+			for (j = 0; he->h_aliases[j] != NULL; j++) {
+				printf("alias: %s\n", he->h_aliases[j]);
+			}
+		}
+	}
+
+	endhostent();
+}
+
+int main(void) {
+	int rc;
+
+	const UnitTest tests[] = {
+		unit_test(test_nwrap_gethostent),
+	};
+
+	rc = run_tests(tests);
+
+	return rc;
+}


-- 
NSS Wrapper Repository


More information about the samba-cvs mailing list