Blame SOURCES/0001-service-Add-nss-and-pam-sssd.conf-services-after-joi.patch

deab74
From 402cbab6e8267fcd959bcfa84a47f4871b59944d Mon Sep 17 00:00:00 2001
deab74
From: Stef Walter <stefw@redhat.com>
deab74
Date: Fri, 28 Oct 2016 20:27:48 +0200
deab74
Subject: [PATCH] service: Add nss and pam sssd.conf services after joining
deab74
deab74
After adding a domain to sssd.conf add the nss and pam services
deab74
to the [sssd] block.
deab74
deab74
https://bugs.freedesktop.org/show_bug.cgi?id=98479
deab74
---
deab74
 service/realm-sssd-ad.c     | 3 +++
deab74
 service/realm-sssd-config.c | 2 --
deab74
 service/realm-sssd-ipa.c    | 3 +++
deab74
 tests/test-sssd-config.c    | 4 ++--
deab74
 4 files changed, 8 insertions(+), 4 deletions(-)
deab74
deab74
diff --git a/service/realm-sssd-ad.c b/service/realm-sssd-ad.c
deab74
index 5ed384d..5fa81ce 100644
deab74
--- a/service/realm-sssd-ad.c
deab74
+++ b/service/realm-sssd-ad.c
deab74
@@ -160,6 +160,7 @@ configure_sssd_for_domain (RealmIniConfig *config,
deab74
                            gboolean use_adcli,
deab74
                            GError **error)
deab74
 {
deab74
+	const gchar *services[] = { "nss", "pam", NULL };
deab74
 	GString *realmd_tags;
deab74
 	const gchar *access_provider;
deab74
 	const gchar *shell;
deab74
@@ -206,6 +207,8 @@ configure_sssd_for_domain (RealmIniConfig *config,
deab74
 	                                    "ldap_sasl_authid", authid,
deab74
 	                                    NULL);
deab74
 
deab74
+	realm_ini_config_set_list_diff (config, "sssd", "services", ", ", services, NULL);
deab74
+
deab74
 	g_free (authid);
deab74
 	g_string_free (realmd_tags, TRUE);
deab74
 
deab74
diff --git a/service/realm-sssd-config.c b/service/realm-sssd-config.c
deab74
index 2096afd..d4398b9 100644
deab74
--- a/service/realm-sssd-config.c
deab74
+++ b/service/realm-sssd-config.c
deab74
@@ -154,8 +154,6 @@ realm_sssd_config_add_domain (RealmIniConfig *config,
deab74
 	g_strfreev (already);
deab74
 
deab74
 	/* Setup a default sssd section */
deab74
-	if (!realm_ini_config_have (config, "section", "services"))
deab74
-		realm_ini_config_set (config, "sssd", "services", "nss, pam", NULL);
deab74
 	if (!realm_ini_config_have (config, "sssd", "config_file_version"))
deab74
 		realm_ini_config_set (config, "sssd", "config_file_version", "2", NULL);
deab74
 
deab74
diff --git a/service/realm-sssd-ipa.c b/service/realm-sssd-ipa.c
deab74
index b12136e..001870d 100644
deab74
--- a/service/realm-sssd-ipa.c
deab74
+++ b/service/realm-sssd-ipa.c
deab74
@@ -156,6 +156,7 @@ on_ipa_client_do_restart (GObject *source,
deab74
                           GAsyncResult *result,
deab74
                           gpointer user_data)
deab74
 {
deab74
+	const gchar *services[] = { "nss", "pam", NULL };
deab74
 	GTask *task = G_TASK (user_data);
deab74
 	EnrollClosure *enroll = g_task_get_task_data (task);
deab74
 	RealmSssd *sssd = g_task_get_source_object (task);
deab74
@@ -207,6 +208,8 @@ on_ipa_client_do_restart (GObject *source,
deab74
 		                                 "realmd_tags", realmd_tags,
deab74
 		                                 NULL);
deab74
 
deab74
+		realm_ini_config_set_list_diff (config, "sssd", "services", ", ", services, NULL);
deab74
+
deab74
 		g_free (home);
deab74
 	}
deab74
 
deab74
diff --git a/tests/test-sssd-config.c b/tests/test-sssd-config.c
deab74
index 59eab75..892b9d5 100644
deab74
--- a/tests/test-sssd-config.c
deab74
+++ b/tests/test-sssd-config.c
deab74
@@ -90,7 +90,7 @@ test_add_domain (Test *test,
deab74
                  gconstpointer unused)
deab74
 {
deab74
 	const gchar *data = "[domain/one]\nval=1\n[sssd]\ndomains=one";
deab74
-	const gchar *check = "[domain/one]\nval=1\n[sssd]\ndomains = one, two\nconfig_file_version = 2\nservices = nss, pam\n\n[domain/two]\ndos = 2\n";
deab74
+	const gchar *check = "[domain/one]\nval=1\n[sssd]\ndomains = one, two\nconfig_file_version = 2\n\n[domain/two]\ndos = 2\n";
deab74
 	GError *error = NULL;
deab74
 	gchar *output;
deab74
 	gboolean ret;
deab74
@@ -140,7 +140,7 @@ static void
deab74
 test_add_domain_only (Test *test,
deab74
                       gconstpointer unused)
deab74
 {
deab74
-	const gchar *check = "\n[sssd]\ndomains = two\nconfig_file_version = 2\nservices = nss, pam\n\n[domain/two]\ndos = 2\n";
deab74
+	const gchar *check = "\n[sssd]\ndomains = two\nconfig_file_version = 2\n\n[domain/two]\ndos = 2\n";
deab74
 	GError *error = NULL;
deab74
 	gchar *output;
deab74
 	gboolean ret;
deab74
-- 
deab74
2.9.3
deab74