Blob Blame History Raw
From e41de8344a09092ae4d973f495eef54a106a11ee Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose@redhat.com>
Date: Thu, 26 Nov 2020 17:24:10 +0100
Subject: [PATCH] ldap: setup TLS when using ldaps

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1826964
---
 service/realm-ldap.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/service/realm-ldap.c b/service/realm-ldap.c
index 2076d1e..e07a299 100644
--- a/service/realm-ldap.c
+++ b/service/realm-ldap.c
@@ -263,6 +263,14 @@ realm_ldap_connect_anonymous (GSocketAddress *address,
 			return NULL;
 		}
 
+		if (use_ldaps) {
+			rc = ldap_install_tls (ls->ldap);
+			if (rc != LDAP_SUCCESS) {
+				g_warning ("ldap_start_tls_s() failed: %s", ldap_err2string (rc));
+				return NULL;
+			}
+		}
+
 		break;
 
 	case G_SOCKET_PROTOCOL_UDP:
-- 
2.28.0