summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLudwig Krispenz <lkrispen@redhat.com>2015-09-02 15:40:38 +0200
committerSimo Sorce <simo@redhat.com>2015-10-01 16:20:49 -0400
commit7142caf4351a025a72051577775e3cf8969562aa (patch)
tree70c72e25962efcd24d1d6652737d5784f316b2d5
parent7fcda1df69c5b0d05b49fe04ea1d07bc8475bc11 (diff)
downloadfreeipa-7142caf4351a025a72051577775e3cf8969562aa.tar.gz
freeipa-7142caf4351a025a72051577775e3cf8969562aa.tar.xz
freeipa-7142caf4351a025a72051577775e3cf8969562aa.zip
prevent operation on tombstones
-rw-r--r--daemons/ipa-slapi-plugins/topology/topology.h1
-rw-r--r--daemons/ipa-slapi-plugins/topology/topology_post.c3
-rw-r--r--daemons/ipa-slapi-plugins/topology/topology_pre.c3
-rw-r--r--daemons/ipa-slapi-plugins/topology/topology_util.c16
4 files changed, 22 insertions, 1 deletions
diff --git a/daemons/ipa-slapi-plugins/topology/topology.h b/daemons/ipa-slapi-plugins/topology/topology.h
index 65583a99c..1332c7bc7 100644
--- a/daemons/ipa-slapi-plugins/topology/topology.h
+++ b/daemons/ipa-slapi-plugins/topology/topology.h
@@ -289,6 +289,7 @@ void ipa_topo_util_update_host(Slapi_Entry *hostentry, LDAPMod **mods);
void ipa_topo_util_disable_repl_from_host(char *repl_root, char *delhost);
void ipa_topo_util_delete_segments_for_host(char *repl_root, char *delhost);
+int ipa_topo_util_is_tombstone_op(Slapi_PBlock *pb);
int ipa_topo_util_entry_is_candidate(Slapi_Entry *e);
int ipa_topo_util_target_is_managed(Slapi_Entry *e);
int ipa_topo_util_segment_is_managed(TopoReplica *tconf, TopoReplicaSegment *tsegm);
diff --git a/daemons/ipa-slapi-plugins/topology/topology_post.c b/daemons/ipa-slapi-plugins/topology/topology_post.c
index 5e9418933..c20de3cbe 100644
--- a/daemons/ipa-slapi-plugins/topology/topology_post.c
+++ b/daemons/ipa-slapi-plugins/topology/topology_post.c
@@ -214,6 +214,9 @@ ipa_topo_post_del(Slapi_PBlock *pb)
slapi_log_error(SLAPI_LOG_PLUGIN, IPA_TOPO_PLUGIN_SUBSYSTEM,
"--> ipa_topo_post_del\n");
+ /* 0. prevent operation on tombstones */
+ if (ipa_topo_util_is_tombstone_op(pb)) return 0;
+
/* 1. get entry */
slapi_pblock_get(pb,SLAPI_ENTRY_PRE_OP,&del_entry);
diff --git a/daemons/ipa-slapi-plugins/topology/topology_pre.c b/daemons/ipa-slapi-plugins/topology/topology_pre.c
index 96874adf2..c6c22be24 100644
--- a/daemons/ipa-slapi-plugins/topology/topology_pre.c
+++ b/daemons/ipa-slapi-plugins/topology/topology_pre.c
@@ -582,7 +582,8 @@ ipa_topo_pre_del(Slapi_PBlock *pb)
return 0;
}
- if (ipa_topo_pre_ignore_op(pb)) return result;
+ if (ipa_topo_pre_ignore_op(pb) ||
+ ipa_topo_util_is_tombstone_op(pb)) return result;
if (ipa_topo_is_entry_managed(pb)) {
int rc = LDAP_UNWILLING_TO_PERFORM;
diff --git a/daemons/ipa-slapi-plugins/topology/topology_util.c b/daemons/ipa-slapi-plugins/topology/topology_util.c
index cc82530bf..26f569c51 100644
--- a/daemons/ipa-slapi-plugins/topology/topology_util.c
+++ b/daemons/ipa-slapi-plugins/topology/topology_util.c
@@ -474,7 +474,10 @@ ipa_topo_util_conf_from_entry(Slapi_Entry *entry)
{
TopoReplica *conf = NULL;
char *repl_root = NULL;
+
repl_root = slapi_entry_attr_get_charptr(entry,"ipaReplTopoConfRoot");
+ if (NULL == repl_root) return NULL;
+
conf = ipa_topo_cfg_replica_find(repl_root, 1);
if (conf) {
slapi_ch_free((void **)&repl_root);
@@ -1763,3 +1766,16 @@ ipa_topo_util_suffix_update(Slapi_Entry *config_post, Slapi_Entry *config_pre,
LDAPMod **mods)
{
}
+
+#ifndef SLAPI_OP_FLAG_TOMBSTONE_ENTRY
+#define SLAPI_OP_FLAG_TOMBSTONE_ENTRY 0x001000
+#endif
+
+int
+ipa_topo_util_is_tombstone_op(Slapi_PBlock *pb)
+{
+ Slapi_Operation *op;
+
+ slapi_pblock_get(pb, SLAPI_OPERATION, &op);
+ return slapi_operation_is_flag_set(op, SLAPI_OP_FLAG_TOMBSTONE_ENTRY);
+}