Patch moves uwrap_id_mutex before if (uwrap.initialised) statement
which can be passed by concurrent threads.
Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
const char *env = getenv("UID_WRAPPER");
pthread_t tid = pthread_self();
-
-
+ UWRAP_LOCK(uwrap_id);
if (uwrap.initialised) {
struct uwrap_thread *id = uwrap_tls_id;
int rc;
if (id != NULL) {
+ UWRAP_UNLOCK(uwrap_id);
return;
}
- UWRAP_LOCK(uwrap_id);
id = find_uwrap_id(tid);
if (id == NULL) {
rc = uwrap_new_id(tid, true);
UWRAP_LOG(UWRAP_LOG_DEBUG, "Initialize uid_wrapper");
- UWRAP_LOCK(uwrap_id);
-
uwrap.initialised = true;
uwrap.enabled = false;