[SCM] NSS Wrapper Repository - branch master updated

Andreas Schneider asn at samba.org
Wed Aug 9 09:54:02 UTC 2023


The branch, master has been updated
       via  2dd91af src: use LIBC_SO and LIBNSL_SO from GNU libc, if available
       via  3a4e4a2 doc/nss_wrapper.1: Fix typo of 'environment'.
      from  2c879a0 cmake: Fix cmocka >= 1.1.6 find_package() in CONFIG mode

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


- Log -----------------------------------------------------------------
commit 2dd91af5fe572ffebf7eb44d8386aec99cd50ab9
Author: Pino Toscano <toscano.pino at tiscali.it>
Date:   Fri May 30 19:01:29 2014 +0200

    src: use LIBC_SO and LIBNSL_SO from GNU libc, if available
    
    Look for gnu/lib-names.h and use the LIBC_SO and LIBNSL_SO defines to
    dlopen libc and libnsl, so the right library is loaded without manually
    searching for libc.so.N or libnsl.so.N.
    
    Signed-off-by: Simon Josefsson <simon at josefsson.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 3a4e4a2103e7871534e4fa1d85428b0b72ea001a
Author: Simon Josefsson <simon at josefsson.org>
Date:   Sat Aug 5 19:13:08 2023 +0200

    doc/nss_wrapper.1: Fix typo of 'environment'.
    
    Signed-off-by: Simon Josefsson <simon at josefsson.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 ConfigureChecks.cmake |  1 +
 config.h.cmake        |  1 +
 doc/nss_wrapper.1     |  2 +-
 doc/nss_wrapper.1.txt |  2 +-
 src/nss_wrapper.c     | 18 ++++++++++++++++++
 5 files changed, 22 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 5bd69db..e74e83e 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -54,6 +54,7 @@ check_include_file(shadow.h HAVE_SHADOW_H)
 check_include_file(grp.h HAVE_GRP_H)
 check_include_file(nss.h HAVE_NSS_H)
 check_include_file(nss_common.h HAVE_NSS_COMMON_H)
+check_include_file(gnu/lib-names.h HAVE_GNU_LIB_NAMES_H)
 
 # FUNCTIONS
 check_function_exists(strncpy HAVE_STRNCPY)
diff --git a/config.h.cmake b/config.h.cmake
index 6199962..37cd700 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -20,6 +20,7 @@
 #cmakedefine HAVE_GRP_H 1
 #cmakedefine HAVE_NSS_H 1
 #cmakedefine HAVE_NSS_COMMON_H 1
+#cmakedefine HAVE_GNU_LIB_NAMES_H 1
 
 /*************************** FUNCTIONS ***************************/
 
diff --git a/doc/nss_wrapper.1 b/doc/nss_wrapper.1
index 3ef5a89..78727b3 100644
--- a/doc/nss_wrapper.1
+++ b/doc/nss_wrapper.1
@@ -88,7 +88,7 @@ and the group file in
 .PP
 \fBNSS_WRAPPER_HOSTS\fR
 .RS 4
-If you also need to emulate network name resolution in your enviornment, especially with socket_wrapper, you can write a hosts file\&. The format is described in
+If you also need to emulate network name resolution in your environment, especially with socket_wrapper, you can write a hosts file\&. The format is described in
 \fIman 5 hosts\fR\&. Then you can point nss_wrapper to your hosts file using: NSS_WRAPPER_HOSTS=/path/to/your/hosts
 .RE
 .PP
diff --git a/doc/nss_wrapper.1.txt b/doc/nss_wrapper.1.txt
index 4811dde..85a567a 100644
--- a/doc/nss_wrapper.1.txt
+++ b/doc/nss_wrapper.1.txt
@@ -54,7 +54,7 @@ NSS_WRAPPER_GROUP=/path/to/your/group.
 
 *NSS_WRAPPER_HOSTS*::
 
-If you also need to emulate network name resolution in your enviornment,
+If you also need to emulate network name resolution in your environment,
 especially with socket_wrapper, you can write a hosts file. The format is
 described in 'man 5 hosts'. Then you can point nss_wrapper to your hosts
 file using: NSS_WRAPPER_HOSTS=/path/to/your/hosts
diff --git a/src/nss_wrapper.c b/src/nss_wrapper.c
index 3399f06..78d88dc 100644
--- a/src/nss_wrapper.c
+++ b/src/nss_wrapper.c
@@ -61,6 +61,10 @@
 #include <search.h>
 #include <assert.h>
 
+#ifdef HAVE_GNU_LIB_NAMES_H
+#include <gnu/lib-names.h>
+#endif
+
 #include "nss_utils.h"
 /*
  * Defining _POSIX_PTHREAD_SEMANTICS before including pwd.h and grp.h  gives us
@@ -1156,6 +1160,13 @@ static void *nwrap_load_lib_handle(enum nwrap_lib lib)
 	case NWRAP_LIBNSL:
 #ifdef HAVE_LIBNSL
 		handle = nwrap_main_global->libc->nsl_handle;
+#ifdef LIBNSL_SO
+		if (handle == NULL) {
+			handle = dlopen(LIBNSL_SO, flags);
+
+			nwrap_main_global->libc->nsl_handle = handle;
+		}
+#endif
 		if (handle == NULL) {
 			for (i = 10; i >= 0; i--) {
 				char soname[256] = {0};
@@ -1193,6 +1204,13 @@ static void *nwrap_load_lib_handle(enum nwrap_lib lib)
 		/* FALL TROUGH */
 	case NWRAP_LIBC:
 		handle = nwrap_main_global->libc->handle;
+#ifdef LIBC_SO
+		if (handle == NULL) {
+			handle = dlopen(LIBC_SO, flags);
+
+			nwrap_main_global->libc->handle = handle;
+		}
+#endif
 		if (handle == NULL) {
 			for (i = 10; i >= 0; i--) {
 				char soname[256] = {0};


-- 
NSS Wrapper Repository



More information about the samba-cvs mailing list