summaryrefslogtreecommitdiffstats
path: root/ipaserver
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2011-10-05 17:16:05 -0400
committerRob Crittenden <rcritten@redhat.com>2011-10-09 23:44:55 -0400
commit9386f154947cd683272f7dfd7797bd9e51c20994 (patch)
treecf787642156d72efdc550bfd381c37eaf645cd5b /ipaserver
parente6e95b51db43fff6ff0aab0cf4a98f282bcc549c (diff)
downloadfreeipa-9386f154947cd683272f7dfd7797bd9e51c20994.tar.gz
freeipa-9386f154947cd683272f7dfd7797bd9e51c20994.tar.xz
freeipa-9386f154947cd683272f7dfd7797bd9e51c20994.zip
Fix DNS permissions and membership in privileges
This resolves two issues: 1. The DNS acis lacked a prefix so weren't tied to permissions 2. The permissions were added before the privileges so the member values weren't calculated properly For updates we need to add in the members and recalculate memberof via a DS task. https://fedorahosted.org/freeipa/ticket/1898
Diffstat (limited to 'ipaserver')
-rw-r--r--ipaserver/install/ldapupdate.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
index f2f416b9c..e1f6b1f43 100644
--- a/ipaserver/install/ldapupdate.py
+++ b/ipaserver/install/ldapupdate.py
@@ -267,7 +267,7 @@ class LDAPUpdate:
def parse_update_file(self, data, all_updates, dn_list):
"""Parse the update file into a dictonary of lists and apply the update
for each DN in the file."""
- valid_keywords = ["default", "add", "remove", "only", "deleteentry", "replace", "addifnew"]
+ valid_keywords = ["default", "add", "remove", "only", "deleteentry", "replace", "addifnew", "addifexist"]
update = {}
d = ""
index = ""
@@ -533,6 +533,14 @@ class LDAPUpdate:
e.append(v)
logging.debug('addifnew: set %s to %s', k, e)
entry.setValues(k, e)
+ elif utype == 'addifexist':
+ logging.debug("addifexist: '%s' to %s, current value %s", v, k, e)
+ # Only add the attribute if the entry doesn't exist. We
+ # determine this based on whether it has an objectclass
+ if entry.getValues('objectclass'):
+ e.append(v)
+ logging.debug('addifexist: set %s to %s', k, e)
+ entry.setValues(k, e)
elif utype == 'only':
logging.debug("only: set %s to '%s', current value %s", k, v, e)
if only.get(k):
@@ -645,7 +653,11 @@ class LDAPUpdate:
# entry.orig_data = {}
try:
if self.live_run:
- self.conn.addEntry(entry.dn, entry.toTupleList())
+ if len(entry.toTupleList()) > 0:
+ # addifexist may result in an entry with only a
+ # dn defined. In that case there is nothing to do.
+ # It means the entry doesn't exist, so skip it.
+ self.conn.addEntry(entry.dn, entry.toTupleList())
self.modified = True
except Exception, e:
logging.error("Add failure %s", e)