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

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