浏览代码

Bug 678646 - Ignore tombstone operations in managed entry plug-in

The managed entry plug-in currently doesn't ignore operations tombstone
entries.  If one is using replication and deletes an origin entry, then
re-adds an origin entry with the same name, the associated managed entry
will be deleted when the tombstone is cleaned up.  This results in an
origin entry with no associated managed entry.

This patch makes the managed entry delete post-op skip processing for
tombstone entries.
Nathan Kinder 14 年之前
父节点
当前提交
59209af331
共有 1 个文件被更改,包括 24 次插入0 次删除
  1. 24 0
      ldap/servers/plugins/mep/mep.c

+ 24 - 0
ldap/servers/plugins/mep/mep.c

@@ -2008,6 +2008,12 @@ mep_mod_post_op(Slapi_PBlock *pb)
             goto bail;
             goto bail;
         }
         }
 
 
+        /* If the entry is a tombstone, just bail. */
+        if (slapi_entry_attr_hasvalue(e, SLAPI_ATTR_OBJECTCLASS,
+                                      SLAPI_ATTR_VALUE_TOMBSTONE)) {
+            goto bail;
+        }
+
         /* Check if we're an origin entry.  Update the
         /* Check if we're an origin entry.  Update the
          * mapped attrs of it's managed entry if so. */
          * mapped attrs of it's managed entry if so. */
         managed_dn = slapi_entry_attr_get_charptr(e, MEP_MANAGED_ENTRY_TYPE);
         managed_dn = slapi_entry_attr_get_charptr(e, MEP_MANAGED_ENTRY_TYPE);
@@ -2108,6 +2114,12 @@ mep_add_post_op(Slapi_PBlock *pb)
     slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &e);
     slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &e);
 
 
     if (e) {
     if (e) {
+        /* If the entry is a tombstone, just bail. */
+        if (slapi_entry_attr_hasvalue(e, SLAPI_ATTR_OBJECTCLASS,
+                                      SLAPI_ATTR_VALUE_TOMBSTONE)) {
+            return 0;
+        }
+
         /* Check if a config entry applies
         /* Check if a config entry applies
          * to the entry being added. */
          * to the entry being added. */
         mep_config_read_lock();
         mep_config_read_lock();
@@ -2164,6 +2176,12 @@ mep_del_post_op(Slapi_PBlock *pb)
     if (e) {
     if (e) {
         char *managed_dn = NULL;
         char *managed_dn = NULL;
 
 
+        /* If the entry is a tombstone, just bail. */
+        if (slapi_entry_attr_hasvalue(e, SLAPI_ATTR_OBJECTCLASS,
+                                      SLAPI_ATTR_VALUE_TOMBSTONE)) {
+            return 0;
+        }
+
         /* See if we're an origin entry . */
         /* See if we're an origin entry . */
         managed_dn = slapi_entry_attr_get_charptr(e, MEP_MANAGED_ENTRY_TYPE);
         managed_dn = slapi_entry_attr_get_charptr(e, MEP_MANAGED_ENTRY_TYPE);
         if (managed_dn) {
         if (managed_dn) {
@@ -2236,6 +2254,12 @@ mep_modrdn_post_op(Slapi_PBlock *pb)
         return 0;
         return 0;
     }
     }
 
 
+    /* If the entry is a tombstone, just bail. */
+    if (slapi_entry_attr_hasvalue(post_e, SLAPI_ATTR_OBJECTCLASS,
+                                  SLAPI_ATTR_VALUE_TOMBSTONE)) {
+        return 0;
+    }
+
     /* See if we're an origin entry . */
     /* See if we're an origin entry . */
     managed_dn = slapi_entry_attr_get_charptr(post_e, MEP_MANAGED_ENTRY_TYPE);
     managed_dn = slapi_entry_attr_get_charptr(post_e, MEP_MANAGED_ENTRY_TYPE);
     if (managed_dn) {
     if (managed_dn) {