From a5a8739b4436b27387c652a8f423b582516d841a Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Thu, 31 Jan 2019 02:33:17 +0000
Subject: [PATCH 100/109] ITS#8957 - Fix ASYNC TLS

Fix ASYNC TLS by correctly handling a return code of -2 in addition to 0
---
 libraries/libldap/open.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libraries/libldap/open.c b/libraries/libldap/open.c
index 67a9353f9..5d70678d6 100644
--- a/libraries/libldap/open.c
+++ b/libraries/libldap/open.c
@@ -440,7 +440,7 @@ ldap_int_open_connection(
 #endif
 
 #ifdef HAVE_TLS
-	if (rc == 0 && ( ld->ld_options.ldo_tls_mode == LDAP_OPT_X_TLS_HARD ||
+	if ((rc == 0 || rc == -2) && ( ld->ld_options.ldo_tls_mode == LDAP_OPT_X_TLS_HARD ||
 		strcmp( srv->lud_scheme, "ldaps" ) == 0 ))
 	{
 		++conn->lconn_refcnt;	/* avoid premature free */
-- 
2.19.1

