pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0011-adtrust-avoid-using-timestamp-in-klist-output_ed1c1626-rhbz#1750242.patch

544061
From ed1c1626a607a5292c08836d13c32464d1b71859 Mon Sep 17 00:00:00 2001
544061
From: Alexander Bokovoy <abokovoy@redhat.com>
544061
Date: Mon, 9 Sep 2019 11:02:29 +0300
544061
Subject: [PATCH] adtrust: avoid using timestamp in klist output
544061
544061
When parsing a keytab to copy keys to a different keytab, we don't need
544061
the timestamp, so don't ask klist to output it. In some locales (en_IN,
544061
for example), the timestamp is output in a single field without a space
544061
between date and time. In other locales it can be represented with date
544061
and time separated by a space.
544061
544061
Fixes: https://pagure.io/freeipa/issue/8066
544061
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
544061
---
544061
 ipaserver/install/plugins/adtrust.py | 8 ++++----
544061
 1 file changed, 4 insertions(+), 4 deletions(-)
544061
544061
diff --git a/ipaserver/install/plugins/adtrust.py b/ipaserver/install/plugins/adtrust.py
544061
index 28932e6c52..3b2e49bc05 100644
544061
--- a/ipaserver/install/plugins/adtrust.py
544061
+++ b/ipaserver/install/plugins/adtrust.py
544061
@@ -721,7 +721,7 @@ def execute(self, **options):
544061
 
544061
 
544061
 KeyEntry = namedtuple('KeyEntry',
544061
-                      ['kvno', 'date', 'time', 'principal', 'etype', 'key'])
544061
+                      ['kvno', 'principal', 'etype', 'key'])
544061
 
544061
 
544061
 @register()
544061
@@ -741,7 +741,7 @@ class update_host_cifs_keytabs(Updater):
544061
     def extract_key_refs(self, keytab):
544061
         host_princ = self.host_princ_template.format(
544061
             master=self.api.env.host, realm=self.api.env.realm)
544061
-        result = ipautil.run([paths.KLIST, "-etK", "-k", keytab],
544061
+        result = ipautil.run([paths.KLIST, "-eK", "-k", keytab],
544061
                              capture_output=True, raiseonerr=False,
544061
                              nolog_output=True)
544061
         if result.returncode != 0:
544061
@@ -752,8 +752,8 @@ def extract_key_refs(self, keytab):
544061
             if (host_princ in l and any(e in l for e in self.valid_etypes)):
544061
 
544061
                 els = l.split()
544061
-                els[4] = els[4].strip('()')
544061
-                els[5] = els[5].strip('()')
544061
+                els[-2] = els[-2].strip('()')
544061
+                els[-1] = els[-1].strip('()')
544061
                 keys_to_sync.append(KeyEntry._make(els))
544061
 
544061
         return keys_to_sync