Hello,

     Fix for https://fedorahosted.org/freeipa/ticket/5049

Thanks,

Gabe
From f35225373240b3a26882925fc9db39d8da77c883 Mon Sep 17 00:00:00 2001
From: Gabe <redhatri...@gmail.com>
Date: Fri, 5 Jun 2015 08:01:55 -0600
Subject: [PATCH] Clear SSSD caches when uninstalling the client

https://fedorahosted.org/freeipa/ticket/5049
---
 ipa-client/ipa-install/ipa-client-install | 8 ++++++++
 ipaplatform/base/paths.py                 | 1 +
 2 files changed, 9 insertions(+)

diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index 63e3c9800791f3d29c977d63815c4291f5a235b9..e5425d5f1d927e1fdae98765b756db6b279ed994 100755
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -628,6 +628,14 @@ def uninstall(options, env):
             "Failed to remove krb5/LDAP configuration: %s", str(e))
         return CLIENT_INSTALL_ERROR
 
+    # Clean up the SSSD cache before SSSD service is stopped or restarted
+    remove_file(paths.SSSD_MC_GROUP)
+    remove_file(paths.SSSD_MC_PASSWD)
+
+    for filename in os.listdir(paths.SSSD_DB):
+        sssd_db_cache_file = os.path.join(paths.SSSD_DB, filename)
+        remove_file(sssd_db_cache_file)
+
     # Next if-elif-elif construction deals with sssd.conf file.
     # Old pre-IPA domains are preserved due merging the old sssd.conf
     # during the installation of ipa-client but any new domains are
diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py
index 9ba87523b5619188f02bdad6c23d2446a2c4b0f2..8bee3e7c5862a3815987fa1bd55fa90e25b95ebc 100644
--- a/ipaplatform/base/paths.py
+++ b/ipaplatform/base/paths.py
@@ -289,6 +289,7 @@ class BasePathNamespace(object):
     KRA_BACKUP_KEYS_P12 = "/var/lib/pki/pki-tomcat/alias/kra_backup_keys.p12"
     KRACERT_P12 = "/root/kracert.p12"
     SAMBA_DIR = "/var/lib/samba/"
+    SSSD_DB = "/var/lib/sss/db"
     SSSD_MC_GROUP = "/var/lib/sss/mc/group"
     SSSD_MC_PASSWD = "/var/lib/sss/mc/passwd"
     SSSD_PUBCONF_KNOWN_HOSTS = "/var/lib/sss/pubconf/known_hosts"
-- 
1.8.3.1

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to