From 87f0cd9c49ea066928300cc08cadea4523fee48f Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 9 Apr 2014 11:54:48 +0200 Subject: [PATCH] Update to version 1.0.2. --- .gitignore | 1 + nss_wrapper-1.0.1-fix_getent_hosts.patch | 171 ----------------------- nss_wrapper-1.0.2-fix_cmake_policy.patch | 13 ++ nss_wrapper.spec | 11 +- sources | 2 +- 5 files changed, 22 insertions(+), 176 deletions(-) delete mode 100644 nss_wrapper-1.0.1-fix_getent_hosts.patch create mode 100644 nss_wrapper-1.0.2-fix_cmake_policy.patch diff --git a/.gitignore b/.gitignore index e397411..348e10d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /nss_wrapper-1.0.1.tar.gz +/nss_wrapper-1.0.2.tar.gz diff --git a/nss_wrapper-1.0.1-fix_getent_hosts.patch b/nss_wrapper-1.0.1-fix_getent_hosts.patch deleted file mode 100644 index e105513..0000000 --- a/nss_wrapper-1.0.1-fix_getent_hosts.patch +++ /dev/null @@ -1,171 +0,0 @@ -commit 64c082a393013e3fc9a0cce0afa5e426f55b5ccd -Author: Andreas Schneider -AuthorDate: Thu Mar 13 10:20:46 2014 +0100 -Commit: Andreas Schneider -CommitDate: Thu Mar 13 13:43:13 2014 +0100 - - src: Fix segfault in 'getent hosts' without aliases. - - The glibc's 'getent' always dereferences he->h_aliases[i], so we need - to allocate it. - - Signed-off-by: Andreas Schneider - Reviewed-by: Stefan Metzmacher ---- - src/nss_wrapper.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/src/nss_wrapper.c b/src/nss_wrapper.c -index 5685fc6..94df6ac 100644 ---- a/src/nss_wrapper.c -+++ b/src/nss_wrapper.c -@@ -1950,7 +1950,12 @@ static bool nwrap_he_parse_line(struct nwrap_cache *nwrap, char *line) - - ed->ht.h_name = n; - -- ed->ht.h_aliases = NULL; -+ /* glib's getent always dereferences he->h_aliases */ -+ ed->ht.h_aliases = malloc(sizeof(char *)); -+ if (ed->ht.h_aliases == NULL) { -+ return false; -+ } -+ ed->ht.h_aliases[0] = NULL; - - /* - * Aliases -commit b928fe9ff92a237ee4cffadfa517d76a4e07d80c -Author: Andreas Schneider -AuthorDate: Thu Mar 13 10:35:47 2014 +0100 -Commit: Andreas Schneider -CommitDate: Thu Mar 13 13:43:32 2014 +0100 - - tests: Add test_gethostent. - - Signed-off-by: Andreas Schneider - Reviewed-by: Stefan Metzmacher ---- - tests/CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt -index 3b84829..5aab29e 100644 ---- a/tests/CMakeLists.txt -+++ b/tests/CMakeLists.txt -@@ -23,7 +23,7 @@ list(APPEND TEST_ENVIRONMENT NSS_WRAPPER_HOSTS=${CMAKE_CURRENT_BINARY_DIR}/hosts - list(APPEND TEST_ENVIRONMENT NSS_WRAPPER_MODULE_SO_PATH=${CMAKE_CURRENT_BINARY_DIR}/libnss_nwrap.so) - list(APPEND TEST_ENVIRONMENT NSS_WRAPPER_MODULE_FN_PREFIX=nwrap) - --set(NWRAP_TESTS testsuite test_getaddrinfo test_getnameinfo test_gethostby_name_addr) -+set(NWRAP_TESTS testsuite test_getaddrinfo test_getnameinfo test_gethostby_name_addr test_gethostent) - - foreach(_NWRAP_TEST ${NWRAP_TESTS}) - add_cmocka_test(${_NWRAP_TEST} ${_NWRAP_TEST}.c ${TESTSUITE_LIBRARIES}) -commit f24dbf643575c764eb74bbc08de2ececc35f1659 -Author: Andreas Schneider -AuthorDate: Thu Mar 13 13:46:22 2014 +0100 -Commit: Andreas Schneider -CommitDate: Fri Mar 14 11:01:04 2014 +0100 - - tests: Add test_gethostent.c - - Signed-off-by: Andreas Schneider - Reviewed-by: Stefan Metzmacher ---- - tests/test_gethostent.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 61 insertions(+) - -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 -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+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; -+} -commit 93db9fd01cf556c49e4109c5901d4b4886bc1229 -Author: Andreas Schneider -AuthorDate: Thu Mar 13 14:58:23 2014 +0100 -Commit: Andreas Schneider -CommitDate: Fri Mar 14 11:01:10 2014 +0100 - - README: Fix prefix env variable name. - - Signed-off-by: Andreas Schneider - Reviewed-by: Stefan Metzmacher ---- - README | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -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= -+NSS_WRAPPER_MODULE_FN_PREFIX= -+ -+For _nss_winbind_getpwnam() this would be: -+ -+NSS_WRAPPER_MODULE_FN_PREFIX=winbind diff --git a/nss_wrapper-1.0.2-fix_cmake_policy.patch b/nss_wrapper-1.0.2-fix_cmake_policy.patch new file mode 100644 index 0000000..53e2803 --- /dev/null +++ b/nss_wrapper-1.0.2-fix_cmake_policy.patch @@ -0,0 +1,13 @@ +Index: nss_wrapper-1.0.2/src/CMakeLists.txt +=================================================================== +--- nss_wrapper-1.0.2.orig/src/CMakeLists.txt ++++ nss_wrapper-1.0.2/src/CMakeLists.txt +@@ -22,7 +22,7 @@ install( + ) + + # This needs to be at the end +-if (CMAKE_VERSION VERSION_GREATER 2.8.12) ++if (CMAKE_VERSION VERSION_GREATER 2.8.13) + cmake_policy(SET CMP0026 OLD) + endif() + get_target_property(NWRAP_LOCATION nss_wrapper LOCATION) diff --git a/nss_wrapper.spec b/nss_wrapper.spec index 7a87f2a..5c2bd93 100644 --- a/nss_wrapper.spec +++ b/nss_wrapper.spec @@ -1,6 +1,6 @@ Name: nss_wrapper -Version: 1.0.1 -Release: 3%{?dist} +Version: 1.0.2 +Release: 1%{?dist} License: BSD Summary: A wrapper for the user, group and hosts NSS API @@ -8,7 +8,7 @@ Url: http://cwrap.org/ Source0: https://ftp.samba.org/pub/cwrap/%{name}-%{version}.tar.gz -Patch0: nss_wrapper-1.0.1-fix_getent_hosts.patch +Patch0: nss_wrapper-1.0.2-fix_cmake_policy.patch BuildRequires: cmake BuildRequires: libcmocka-devel @@ -39,7 +39,7 @@ development/testing. %prep %setup -q -%patch0 -p1 -b .nss_wrapper-1.0.1-fix_getent_hosts.patch +%patch0 -p1 -b .nss_wrapper-1.0.2-fix_cmake_policy.patch %build if test ! -e "obj"; then @@ -78,6 +78,9 @@ popd %{_libdir}/pkgconfig/nss_wrapper.pc %changelog +* Wed Apr 09 2014 - Andreas Schneider - 1.0.2-1 +- Update to version 1.0.2. + * Fri Mar 14 2014 - Andreas Schneider - 1.0.1-3 - resolves: #1075932 - Fix segfault in 'getent hosts'. diff --git a/sources b/sources index ca9da71..ac2154a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -a99fb3e5673bc4796e65a2b0f31875ea nss_wrapper-1.0.1.tar.gz +85c4358b9b640c4ccd900e620f67dc75 nss_wrapper-1.0.2.tar.gz