mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
update list of managed servers when a suffix becomes managed
when a suffix becomes managed for a host, the host needs to be added to the managed servers, otherwise connectivity check would fail Reviewed-By: Thierry Bordaz <tbordaz@redhat.com>
This commit is contained in:
parent
22a999267c
commit
3f70c9aed7
@ -178,7 +178,7 @@ void ipa_topo_lock_conf(void);
|
|||||||
void ipa_topo_unlock_conf(void);
|
void ipa_topo_unlock_conf(void);
|
||||||
int ipa_topo_acquire_startup_inprogress(void);
|
int ipa_topo_acquire_startup_inprogress(void);
|
||||||
void ipa_topo_release_startup_inprogress(void);
|
void ipa_topo_release_startup_inprogress(void);
|
||||||
void ipa_topo_cfg_host_add(Slapi_Entry *hostentry);
|
void ipa_topo_cfg_host_add(TopoReplica *tconf, char *host);
|
||||||
void ipa_topo_cfg_host_del(Slapi_Entry *hostentry);
|
void ipa_topo_cfg_host_del(Slapi_Entry *hostentry);
|
||||||
TopoReplicaHost *ipa_topo_cfg_host_find(TopoReplica *tconf, char *host, int lock);
|
TopoReplicaHost *ipa_topo_cfg_host_find(TopoReplica *tconf, char *host, int lock);
|
||||||
TopoReplicaHost *ipa_topo_cfg_host_new(char *newhost);
|
TopoReplicaHost *ipa_topo_cfg_host_new(char *newhost);
|
||||||
@ -283,6 +283,7 @@ int ipa_topo_util_setup_servers(void);
|
|||||||
void ipa_topo_util_update_segments_for_host(TopoReplica *conf, char *hostname);
|
void ipa_topo_util_update_segments_for_host(TopoReplica *conf, char *hostname);
|
||||||
char *ipa_topo_util_get_ldap_principal(char *repl_root, char *hostname);
|
char *ipa_topo_util_get_ldap_principal(char *repl_root, char *hostname);
|
||||||
void ipa_topo_util_disable_repl_for_principal(char *repl_root, char *principal);
|
void ipa_topo_util_disable_repl_for_principal(char *repl_root, char *principal);
|
||||||
|
void ipa_topo_util_init_hosts(Slapi_Entry *hostentry);
|
||||||
void ipa_topo_util_add_host(Slapi_Entry *hostentry);
|
void ipa_topo_util_add_host(Slapi_Entry *hostentry);
|
||||||
void ipa_topo_util_delete_host(Slapi_Entry *hostentry);
|
void ipa_topo_util_delete_host(Slapi_Entry *hostentry);
|
||||||
void ipa_topo_util_update_host(Slapi_Entry *hostentry, LDAPMod **mods);
|
void ipa_topo_util_update_host(Slapi_Entry *hostentry, LDAPMod **mods);
|
||||||
|
@ -471,38 +471,22 @@ ipa_topo_cfg_host_new(char *newhost)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ipa_topo_cfg_host_add(Slapi_Entry *hostentry)
|
ipa_topo_cfg_host_add(TopoReplica *replica, char *newhost)
|
||||||
{
|
{
|
||||||
char *newhost;
|
|
||||||
char **repl_root = NULL;
|
|
||||||
TopoReplicaHost *hostnode = NULL;
|
TopoReplicaHost *hostnode = NULL;
|
||||||
TopoReplica *replica = NULL;
|
if (replica == NULL || newhost == NULL) return;
|
||||||
int i;
|
|
||||||
|
|
||||||
newhost = slapi_entry_attr_get_charptr(hostentry,"cn");
|
slapi_lock_mutex(replica->repl_lock);
|
||||||
if (newhost == NULL) return;
|
if (ipa_topo_cfg_host_find(replica, newhost, 0)) {
|
||||||
|
/* host already added */
|
||||||
repl_root = slapi_entry_attr_get_charray(hostentry,"ipaReplTopoManagedSuffix");
|
|
||||||
if (repl_root == NULL || *repl_root == NULL) return;
|
|
||||||
|
|
||||||
for (i=0; repl_root[i];i++) {
|
|
||||||
replica = ipa_topo_cfg_replica_find(repl_root[i], 1);
|
|
||||||
if (replica == NULL) continue;
|
|
||||||
|
|
||||||
slapi_lock_mutex(replica->repl_lock);
|
|
||||||
if (ipa_topo_cfg_host_find(replica, newhost, 0)) {
|
|
||||||
/* log error */
|
|
||||||
slapi_unlock_mutex(replica->repl_lock);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
hostnode = ipa_topo_cfg_host_new(slapi_ch_strdup(newhost));
|
|
||||||
hostnode->next = replica->hosts;
|
|
||||||
replica->hosts = hostnode;
|
|
||||||
slapi_unlock_mutex(replica->repl_lock);
|
slapi_unlock_mutex(replica->repl_lock);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
hostnode = ipa_topo_cfg_host_new(slapi_ch_strdup(newhost));
|
||||||
|
hostnode->next = replica->hosts;
|
||||||
|
replica->hosts = hostnode;
|
||||||
|
slapi_unlock_mutex(replica->repl_lock);
|
||||||
|
|
||||||
slapi_ch_array_free(repl_root);
|
|
||||||
slapi_ch_free_string(&newhost);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,12 +98,11 @@ ipa_topo_post_add(Slapi_PBlock *pb)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TOPO_HOST_ENTRY: {
|
case TOPO_HOST_ENTRY: {
|
||||||
/* add to list of managed hosts */
|
|
||||||
ipa_topo_cfg_host_add(add_entry);
|
|
||||||
/* we are adding a new master, there could be
|
/* we are adding a new master, there could be
|
||||||
* a segment which so far was inactive since
|
* a segment which so far was inactive since
|
||||||
* the host was not managed
|
* the host was not managed
|
||||||
*/
|
*/
|
||||||
|
/* It will also add to list of managed hosts */
|
||||||
ipa_topo_util_add_host(add_entry);
|
ipa_topo_util_add_host(add_entry);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -194,6 +193,8 @@ ipa_topo_post_mod(Slapi_PBlock *pb)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TOPO_HOST_ENTRY: {
|
case TOPO_HOST_ENTRY: {
|
||||||
|
/* check i host needs to be added to the managed hosts
|
||||||
|
* and if segments need to be created */
|
||||||
ipa_topo_util_update_host(mod_entry, mods);
|
ipa_topo_util_update_host(mod_entry, mods);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ ipa_topo_util_setup_servers(void)
|
|||||||
} else {
|
} else {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (i=0;entries[i];i++) {
|
for (i=0;entries[i];i++) {
|
||||||
ipa_topo_cfg_host_add(entries[i]);
|
ipa_topo_util_init_hosts(entries[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1445,12 +1445,38 @@ ipa_topo_util_delete_segments_for_host(char *repl_root, char *delhost)
|
|||||||
"ipa_topo_util_delete_segments_for_host <-- done\n");
|
"ipa_topo_util_delete_segments_for_host <-- done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ipa_topo_util_init_hosts(Slapi_Entry *hostentry)
|
||||||
|
{
|
||||||
|
char *newhost;
|
||||||
|
char **repl_root = NULL;
|
||||||
|
TopoReplica *replica = NULL;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
newhost = slapi_entry_attr_get_charptr(hostentry,"cn");
|
||||||
|
if (newhost == NULL) return;
|
||||||
|
|
||||||
|
repl_root = slapi_entry_attr_get_charray(hostentry,"ipaReplTopoManagedSuffix");
|
||||||
|
if (repl_root == NULL || *repl_root == NULL) return;
|
||||||
|
|
||||||
|
for (i=0; repl_root[i];i++) {
|
||||||
|
replica = ipa_topo_cfg_replica_find(repl_root[i], 1);
|
||||||
|
if (replica == NULL) continue;
|
||||||
|
|
||||||
|
ipa_topo_cfg_host_add(replica, newhost);
|
||||||
|
}
|
||||||
|
|
||||||
|
slapi_ch_array_free(repl_root);
|
||||||
|
slapi_ch_free_string(&newhost);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ipa_topo_util_add_managed_host(char *suffix, char *addhost)
|
ipa_topo_util_add_managed_host(char *suffix, char *addhost)
|
||||||
{
|
{
|
||||||
TopoReplica *conf = ipa_topo_cfg_replica_find(suffix,1);
|
TopoReplica *conf = ipa_topo_cfg_replica_find(suffix,1);
|
||||||
if (conf) {
|
if (conf) {
|
||||||
|
ipa_topo_cfg_host_add(conf, addhost);
|
||||||
ipa_topo_util_update_segments_for_host(conf, addhost);
|
ipa_topo_util_update_segments_for_host(conf, addhost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user