mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-28 01:41:14 -06:00
check for existing and self referential segments
Reviewed-By: Petr Vobornik <pvoborni@redhat.com> Reviewed-By: Simo Sorce <ssorce@redhat.com>
This commit is contained in:
parent
2661a860e0
commit
777a9500ce
@ -279,13 +279,20 @@ ipa_topo_check_connect_reject(Slapi_PBlock *pb)
|
|||||||
if (pi && 0 == strcasecmp(pi, ipa_topo_get_plugin_id())) {
|
if (pi && 0 == strcasecmp(pi, ipa_topo_get_plugin_id())) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
slapi_pblock_get(pb,SLAPI_DELETE_EXISTING_ENTRY,&add_entry);
|
slapi_pblock_get(pb,SLAPI_ADD_ENTRY,&add_entry);
|
||||||
if (TOPO_SEGMENT_ENTRY != ipa_topo_check_entry_type(add_entry)) {
|
if (TOPO_SEGMENT_ENTRY != ipa_topo_check_entry_type(add_entry)) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
/* a new segment is added
|
/* a new segment is added
|
||||||
* verify that the segment does not yet exist
|
* verify that the segment does not yet exist
|
||||||
*/
|
*/
|
||||||
|
char *leftnode = slapi_entry_attr_get_charptr(add_entry,"ipaReplTopoSegmentLeftNode");
|
||||||
|
char *rightnode = slapi_entry_attr_get_charptr(add_entry,"ipaReplTopoSegmentRightNode");
|
||||||
|
if (0 == strcasecmp(leftnode,rightnode)) {
|
||||||
|
slapi_log_error(SLAPI_LOG_FATAL, IPA_TOPO_PLUGIN_SUBSYSTEM,
|
||||||
|
"segment is self referential\n");
|
||||||
|
rc = 1;
|
||||||
|
} else {
|
||||||
TopoReplicaSegment *tsegm;
|
TopoReplicaSegment *tsegm;
|
||||||
TopoReplica *tconf = ipa_topo_util_get_conf_for_segment(add_entry);
|
TopoReplica *tconf = ipa_topo_util_get_conf_for_segment(add_entry);
|
||||||
tsegm = ipa_topo_util_find_segment(tconf, add_entry);
|
tsegm = ipa_topo_util_find_segment(tconf, add_entry);
|
||||||
@ -295,6 +302,9 @@ ipa_topo_check_connect_reject(Slapi_PBlock *pb)
|
|||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
slapi_ch_free_string(&leftnode);
|
||||||
|
slapi_ch_free_string(&rightnode);
|
||||||
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,8 +388,8 @@ int ipa_topo_pre_add(Slapi_PBlock *pb)
|
|||||||
} else if (ipa_topo_check_connect_reject(pb)) {
|
} else if (ipa_topo_check_connect_reject(pb)) {
|
||||||
int rc = LDAP_UNWILLING_TO_PERFORM;
|
int rc = LDAP_UNWILLING_TO_PERFORM;
|
||||||
char *errtxt;
|
char *errtxt;
|
||||||
errtxt = slapi_ch_smprintf("Segment already exists in topology."
|
errtxt = slapi_ch_smprintf("Segment already exists in topology or"
|
||||||
"Add rejected.\n");
|
" is self referential. Add rejected.\n");
|
||||||
slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, errtxt);
|
slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, errtxt);
|
||||||
slapi_pblock_set(pb, SLAPI_RESULT_CODE, &rc);
|
slapi_pblock_set(pb, SLAPI_RESULT_CODE, &rc);
|
||||||
result = SLAPI_PLUGIN_FAILURE;
|
result = SLAPI_PLUGIN_FAILURE;
|
||||||
|
Loading…
Reference in New Issue
Block a user