nwrap: Add mutex for libc symbol binding
authorAndreas Schneider <asn@samba.org>
Wed, 1 Apr 2020 16:21:55 +0000 (18:21 +0200)
committerAndreas Schneider <asn@samba.org>
Thu, 2 Apr 2020 08:42:36 +0000 (10:42 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@suse.de>
src/nss_wrapper.c

index d90264c6d243705057ebbe6cba0ad10752f6a39b..514ee0173e164a2f5229dc71d44ec5a1dd2b4673 100644 (file)
@@ -185,6 +185,7 @@ typedef nss_status_t NSS_STATUS;
        pthread_mutex_unlock(&( m ## _mutex)); \
 } while(0)
 
+static pthread_mutex_t libc_symbol_binding_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 static bool nwrap_initialized = false;
 static pthread_mutex_t nwrap_initialized_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -201,6 +202,7 @@ static pthread_mutex_t nwrap_sp_global_mutex = PTHREAD_MUTEX_INITIALIZER;
  * nwrap_init() function.
  */
 # define NWRAP_LOCK_ALL do { \
+       NWRAP_LOCK(libc_symbol_binding); \
        NWRAP_LOCK(nwrap_initialized); \
        NWRAP_LOCK(nwrap_global); \
        NWRAP_LOCK(nwrap_gr_global); \
@@ -216,6 +218,7 @@ static pthread_mutex_t nwrap_sp_global_mutex = PTHREAD_MUTEX_INITIALIZER;
        NWRAP_UNLOCK(nwrap_gr_global); \
        NWRAP_UNLOCK(nwrap_global); \
        NWRAP_UNLOCK(nwrap_initialized); \
+       NWRAP_UNLOCK(libc_symbol_binding); \
 } while (0);
 
 static void nwrap_init(void);