zrhoffman / rpms / 389-ds-base

Forked from rpms/389-ds-base 3 years ago
Clone

Blame SOURCES/0013-Issue-50636-Crash-during-sasl-bind.patch

4c04d8
From fbbbcda083034031e564e8772affe815f2058047 Mon Sep 17 00:00:00 2001
e79480
From: Mark Reynolds <mreynolds@redhat.com>
e79480
Date: Thu, 17 Oct 2019 09:42:02 -0400
e79480
Subject: [PATCH] Issue 50636 - Crash during sasl bind
e79480
e79480
Bug Description:
e79480
	Sasl bind registers IO layers (sasl_IoMethods) that will be
e79480
	pushed (and called) by the next incoming operation.
e79480
	So the next incoming operation should synchronize itself
e79480
	with the sasl bind.
e79480
e79480
Fix Description:
e79480
	The call to connection_call_io_layer_callbacks, that pushes
e79480
	registered methods, must hold c_mutex so that it let
e79480
	a pending sasl bind to fully register the methods.
e79480
e79480
https://pagure.io/389-ds-base/issue/50636
e79480
e79480
Reviewed by: Ludwig Krispenz, Mark Reynolds
e79480
---
e79480
 ldap/servers/slapd/connection.c | 6 ++++--
e79480
 1 file changed, 4 insertions(+), 2 deletions(-)
e79480
e79480
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
4c04d8
index 845a67091..9abd546f9 100644
e79480
--- a/ldap/servers/slapd/connection.c
e79480
+++ b/ldap/servers/slapd/connection.c
4c04d8
@@ -1585,12 +1585,14 @@ connection_threadmain()
e79480
                      */
e79480
                     pb_conn->c_anonlimits_set = 1;
e79480
                 }
e79480
-                PR_ExitMonitor(pb_conn->c_mutex);
e79480
-
e79480
+                /* must hold c_mutex so that it synchronizes the IO layer push
e79480
+                 * with a potential pending sasl bind that is registering the IO layer
e79480
+                 */
e79480
                 if (connection_call_io_layer_callbacks(pb_conn)) {
e79480
                     slapi_log_err(SLAPI_LOG_ERR, "connection_threadmain",
e79480
                                   "Could not add/remove IO layers from connection\n");
e79480
                 }
e79480
+		PR_ExitMonitor(pb_conn->c_mutex);
e79480
                 break;
e79480
             default:
e79480
                 break;
e79480
-- 
e79480
2.21.0
e79480