summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Boreham <dboreham@redhat.com>2005-05-06 03:35:52 +0000
committerDavid Boreham <dboreham@redhat.com>2005-05-06 03:35:52 +0000
commitbc338326a2a00fb9fb9a5cc329301c7f8712d9d7 (patch)
treec81986fe472653c4ee9d88a42f91cd2643f841ec
parentc574a5401c8a26ed4d760331097d3d2ea2bb3359 (diff)
downloadds-bc338326a2a00fb9fb9a5cc329301c7f8712d9d7.tar.gz
ds-bc338326a2a00fb9fb9a5cc329301c7f8712d9d7.tar.xz
ds-bc338326a2a00fb9fb9a5cc329301c7f8712d9d7.zip
Fix for 157021: server doesn't correctly process modifies to windows sync agreements
-rw-r--r--ldap/servers/plugins/replication/repl5.h1
-rw-r--r--ldap/servers/plugins/replication/repl5_agmtlist.c2
-rw-r--r--ldap/servers/plugins/replication/windows_private.c94
3 files changed, 71 insertions, 26 deletions
diff --git a/ldap/servers/plugins/replication/repl5.h b/ldap/servers/plugins/replication/repl5.h
index 69d8da75..dfebcddd 100644
--- a/ldap/servers/plugins/replication/repl5.h
+++ b/ldap/servers/plugins/replication/repl5.h
@@ -565,6 +565,7 @@ ReplicaId agmt_get_consumerRID(Repl_Agmt *ra);
void windows_init_agreement_from_entry(Repl_Agmt *ra, Slapi_Entry *e);
+int windows_handle_modify_agreement(Repl_Agmt *ra, const char *type, Slapi_Entry *e);
void windows_agreement_delete(Repl_Agmt *ra);
Repl_Connection *windows_conn_new(Repl_Agmt *agmt);
diff --git a/ldap/servers/plugins/replication/repl5_agmtlist.c b/ldap/servers/plugins/replication/repl5_agmtlist.c
index f1d6d5ce..b8abe4c0 100644
--- a/ldap/servers/plugins/replication/repl5_agmtlist.c
+++ b/ldap/servers/plugins/replication/repl5_agmtlist.c
@@ -433,7 +433,7 @@ agmtlist_modify_callback(Slapi_PBlock *pb, Slapi_Entry *entryBefore, Slapi_Entry
/* ignore modifier's name and timestamp attributes and the description. */
continue;
}
- else
+ else if (0 == windows_handle_modify_agreement(agmt, mods[i]->mod_type, e))
{
slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "agmtlist_modify_callback: "
"modification of %s attribute is not allowed\n", mods[i]->mod_type);
diff --git a/ldap/servers/plugins/replication/windows_private.c b/ldap/servers/plugins/replication/windows_private.c
index 7ddbae43..c1a28c93 100644
--- a/ldap/servers/plugins/replication/windows_private.c
+++ b/ldap/servers/plugins/replication/windows_private.c
@@ -75,51 +75,95 @@ true_value_from_string(char *val)
}
}
-void
-windows_init_agreement_from_entry(Repl_Agmt *ra, Slapi_Entry *e)
+static int
+windows_parse_config_entry(Repl_Agmt *ra, const char *type, Slapi_Entry *e)
{
char *tmpstr = NULL;
- agmt_set_priv(ra,windows_private_new());
+ int retval = 0;
- /* DN of entry at root of replicated area */
- tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7WindowsReplicaArea);
- if (NULL != tmpstr)
+ if (type == NULL || slapi_attr_types_equivalent(type,type_nsds7WindowsReplicaArea))
{
- windows_private_set_windows_subtree(ra, slapi_sdn_new_dn_passin(tmpstr) );
+ tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7WindowsReplicaArea);
+ if (NULL != tmpstr)
+ {
+ windows_private_set_windows_subtree(ra, slapi_sdn_new_dn_passin(tmpstr) );
+ }
+ retval = 1;
+ slapi_ch_free((void**)&tmpstr);
}
- tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7DirectoryReplicaArea);
- if (NULL != tmpstr)
+ if (type == NULL || slapi_attr_types_equivalent(type,type_nsds7DirectoryReplicaArea))
{
- windows_private_set_directory_subtree(ra, slapi_sdn_new_dn_passin(tmpstr) );
+ tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7DirectoryReplicaArea);
+ if (NULL != tmpstr)
+ {
+ windows_private_set_directory_subtree(ra, slapi_sdn_new_dn_passin(tmpstr) );
+ }
+ retval = 1;
+ slapi_ch_free((void**)&tmpstr);
}
-
- tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7CreateNewUsers);
- if (NULL != tmpstr && true_value_from_string(tmpstr))
+ if (type == NULL || slapi_attr_types_equivalent(type,type_nsds7CreateNewUsers))
{
- windows_private_set_create_users(ra, PR_TRUE);
+ tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7CreateNewUsers);
+ if (NULL != tmpstr && true_value_from_string(tmpstr))
+ {
+ windows_private_set_create_users(ra, PR_TRUE);
+ }
+ else
+ {
+ windows_private_set_create_users(ra, PR_FALSE);
+ }
+ retval = 1;
slapi_ch_free((void**)&tmpstr);
}
- else
+ if (type == NULL || slapi_attr_types_equivalent(type,type_nsds7CreateNewGroups))
{
- windows_private_set_create_users(ra, PR_FALSE);
+ tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7CreateNewGroups);
+ if (NULL != tmpstr && true_value_from_string(tmpstr))
+ {
+ windows_private_set_create_groups(ra, PR_TRUE);
+ }
+ else
+ {
+ windows_private_set_create_groups(ra, PR_FALSE);
+ }
+ retval = 1;
+ slapi_ch_free((void**)&tmpstr);
}
- tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7CreateNewGroups);
- if (NULL != tmpstr && true_value_from_string(tmpstr))
+ if (type == NULL || slapi_attr_types_equivalent(type,type_nsds7WindowsDomain))
{
- windows_private_set_create_groups(ra, PR_TRUE);
+ tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7WindowsDomain);
+ if (NULL != tmpstr)
+ {
+ windows_private_set_windows_domain(ra,tmpstr);
+ }
+ retval = 1;
slapi_ch_free((void**)&tmpstr);
}
- else
+ return retval;
+}
+
+/* Returns non-zero if the modify was ok, zero if not */
+int
+windows_handle_modify_agreement(Repl_Agmt *ra, const char *type, Slapi_Entry *e)
+{
+ /* Is this a Windows agreement ? */
+ if (get_agmt_agreement_type(ra) == REPLICA_TYPE_WINDOWS)
{
- windows_private_set_create_groups(ra, PR_FALSE);
- }
- tmpstr = slapi_entry_attr_get_charptr(e, type_nsds7WindowsDomain);
- if (NULL != tmpstr)
+ return windows_parse_config_entry(ra,type,e);
+ } else
{
- windows_private_set_windows_domain(ra,tmpstr);
+ return 0;
}
}
+void
+windows_init_agreement_from_entry(Repl_Agmt *ra, Slapi_Entry *e)
+{
+ agmt_set_priv(ra,windows_private_new());
+
+ windows_parse_config_entry(ra,NULL,e);
+}
+
const char* windows_private_get_purl(const Repl_Agmt *ra)
{
const char* windows_purl;