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

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