Blame SOURCES/0001-service-add-REALM_DBUS_OPTION_USE_LDAPS-and-realm_ge.patch

3eb28c
From cf40987b7f847be70ef3a5a0fa359116c0259477 Mon Sep 17 00:00:00 2001
3eb28c
From: Sumit Bose <sbose@redhat.com>
3eb28c
Date: Fri, 30 Oct 2020 13:19:09 +0100
3eb28c
Subject: [PATCH 1/6] service: add REALM_DBUS_OPTION_USE_LDAPS and
3eb28c
 realm_get_use_ldaps
3eb28c
3eb28c
Add a new option to the realmd service to use ldaps where possible and
3eb28c
supported.
3eb28c
3eb28c
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1826964
3eb28c
---
3eb28c
 dbus/realm-dbus-constants.h |  1 +
3eb28c
 service/realm-options.c     | 17 +++++++++++++++++
3eb28c
 service/realm-options.h     |  2 ++
3eb28c
 3 files changed, 20 insertions(+)
3eb28c
3eb28c
diff --git a/dbus/realm-dbus-constants.h b/dbus/realm-dbus-constants.h
3eb28c
index 40ffa2d..0bd7a5d 100644
3eb28c
--- a/dbus/realm-dbus-constants.h
3eb28c
+++ b/dbus/realm-dbus-constants.h
3eb28c
@@ -70,6 +70,7 @@ G_BEGIN_DECLS
3eb28c
 #define   REALM_DBUS_OPTION_OS_NAME                "os-name"
3eb28c
 #define   REALM_DBUS_OPTION_OS_VERSION             "os-version"
3eb28c
 #define   REALM_DBUS_OPTION_LEGACY_SMB_CONF        "legacy-samba-config"
3eb28c
+#define   REALM_DBUS_OPTION_USE_LDAPS              "use-ldaps"
3eb28c
 
3eb28c
 #define   REALM_DBUS_IDENTIFIER_ACTIVE_DIRECTORY   "active-directory"
3eb28c
 #define   REALM_DBUS_IDENTIFIER_WINBIND            "winbind"
3eb28c
diff --git a/service/realm-options.c b/service/realm-options.c
3eb28c
index 34a209f..d42eb7c 100644
3eb28c
--- a/service/realm-options.c
3eb28c
+++ b/service/realm-options.c
3eb28c
@@ -199,3 +199,20 @@ realm_options_ad_specific (GVariant *options,
3eb28c
 
3eb28c
 	return g_strdup (value);
3eb28c
 }
3eb28c
+
3eb28c
+gboolean realm_option_use_ldaps (GVariant *options)
3eb28c
+{
3eb28c
+	gchar *use_ldaps_str;
3eb28c
+
3eb28c
+	use_ldaps_str = realm_options_ad_specific (options,
3eb28c
+	                                          REALM_DBUS_OPTION_USE_LDAPS);
3eb28c
+	if (use_ldaps_str != NULL
3eb28c
+	            && ( g_ascii_strcasecmp (use_ldaps_str, "True") == 0
3eb28c
+	                || g_ascii_strcasecmp (use_ldaps_str, "Yes") == 0)) {
3eb28c
+		g_free (use_ldaps_str);
3eb28c
+		return TRUE;
3eb28c
+	}
3eb28c
+	g_free (use_ldaps_str);
3eb28c
+
3eb28c
+	return FALSE;
3eb28c
+}
3eb28c
diff --git a/service/realm-options.h b/service/realm-options.h
3eb28c
index b71d219..bc13cd7 100644
3eb28c
--- a/service/realm-options.h
3eb28c
+++ b/service/realm-options.h
3eb28c
@@ -48,6 +48,8 @@ const gchar *  realm_options_computer_name           (GVariant *options,
3eb28c
 const gchar *  realm_options_ad_specific              (GVariant *options,
3eb28c
                                                        const gchar *option_name);
3eb28c
 
3eb28c
+gboolean       realm_option_use_ldaps                 (GVariant *options);
3eb28c
+
3eb28c
 G_END_DECLS
3eb28c
 
3eb28c
 #endif /* __REALM_OPTIONS_H__ */
3eb28c
-- 
3eb28c
2.26.2
3eb28c