590d18
From a4ea0af1fb74ac9bdf9afe1bee62cddf65f5160e Mon Sep 17 00:00:00 2001
590d18
From: Jan Cholasta <jcholast@redhat.com>
590d18
Date: Thu, 27 Aug 2015 07:23:39 +0200
590d18
Subject: [PATCH] cert renewal: Include KRA users in Dogtag LDAP update
590d18
590d18
https://fedorahosted.org/freeipa/ticket/5253
590d18
590d18
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
590d18
---
590d18
 ipaserver/install/cainstance.py | 13 +++++++++----
590d18
 1 file changed, 9 insertions(+), 4 deletions(-)
590d18
590d18
diff --git a/ipaserver/install/cainstance.py b/ipaserver/install/cainstance.py
590d18
index 5fd3017e16e0d7ed4b4f8eead0e59266fdaff097..ecd9300036353426097d929918be974cbbb5c69d 100644
590d18
--- a/ipaserver/install/cainstance.py
590d18
+++ b/ipaserver/install/cainstance.py
590d18
@@ -1575,7 +1575,7 @@ def update_people_entry(dercert):
590d18
 
590d18
     Returns True or False
590d18
     """
590d18
-    base_dn = DN(('ou','People'), ('o','ipaca'))
590d18
+    base_dn = DN(('o', 'ipaca'))
590d18
     serial_number = x509.get_serial_number(dercert, datatype=x509.DER)
590d18
     subject = x509.get_subject(dercert, datatype=x509.DER)
590d18
     issuer = x509.get_issuer(dercert, datatype=x509.DER)
590d18
@@ -1591,9 +1591,14 @@ def update_people_entry(dercert):
590d18
             conn = ldap2.ldap2(api, ldap_uri=dogtag_uri)
590d18
             conn.connect(autobind=True)
590d18
 
590d18
-            db_filter = conn.make_filter(
590d18
-                {'description': ';%s;%s' % (issuer, subject)},
590d18
-                exact=False, trailing_wildcard=False)
590d18
+            db_filter = conn.combine_filters(
590d18
+                [
590d18
+                    conn.make_filter({'objectClass': 'inetOrgPerson'}),
590d18
+                    conn.make_filter(
590d18
+                        {'description': ';%s;%s' % (issuer, subject)},
590d18
+                        exact=False, trailing_wildcard=False),
590d18
+                ],
590d18
+                conn.MATCH_ALL)
590d18
             try:
590d18
                 entries = conn.get_entries(base_dn, conn.SCOPE_SUBTREE, db_filter)
590d18
             except errors.NotFound:
590d18
-- 
590d18
2.5.1
590d18