Blame SOURCES/0001-service-Add-pam-and-nss-services-in-realm_sssd_confi.patch

688d36
From 9d5b6f5c88df582fb94edcf5cc05a8cfaa63cf6a Mon Sep 17 00:00:00 2001
688d36
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
688d36
Date: Tue, 25 Apr 2017 07:20:17 +0200
688d36
Subject: [PATCH] service: Add "pam" and "nss" services in
688d36
 realm_sssd_config_add_domain()
688d36
MIME-Version: 1.0
688d36
Content-Type: text/plain; charset=UTF-8
688d36
Content-Transfer-Encoding: 8bit
688d36
688d36
realm_sssd_config_add_domain() must setup the services line in sssd.conf
688d36
otherwise SSSD won't be able to start any of its services.
688d36
688d36
It's a regression caused by 402cbab which leaves SSSD with no services
688d36
line when joining to an ad client doing "realm join ad.example".
688d36
688d36
https://bugs.freedesktop.org/show_bug.cgi?id=98479
688d36
688d36
Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com>
688d36
---
688d36
 service/realm-sssd-ad.c     | 3 ++-
688d36
 service/realm-sssd-config.c | 2 ++
688d36
 service/realm-sssd-ipa.c    | 3 ++-
688d36
 tests/test-sssd-config.c    | 4 ++--
688d36
 4 files changed, 8 insertions(+), 4 deletions(-)
688d36
688d36
diff --git a/service/realm-sssd-ad.c b/service/realm-sssd-ad.c
688d36
index 5fa81ce..8543ca8 100644
688d36
--- a/service/realm-sssd-ad.c
688d36
+++ b/service/realm-sssd-ad.c
688d36
@@ -207,7 +207,8 @@ configure_sssd_for_domain (RealmIniConfig *config,
688d36
 	                                    "ldap_sasl_authid", authid,
688d36
 	                                    NULL);
688d36
 
688d36
-	realm_ini_config_set_list_diff (config, "sssd", "services", ", ", services, NULL);
688d36
+	if (ret)
688d36
+		ret = realm_ini_config_change_list (config, "sssd", "services", ", ", services, NULL, error);
688d36
 
688d36
 	g_free (authid);
688d36
 	g_string_free (realmd_tags, TRUE);
688d36
diff --git a/service/realm-sssd-config.c b/service/realm-sssd-config.c
688d36
index d4398b9..140d7dc 100644
688d36
--- a/service/realm-sssd-config.c
688d36
+++ b/service/realm-sssd-config.c
688d36
@@ -130,6 +130,7 @@ realm_sssd_config_add_domain (RealmIniConfig *config,
688d36
 	gchar **already;
688d36
 	gboolean ret;
688d36
 	gchar *section;
688d36
+	const gchar *services[] = { "nss", "pam", NULL };
688d36
 	va_list va;
688d36
 	gint i;
688d36
 
688d36
@@ -154,6 +155,7 @@ realm_sssd_config_add_domain (RealmIniConfig *config,
688d36
 	g_strfreev (already);
688d36
 
688d36
 	/* Setup a default sssd section */
688d36
+	realm_ini_config_set_list_diff (config, "sssd", "services", ", ", services, NULL);
688d36
 	if (!realm_ini_config_have (config, "sssd", "config_file_version"))
688d36
 		realm_ini_config_set (config, "sssd", "config_file_version", "2", NULL);
688d36
 
688d36
diff --git a/service/realm-sssd-ipa.c b/service/realm-sssd-ipa.c
688d36
index 001870d..ff1dc8a 100644
688d36
--- a/service/realm-sssd-ipa.c
688d36
+++ b/service/realm-sssd-ipa.c
688d36
@@ -208,7 +208,8 @@ on_ipa_client_do_restart (GObject *source,
688d36
 		                                 "realmd_tags", realmd_tags,
688d36
 		                                 NULL);
688d36
 
688d36
-		realm_ini_config_set_list_diff (config, "sssd", "services", ", ", services, NULL);
688d36
+		if (error == NULL)
688d36
+			realm_ini_config_change_list (config, "sssd", "services", ", ", services, NULL, &error);
688d36
 
688d36
 		g_free (home);
688d36
 	}
688d36
diff --git a/tests/test-sssd-config.c b/tests/test-sssd-config.c
688d36
index 892b9d5..59eab75 100644
688d36
--- a/tests/test-sssd-config.c
688d36
+++ b/tests/test-sssd-config.c
688d36
@@ -90,7 +90,7 @@ test_add_domain (Test *test,
688d36
                  gconstpointer unused)
688d36
 {
688d36
 	const gchar *data = "[domain/one]\nval=1\n[sssd]\ndomains=one";
688d36
-	const gchar *check = "[domain/one]\nval=1\n[sssd]\ndomains = one, two\nconfig_file_version = 2\n\n[domain/two]\ndos = 2\n";
688d36
+	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";
688d36
 	GError *error = NULL;
688d36
 	gchar *output;
688d36
 	gboolean ret;
688d36
@@ -140,7 +140,7 @@ static void
688d36
 test_add_domain_only (Test *test,
688d36
                       gconstpointer unused)
688d36
 {
688d36
-	const gchar *check = "\n[sssd]\ndomains = two\nconfig_file_version = 2\n\n[domain/two]\ndos = 2\n";
688d36
+	const gchar *check = "\n[sssd]\ndomains = two\nconfig_file_version = 2\nservices = nss, pam\n\n[domain/two]\ndos = 2\n";
688d36
 	GError *error = NULL;
688d36
 	gchar *output;
688d36
 	gboolean ret;
688d36
-- 
688d36
2.9.3
688d36