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

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