Blame SOURCES/0001-Change-qualified-names-default-for-IPA.patch

deab74
From 21ab1fdd127d242a9b4e95c3c90dd2bf3159d149 Mon Sep 17 00:00:00 2001
deab74
From: Sumit Bose <sbose@redhat.com>
deab74
Date: Tue, 14 Aug 2018 16:44:39 +0200
deab74
Subject: [PATCH] Change qualified names default for IPA
deab74
deab74
In a FreeIPA domain it is typically expected that the IPA accounts use
deab74
sort names while accounts from trusted domains have fully qualified
deab74
names. This is automatically done by SSSD's IPA provider so there is no
deab74
need to force fully qualified names in the SSSD configuration.
deab74
deab74
Related to https://bugzilla.redhat.com/show_bug.cgi?id=1619162
deab74
---
deab74
 service/realm-options.c       | 9 +++++----
deab74
 service/realm-options.h       | 3 ++-
deab74
 service/realm-samba-winbind.c | 2 +-
deab74
 service/realm-sssd-ad.c       | 2 +-
deab74
 service/realm-sssd-ipa.c      | 2 +-
deab74
 5 files changed, 10 insertions(+), 8 deletions(-)
deab74
deab74
diff --git a/service/realm-options.c b/service/realm-options.c
deab74
index bd804ea..34a209f 100644
deab74
--- a/service/realm-options.c
deab74
+++ b/service/realm-options.c
deab74
@@ -98,7 +98,7 @@ realm_options_automatic_mapping (GVariant *options,
deab74
 
deab74
 	if (realm_name && !option) {
deab74
 		section = g_utf8_casefold (realm_name, -1);
deab74
-		mapping = realm_settings_boolean (realm_name, REALM_DBUS_OPTION_AUTOMATIC_ID_MAPPING, TRUE);
deab74
+		mapping = realm_settings_boolean (section, REALM_DBUS_OPTION_AUTOMATIC_ID_MAPPING, TRUE);
deab74
 		g_free (section);
deab74
 	}
deab74
 
deab74
@@ -112,20 +112,21 @@ realm_options_automatic_join (const gchar *realm_name)
deab74
 	gboolean mapping;
deab74
 
deab74
 	section = g_utf8_casefold (realm_name, -1);
deab74
-	mapping = realm_settings_boolean (realm_name, "automatic-join", FALSE);
deab74
+	mapping = realm_settings_boolean (section, "automatic-join", FALSE);
deab74
 	g_free (section);
deab74
 
deab74
 	return mapping;
deab74
 }
deab74
 
deab74
 gboolean
deab74
-realm_options_qualify_names (const gchar *realm_name)
deab74
+realm_options_qualify_names (const gchar *realm_name,
deab74
+                             gboolean def)
deab74
 {
deab74
 	gchar *section;
deab74
 	gboolean qualify;
deab74
 
deab74
 	section = g_utf8_casefold (realm_name, -1);
deab74
-	qualify = realm_settings_boolean (realm_name, "fully-qualified-names", TRUE);
deab74
+	qualify = realm_settings_boolean (section, "fully-qualified-names", def);
deab74
 	g_free (section);
deab74
 
deab74
 	return qualify;
deab74
diff --git a/service/realm-options.h b/service/realm-options.h
deab74
index 7a1355e..b71d219 100644
deab74
--- a/service/realm-options.h
deab74
+++ b/service/realm-options.h
deab74
@@ -37,7 +37,8 @@ const gchar *  realm_options_user_principal           (GVariant *options,
deab74
 gboolean       realm_options_automatic_mapping        (GVariant *options,
deab74
 						       const gchar *realm_name);
deab74
 
deab74
-gboolean       realm_options_qualify_names            (const gchar *realm_name);
deab74
+gboolean       realm_options_qualify_names            (const gchar *realm_name,
deab74
+                                                       gboolean def);
deab74
 
deab74
 gboolean       realm_options_check_domain_name        (const gchar *domain_name);
deab74
 
deab74
diff --git a/service/realm-samba-winbind.c b/service/realm-samba-winbind.c
deab74
index 9335e26..61988eb 100644
deab74
--- a/service/realm-samba-winbind.c
deab74
+++ b/service/realm-samba-winbind.c
deab74
@@ -102,7 +102,7 @@ realm_samba_winbind_configure_async (RealmIniConfig *config,
deab74
 		                      "winbind enum groups", "no",
deab74
 		                      "winbind offline logon", "yes",
deab74
 		                      "winbind refresh tickets", "yes",
deab74
-		                      "winbind use default domain", realm_options_qualify_names (domain_name )? "no" : "yes",
deab74
+		                      "winbind use default domain", realm_options_qualify_names (domain_name, TRUE )? "no" : "yes",
deab74
 		                      "template shell", realm_settings_string ("users", "default-shell"),
deab74
 		                      NULL);
deab74
 
deab74
diff --git a/service/realm-sssd-ad.c b/service/realm-sssd-ad.c
deab74
index 8543ca8..de7ce30 100644
deab74
--- a/service/realm-sssd-ad.c
deab74
+++ b/service/realm-sssd-ad.c
deab74
@@ -172,7 +172,7 @@ configure_sssd_for_domain (RealmIniConfig *config,
deab74
 	gchar *home;
deab74
 
deab74
 	home = realm_sssd_build_default_home (realm_settings_string ("users", "default-home"));
deab74
-	qualify = realm_options_qualify_names (disco->domain_name);
deab74
+	qualify = realm_options_qualify_names (disco->domain_name, TRUE);
deab74
 	shell = realm_settings_string ("users", "default-shell");
deab74
 	explicit_computer_name = realm_options_computer_name (options, disco->domain_name);
deab74
 	realmd_tags = g_string_new ("");
deab74
diff --git a/service/realm-sssd-ipa.c b/service/realm-sssd-ipa.c
deab74
index ff1dc8a..5029f6b 100644
deab74
--- a/service/realm-sssd-ipa.c
deab74
+++ b/service/realm-sssd-ipa.c
deab74
@@ -201,7 +201,7 @@ on_ipa_client_do_restart (GObject *source,
deab74
 
deab74
 		realm_sssd_config_update_domain (config, domain, &error,
deab74
 		                                 "cache_credentials", "True",
deab74
-		                                 "use_fully_qualified_names", realm_options_qualify_names (domain) ? "True" : "False",
deab74
+		                                 "use_fully_qualified_names", realm_options_qualify_names (domain, FALSE) ? "True" : "False",
deab74
 		                                 "krb5_store_password_if_offline", "True",
deab74
 		                                 "default_shell", shell,
deab74
 		                                 "fallback_homedir", home,
deab74
-- 
deab74
2.17.1
deab74