[SCM] NSS Wrapper Repository - branch master updated

Andreas Schneider asn at samba.org
Wed Apr 9 03:40:45 MDT 2014


The branch, master has been updated
       via  db4ac82 Update to version 1.0.2.
       via  5a2bfec testsuite: Fix NULL checks.
       via  cb7201a nwrap: Make nss_wrapper_hosts_enabled() public.
       via  b5d9b9a nwrap: Make nss_wrapper_enabled public.
       via  dd1f9ae cmake: Only set policy in cmake 3.0.
      from  62d86a3 cmake: Fix configure warning with cmake 3.0.

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


- Log -----------------------------------------------------------------
commit db4ac828fc4741e62174647179910ef64a53ae35
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Apr 8 09:58:01 2014 +0200

    Update to version 1.0.2.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>

commit 5a2bfecb84be9a44162a1dfdf5f6562343f45ff6
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Apr 8 09:52:40 2014 +0200

    testsuite: Fix NULL checks.
    
    Found by Coverity.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>

commit cb7201aa7d4904aa0d788d2578e2d0399c9dd701
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Apr 8 09:44:15 2014 +0200

    nwrap: Make nss_wrapper_hosts_enabled() public.

commit b5d9b9a2bbbe86cb4aea682059aea23e60f7cc94
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Apr 8 09:43:04 2014 +0200

    nwrap: Make nss_wrapper_enabled public.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>

commit dd1f9ae1bec81806da86a20e9766da127d289bbb
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Apr 8 09:40:15 2014 +0200

    cmake: Only set policy in cmake 3.0.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>

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

Summary of changes:
 CMakeLists.txt     |    4 +-
 ChangeLog          |    6 ++++
 src/CMakeLists.txt |    4 ++-
 src/nss_wrapper.c  |   73 +++++++++++++++++++++++++++------------------------
 tests/testsuite.c  |   32 +++++++++++-----------
 5 files changed, 66 insertions(+), 53 deletions(-)


Changeset truncated at 500 lines:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a83fb75..fd621e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ set(APPLICATION_NAME ${PROJECT_NAME})
 
 set(APPLICATION_VERSION_MAJOR "1")
 set(APPLICATION_VERSION_MINOR "0")
-set(APPLICATION_VERSION_PATCH "1")
+set(APPLICATION_VERSION_PATCH "2")
 
 set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
 
@@ -19,7 +19,7 @@ set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINO
 #     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.1")
+set(LIBRARY_VERSION "0.1.0")
 set(LIBRARY_SOVERSION "0")
 
 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
diff --git a/ChangeLog b/ChangeLog
index d3307aa..bd6fa10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 ChangeLog
 ==========
 
+version 1.0.2 (released 2014-04-08)
+  * Added public nss_wrapper_enabled().
+  * Added public nss_wrapper_hosts_enabled().
+  * Fixed segfault in 'getent hosts' without aliases.
+  * Fixed IPv4 and IPv6 resolving with 'getent ahosts'.
+
 version 1.0.1 (released 2014-02-04)
   * Added --libs to pkg-config.
   * Added nss_wrapper-config.cmake
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c52b321..e5dccc5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -22,6 +22,8 @@ install(
 )
 
 # This needs to be at the end
-cmake_policy(SET CMP0026 OLD)
+if (CMAKE_VERSION VERSION_GREATER 2.8.12)
+    cmake_policy(SET CMP0026 OLD)
+endif()
 get_target_property(NWRAP_LOCATION nss_wrapper LOCATION)
 set(NSS_WRAPPER_LOCATION ${NWRAP_LOCATION} PARENT_SCOPE)
diff --git a/src/nss_wrapper.c b/src/nss_wrapper.c
index 92e2bf7..7c5a413 100644
--- a/src/nss_wrapper.c
+++ b/src/nss_wrapper.c
@@ -323,6 +323,11 @@ struct nwrap_ops {
 	void		(*nw_endgrent)(struct nwrap_backend *b);
 };
 
+/* Public prototypes */
+
+bool nss_wrapper_enabled(void);
+bool nss_wrapper_hosts_enabled(void);
+
 /* prototypes for files backend */
 
 
@@ -1245,7 +1250,7 @@ static void nwrap_init(void)
 	nwrap_he_global.cache->unload = nwrap_he_unload;
 }
 
-static bool nwrap_enabled(void)
+bool nss_wrapper_enabled(void)
 {
 	nwrap_init();
 
@@ -1261,7 +1266,7 @@ static bool nwrap_enabled(void)
 	return true;
 }
 
-static bool nwrap_hosts_enabled(void)
+bool nss_wrapper_hosts_enabled(void)
 {
 	nwrap_init();
 
@@ -2402,7 +2407,7 @@ int gethostbyname_r(const char *name,
 		    char *buf, size_t buflen,
 		    struct hostent **result, int *h_errnop)
 {
-	if (!nwrap_hosts_enabled()) {
+	if (!nss_wrapper_hosts_enabled()) {
 		return libc_gethostbyname_r(name,
 					    ret,
 					    buf,
@@ -2471,7 +2476,7 @@ int gethostbyaddr_r(const void *addr, socklen_t len, int type,
 		    char *buf, size_t buflen,
 		    struct hostent **result, int *h_errnop)
 {
-	if (!nwrap_hosts_enabled()) {
+	if (!nss_wrapper_hosts_enabled()) {
 		return libc_gethostbyaddr_r(addr,
 					    len,
 					    type,
@@ -2975,7 +2980,7 @@ static struct passwd *nwrap_getpwnam(const char *name)
 
 struct passwd *getpwnam(const char *name)
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		return libc_getpwnam(name);
 	}
 
@@ -3012,7 +3017,7 @@ int getpwnam_r(const char *name, struct passwd *pwdst,
 	       char *buf, size_t buflen, struct passwd **pwdstp)
 # endif /* HAVE_SOLARIS_GETPWNAM_R */
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		return libc_getpwnam_r(name, pwdst, buf, buflen, pwdstp);
 	}
 
@@ -3042,7 +3047,7 @@ static struct passwd *nwrap_getpwuid(uid_t uid)
 
 struct passwd *getpwuid(uid_t uid)
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		return libc_getpwuid(uid);
 	}
 
@@ -3078,7 +3083,7 @@ int getpwuid_r(uid_t uid, struct passwd *pwdst,
 	       char *buf, size_t buflen, struct passwd **pwdstp)
 #endif
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		return libc_getpwuid_r(uid, pwdst, buf, buflen, pwdstp);
 	}
 
@@ -3101,7 +3106,7 @@ static void nwrap_setpwent(void)
 
 void setpwent(void)
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		libc_setpwent();
 		return;
 	}
@@ -3131,7 +3136,7 @@ static struct passwd *nwrap_getpwent(void)
 
 struct passwd *getpwent(void)
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		return libc_getpwent();
 	}
 
@@ -3165,7 +3170,7 @@ struct passwd *getpwent_r(struct passwd *pwdst, char *buf, int buflen)
 	struct passwd *pwdstp = NULL;
 	int rc;
 
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		return libc_getpwent_r(pwdst, buf, buflen);
 	}
 	rc = nwrap_getpwent_r(pwdst, buf, buflen, &pwdstp);
@@ -3179,7 +3184,7 @@ struct passwd *getpwent_r(struct passwd *pwdst, char *buf, int buflen)
 int getpwent_r(struct passwd *pwdst, char *buf,
 	       size_t buflen, struct passwd **pwdstp)
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		return libc_getpwent_r(pwdst, buf, buflen, pwdstp);
 	}
 
@@ -3203,7 +3208,7 @@ static void nwrap_endpwent(void)
 
 void endpwent(void)
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		libc_endpwent();
 		return;
 	}
@@ -3235,7 +3240,7 @@ static int nwrap_initgroups(const char *user, gid_t group)
 
 int initgroups(const char *user, gid_t group)
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		return libc_initgroups(user, group);
 	}
 
@@ -3264,7 +3269,7 @@ static struct group *nwrap_getgrnam(const char *name)
 
 struct group *getgrnam(const char *name)
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		return libc_getgrnam(name);
 	}
 
@@ -3301,7 +3306,7 @@ int getgrnam_r(const char *name, struct group *grp,
 	       char *buf, size_t buflen, struct group **pgrp)
 # endif /* HAVE_SOLARIS_GETGRNAM_R */
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		return libc_getgrnam_r(name,
 				       grp,
 				       buf,
@@ -3335,7 +3340,7 @@ static struct group *nwrap_getgrgid(gid_t gid)
 
 struct group *getgrgid(gid_t gid)
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		return libc_getgrgid(gid);
 	}
 
@@ -3372,7 +3377,7 @@ int getgrgid_r(gid_t gid, struct group *grdst,
 	       char *buf, size_t buflen, struct group **grdstp)
 # endif /* HAVE_SOLARIS_GETGRGID_R */
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		return libc_getgrgid_r(gid, grdst, buf, buflen, grdstp);
 	}
 
@@ -3400,7 +3405,7 @@ int setgrent(void)
 void setgrent(void)
 #endif
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		libc_setgrent();
 		goto out;
 	}
@@ -3437,7 +3442,7 @@ static struct group *nwrap_getgrent(void)
 
 struct group *getgrent(void)
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		return libc_getgrent();
 	}
 
@@ -3471,7 +3476,7 @@ struct group *getgrent_r(struct group *src, char *buf, int buflen)
 	struct group *grdstp = NULL;
 	int rc;
 
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		return libc_getgrent_r(src, buf, buflen);
 	}
 
@@ -3486,7 +3491,7 @@ struct group *getgrent_r(struct group *src, char *buf, int buflen)
 int getgrent_r(struct group *src, char *buf,
 	       size_t buflen, struct group **grdstp)
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		return libc_getgrent_r(src, buf, buflen, grdstp);
 	}
 
@@ -3510,7 +3515,7 @@ static void nwrap_endgrent(void)
 
 void endgrent(void)
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		libc_endgrent();
 		return;
 	}
@@ -3600,7 +3605,7 @@ static int nwrap_getgrouplist(const char *user, gid_t group,
 
 int getgrouplist(const char *user, gid_t group, gid_t *groups, int *ngroups)
 {
-	if (!nwrap_enabled()) {
+	if (!nss_wrapper_enabled()) {
 		return libc_getgrouplist(user, group, groups, ngroups);
 	}
 
@@ -3621,7 +3626,7 @@ static void nwrap_sethostent(int stayopen) {
 #ifdef HAVE_SOLARIS_SETHOSTENT
 int sethostent(int stayopen)
 {
-	if (!nwrap_hosts_enabled()) {
+	if (!nss_wrapper_hosts_enabled()) {
 		libc_sethostent(stayopen);
 		return 0;
 	}
@@ -3633,7 +3638,7 @@ int sethostent(int stayopen)
 #else /* HAVE_SOLARIS_SETHOSTENT */
 void sethostent(int stayopen)
 {
-	if (!nwrap_hosts_enabled()) {
+	if (!nss_wrapper_hosts_enabled()) {
 		libc_sethostent(stayopen);
 		return;
 	}
@@ -3648,7 +3653,7 @@ static struct hostent *nwrap_gethostent(void)
 }
 
 struct hostent *gethostent(void) {
-	if (!nwrap_hosts_enabled()) {
+	if (!nss_wrapper_hosts_enabled()) {
 		return libc_gethostent();
 	}
 
@@ -3662,7 +3667,7 @@ static void nwrap_endhostent(void) {
 #ifdef HAVE_SOLARIS_ENDHOSTENT
 int endhostent(void)
 {
-	if (!nwrap_hosts_enabled()) {
+	if (!nss_wrapper_hosts_enabled()) {
 		libc_endhostent();
 		return 0;
 	}
@@ -3674,7 +3679,7 @@ int endhostent(void)
 #else /* HAVE_SOLARIS_ENDHOSTENT */
 void endhostent(void)
 {
-	if (!nwrap_hosts_enabled()) {
+	if (!nss_wrapper_hosts_enabled()) {
 		libc_endhostent();
 		return;
 	}
@@ -3690,7 +3695,7 @@ static struct hostent *nwrap_gethostbyname(const char *name)
 
 struct hostent *gethostbyname(const char *name)
 {
-	if (!nwrap_hosts_enabled()) {
+	if (!nss_wrapper_hosts_enabled()) {
 		return libc_gethostbyname(name);
 	}
 
@@ -3706,7 +3711,7 @@ static struct hostent *nwrap_gethostbyname2(const char *name, int af)
 
 struct hostent *gethostbyname2(const char *name, int af)
 {
-	if (!nwrap_hosts_enabled()) {
+	if (!nss_wrapper_hosts_enabled()) {
 		return libc_gethostbyname2(name, af);
 	}
 
@@ -3723,7 +3728,7 @@ static struct hostent *nwrap_gethostbyaddr(const void *addr,
 struct hostent *gethostbyaddr(const void *addr,
 			      socklen_t len, int type)
 {
-	if (!nwrap_hosts_enabled()) {
+	if (!nss_wrapper_hosts_enabled()) {
 		return libc_gethostbyaddr(addr, len, type);
 	}
 
@@ -4011,7 +4016,7 @@ int getaddrinfo(const char *node, const char *service,
 		const struct addrinfo *hints,
 		struct addrinfo **res)
 {
-	if (!nwrap_hosts_enabled()) {
+	if (!nss_wrapper_hosts_enabled()) {
 		return libc_getaddrinfo(node, service, hints, res);
 	}
 
@@ -4116,7 +4121,7 @@ int getnameinfo(const struct sockaddr *sa, socklen_t salen,
 		int flags)
 #endif
 {
-	if (!nwrap_hosts_enabled()) {
+	if (!nss_wrapper_hosts_enabled()) {
 		return libc_getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
 	}
 
diff --git a/tests/testsuite.c b/tests/testsuite.c
index 2e43bd5..64887cb 100644
--- a/tests/testsuite.c
+++ b/tests/testsuite.c
@@ -123,20 +123,20 @@ static void print_passwd(struct passwd *pwd)
 
 static bool test_nwrap_getpwnam(const char *name, struct passwd *pwd_p)
 {
-	struct passwd *pwd;
+	struct passwd *pwd = NULL;
 
 	DEBUG("Testing getpwnam: %s\n", name);
 
 	pwd = getpwnam(name);
-	if (pwd) {
+	if (pwd != NULL) {
 		print_passwd(pwd);
 	}
 
-	if (pwd_p) {
+	if (pwd_p != NULL) {
 		copy_passwd(pwd, pwd_p);
 	}
 
-	return pwd ? true : false;
+	return pwd != NULL ? true : false;
 }
 
 static void test_nwrap_getpwnam_r(const char *name,
@@ -166,20 +166,20 @@ static void test_nwrap_getpwnam_r(const char *name,
 static bool test_nwrap_getpwuid(uid_t uid,
 				struct passwd *pwd_p)
 {
-	struct passwd *pwd;
+	struct passwd *pwd = NULL;
 
 	DEBUG("Testing getpwuid: %lu\n", (unsigned long)uid);
 
 	pwd = getpwuid(uid);
-	if (pwd) {
+	if (pwd != NULL) {
 		print_passwd(pwd);
 	}
 
-	if (pwd_p) {
+	if (pwd_p != NULL) {
 		copy_passwd(pwd, pwd_p);
 	}
 
-	return pwd ? true : false;
+	return pwd != NULL ? true : false;
 }
 
 static bool test_nwrap_getpwuid_r(uid_t uid,
@@ -285,20 +285,20 @@ static void print_group(struct group *grp)
 static bool test_nwrap_getgrnam(const char *name,
 				struct group *grp_p)
 {
-	struct group *grp;
+	struct group *grp = NULL;
 
 	DEBUG("Testing getgrnam: %s\n", name);
 
 	grp = getgrnam(name);
-	if (grp) {
+	if (grp != NULL) {
 		print_group(grp);
 	}
 
-	if (grp_p) {
+	if (grp_p != NULL) {
 		copy_group(grp, grp_p);
 	}
 
-	return grp ? true : false;
+	return grp != NULL ? true : false;
 }
 
 static bool test_nwrap_getgrnam_r(const char *name,
@@ -330,20 +330,20 @@ static bool test_nwrap_getgrnam_r(const char *name,
 static bool test_nwrap_getgrgid(gid_t gid,
 				struct group *grp_p)
 {
-	struct group *grp;
+	struct group *grp = NULL;
 
 	DEBUG("Testing getgrgid: %lu\n", (unsigned long)gid);
 
 	grp = getgrgid(gid);
-	if (grp) {
+	if (grp != NULL) {
 		print_group(grp);
 	}
 
-	if (grp_p) {
+	if (grp_p != NULL) {
 		copy_group(grp, grp_p);
 	}
 
-	return grp ? true : false;
+	return grp != NULL ? true : false;
 }
 
 static bool test_nwrap_getgrgid_r(gid_t gid,


-- 
NSS Wrapper Repository


More information about the samba-cvs mailing list