Blob Blame History Raw
From f7e06707be5c590ce03a50117da483931a0680c6 Mon Sep 17 00:00:00 2001
From: Martin Basti <mbasti@redhat.com>
Date: Tue, 5 Jan 2016 17:58:49 +0100
Subject: [PATCH] Allow to used mixed case for sysrestore

This commit allows to use mixed case of keys for sysrestore, before this
commit all keys were saved in lowercase what prevents to accesing them.

Original usage of mixed case for sysretore key in opendssecinstance had
to be changed to lowercase to prevent issues on already installed
systems.

https://fedorahosted.org/freeipa/ticket/5574

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
---
 ipapython/sysrestore.py                 | 4 ++++
 ipaserver/install/opendnssecinstance.py | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ipapython/sysrestore.py b/ipapython/sysrestore.py
index 1a111258bc0f6dd503673028d3a990821f077fef..97f0d760ae58c8d4bd0409565bf47167a689a06c 100644
--- a/ipapython/sysrestore.py
+++ b/ipapython/sysrestore.py
@@ -67,6 +67,7 @@ class FileStore:
         self.files = {}
 
         p = ConfigParser.SafeConfigParser()
+        p.optionxform = str
         p.read(self._index)
 
         for section in p.sections():
@@ -88,6 +89,7 @@ class FileStore:
             return
 
         p = ConfigParser.SafeConfigParser()
+        p.optionxform = str
 
         p.add_section('files')
         for (key, value) in self.files.items():
@@ -324,6 +326,7 @@ class StateFile:
         self.modules = {}
 
         p = ConfigParser.SafeConfigParser()
+        p.optionxform = str
         p.read(self._path)
 
         for module in p.sections():
@@ -352,6 +355,7 @@ class StateFile:
             return
 
         p = ConfigParser.SafeConfigParser()
+        p.optionxform = str
 
         for module in self.modules.keys():
             p.add_section(module)
diff --git a/ipaserver/install/opendnssecinstance.py b/ipaserver/install/opendnssecinstance.py
index c5377d910d8f38a1ea0e05461ecf1b92f05ca2ca..2ab320b8e5db6c7c4e03850ecfe26e0e178d04a1 100644
--- a/ipaserver/install/opendnssecinstance.py
+++ b/ipaserver/install/opendnssecinstance.py
@@ -265,11 +265,11 @@ class OpenDNSSECInstance(service.Service):
 
     def __setup_dnssec(self):
         # run once only
-        if self.get_state("KASP_DB_configured") and not self.kasp_db_file:
+        if self.get_state("kasp_db_configured") and not self.kasp_db_file:
             root_logger.debug("Already configured, skipping step")
             return
 
-        self.backup_state("KASP_DB_configured", True)
+        self.backup_state("kasp_db_configured", True)
 
         if not self.fstore.has_file(paths.OPENDNSSEC_KASP_DB):
             self.fstore.backup_file(paths.OPENDNSSEC_KASP_DB)
@@ -368,6 +368,8 @@ class OpenDNSSECInstance(service.Service):
                 root_logger.debug(error)
                 pass
 
+        self.restore_state("kasp_db_configured")  # just eat state
+
         # disabled by default, by ldap_enable()
         if enabled:
             self.enable()
-- 
2.4.3