nwrap: Add mutex for nss module symbol binding
authorAndreas Schneider <asn@samba.org>
Wed, 1 Apr 2020 16:22:50 +0000 (18:22 +0200)
committerAndreas Schneider <asn@samba.org>
Thu, 2 Apr 2020 09:28:52 +0000 (11:28 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@suse.de>
src/nss_wrapper.c

index e3b8c5b4b5f32adcd4a88ead0f60fcd20d98c113..69ed092a68234adcf00cf4f850763790831a4eef 100644 (file)
@@ -186,6 +186,7 @@ typedef nss_status_t NSS_STATUS;
 } while(0)
 
 static pthread_mutex_t libc_symbol_binding_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t nss_module_symbol_binding_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 static bool nwrap_initialized = false;
 static pthread_mutex_t nwrap_initialized_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -203,6 +204,7 @@ static pthread_mutex_t nwrap_sp_global_mutex = PTHREAD_MUTEX_INITIALIZER;
  */
 # define NWRAP_LOCK_ALL do { \
        NWRAP_LOCK(libc_symbol_binding); \
+       NWRAP_LOCK(nss_module_symbol_binding); \
        NWRAP_LOCK(nwrap_initialized); \
        NWRAP_LOCK(nwrap_global); \
        NWRAP_LOCK(nwrap_gr_global); \
@@ -218,6 +220,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(nss_module_symbol_binding); \
        NWRAP_UNLOCK(libc_symbol_binding); \
 } while (0);