summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Boreham <dboreham@redhat.com>2005-04-15 22:59:41 +0000
committerDavid Boreham <dboreham@redhat.com>2005-04-15 22:59:41 +0000
commit3cf5a4f0302cd04b002dba158606d5f2b3fa3bd4 (patch)
tree980d62ed85c64c168f0f6555ad8307e6a24997b6
parent413f26105f36dc486ea14f9dad7c1879b260d15f (diff)
downloadds-3cf5a4f0302cd04b002dba158606d5f2b3fa3bd4.tar.gz
ds-3cf5a4f0302cd04b002dba158606d5f2b3fa3bd4.tar.xz
ds-3cf5a4f0302cd04b002dba158606d5f2b3fa3bd4.zip
Fix initial RUV logic and add support for Win2003
-rw-r--r--ldap/servers/plugins/replication/windows_protocol_util.c40
-rw-r--r--ldap/servers/plugins/replication/windows_tot_protocol.c29
2 files changed, 56 insertions, 13 deletions
diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c b/ldap/servers/plugins/replication/windows_protocol_util.c
index cc3eab94..2daea2c3 100644
--- a/ldap/servers/plugins/replication/windows_protocol_util.c
+++ b/ldap/servers/plugins/replication/windows_protocol_util.c
@@ -445,16 +445,12 @@ windows_acquire_replica(Private_Repl_Protocol *prp, RUV **ruv, int check_ruv)
/* Handle the pristine case */
if (cons_ruv_obj == NULL)
{
- /* DBDB: this is all wrong. Need to fix this */
- RUV *s = NULL;
- s = (RUV*) object_get_data ( replica_get_ruv ( replica ) );
-
- agmt_set_consumer_ruv(prp->agmt, s );
- object_release ( replica_get_ruv ( replica ) );
- cons_ruv_obj = agmt_get_consumer_ruv(prp->agmt);
+ *ruv = NULL;
+ } else
+ {
+ r = (RUV*) object_get_data(cons_ruv_obj);
+ *ruv = ruv_dup(r);
}
- r = (RUV*) object_get_data(cons_ruv_obj);
- *ruv = ruv_dup(r);
if ( supl_ruv_obj ) object_release ( supl_ruv_obj );
if ( cons_ruv_obj ) object_release ( cons_ruv_obj );
@@ -615,6 +611,21 @@ send_password_modify(Slapi_DN *sdn, char *password, Private_Repl_Protocol *prp)
}
static int
+send_accountcontrol_modify(Slapi_DN *sdn, Private_Repl_Protocol *prp)
+{
+ ConnResult mod_return = 0;
+ Slapi_Mods smods = {0};
+
+ slapi_mods_init (&smods, 0);
+ slapi_mods_add_string(&smods, LDAP_MOD_REPLACE, "userAccountControl", "512");
+
+ mod_return = windows_conn_send_modify(prp->conn, slapi_sdn_get_dn(sdn), slapi_mods_get_ldapmods_byref(&smods), NULL, NULL );
+
+ slapi_mods_done(&smods);
+ return mod_return;
+}
+
+static int
windows_entry_has_attr_and_value(Slapi_Entry *e, const char *attrname, char *value)
{
int retval = 0;
@@ -927,6 +938,14 @@ windows_replay_update(Private_Repl_Protocol *prp, slapi_operation_parameters *op
{
slapi_log_error(SLAPI_LOG_REPL, windows_repl_plugin_name, "%s: windows_replay_update: update password returned %d\n",
agmt_get_long_name(prp->agmt), return_value );
+ } else {
+ /* If we successfully added an entry, and then subsequently changed its password, THEN we need to change its status in AD
+ * in order that it can be used (otherwise the user is marked as disabled). To do this we set this attribute and value:
+ * userAccountControl: 512 */
+ if (op->operation_type == SLAPI_OPERATION_ADD && missing_entry)
+ {
+ return_value = send_accountcontrol_modify(remote_dn, prp);
+ }
}
}
} else {
@@ -1044,8 +1063,7 @@ windows_create_remote_entry(Private_Repl_Protocol *prp,Slapi_Entry *original_ent
"objectclass:person\n"
"objectclass:organizationalperson\n"
"objectclass:user\n"
- "userPrincipalName:%s\n"
- "userAccountControl:512\n";
+ "userPrincipalName:%s\n";
char *remote_group_entry_template =
"dn: %s\n"
diff --git a/ldap/servers/plugins/replication/windows_tot_protocol.c b/ldap/servers/plugins/replication/windows_tot_protocol.c
index f0bfe222..b9783b69 100644
--- a/ldap/servers/plugins/replication/windows_tot_protocol.c
+++ b/ldap/servers/plugins/replication/windows_tot_protocol.c
@@ -78,6 +78,13 @@ static void get_result (int rc, void *cb_data);
static int send_entry (Slapi_Entry *e, void *callback_data);
static void windows_tot_delete(Private_Repl_Protocol **prp);
+#if 0
+ /* DBDB: this is all wrong. Need to fix this */
+
+ object_release ( replica_get_ruv ( replica ) );
+ cons_ruv_obj = agmt_get_consumer_ruv(prp->agmt);
+#endif
+
/*
* Completely refresh a replica. The basic protocol interaction goes
* like this:
@@ -96,7 +103,10 @@ windows_tot_run(Private_Repl_Protocol *prp)
CSN *remote_schema_csn = NULL;
PRBool cookie_has_more = PR_TRUE;
RUV *ruv = NULL;
-
+ RUV *starting_ruv = NULL;
+ Replica *replica = NULL;
+ Object *local_ruv_obj = NULL;
+
LDAPDebug( LDAP_DEBUG_TRACE, "=> windows_tot_run\n", 0, 0, 0 );
PR_ASSERT(NULL != prp);
@@ -131,7 +141,14 @@ windows_tot_run(Private_Repl_Protocol *prp)
prp->stopped = 1;
goto done;
}
-
+
+ /* Get the current replica RUV.
+ * If the total update succeeds, we will set the consumer RUV to this value.
+ */
+ replica = object_get_data(prp->replica_object);
+ local_ruv_obj = replica_get_ruv (replica);
+ starting_ruv = ruv_dup((RUV*) object_get_data ( local_ruv_obj ));
+ object_release (local_ruv_obj);
agmt_set_last_init_status(prp->agmt, 0, 0, "Total schema update in progress");
remote_schema_csn = agmt_get_consumer_schema_csn ( prp->agmt );
@@ -184,9 +201,17 @@ windows_tot_run(Private_Repl_Protocol *prp)
slapi_log_error(SLAPI_LOG_FATAL, windows_repl_plugin_name, "Finished total update of replica "
"\"%s\". Sent %d entries.\n", agmt_get_long_name(prp->agmt), cb_data.num_entries);
agmt_set_last_init_status(prp->agmt, 0, 0, "Total update succeeded");
+ /* Now update our consumer RUV for this agreement.
+ * This ensures that future incrememental updates work.
+ */
+ agmt_set_consumer_ruv(prp->agmt, starting_ruv );
}
done:
+ if (starting_ruv)
+ {
+ ruv_destroy(&starting_ruv);
+ }
prp->stopped = 1;
LDAPDebug( LDAP_DEBUG_TRACE, "<= windows_tot_run\n", 0, 0, 0 );