summaryrefslogtreecommitdiffstats
path: root/ldap/servers/plugins/replication/windows_protocol_util.c
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2008-09-23 21:13:22 +0000
committerRich Megginson <rmeggins@redhat.com>2008-09-23 21:13:22 +0000
commit433007641e85579cdd14963e1b369ff4c34ce0be (patch)
tree513eb242c3deb14514b5ac72d40bd51488cc7aa6 /ldap/servers/plugins/replication/windows_protocol_util.c
parent8039b885768370d16a3ddc8ef3c96ff81af9d227 (diff)
downloadds-433007641e85579cdd14963e1b369ff4c34ce0be.tar.gz
ds-433007641e85579cdd14963e1b369ff4c34ce0be.tar.xz
ds-433007641e85579cdd14963e1b369ff4c34ce0be.zip
Resolves: bug 457846
Bug Description: The Windows Sync API should have plug-in points - part 2 Reviewed by: nkinder (Thanks!) Fix Description: Some additional changes to the api The modify callbacks were not sufficient to handle all cases. We need to have access to the DS entry. This changes the API to add the DS entry to the modify callbacks. I also had to change the handling of the userAccountControl - it cannot just overwrite the value, it must set the appropriate bit in the bit mask. Platforms tested: RHEL5 Flag Day: no Doc impact: yes - plugin guide
Diffstat (limited to 'ldap/servers/plugins/replication/windows_protocol_util.c')
-rw-r--r--ldap/servers/plugins/replication/windows_protocol_util.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c b/ldap/servers/plugins/replication/windows_protocol_util.c
index 7a915684..1d7a9ec1 100644
--- a/ldap/servers/plugins/replication/windows_protocol_util.c
+++ b/ldap/servers/plugins/replication/windows_protocol_util.c
@@ -810,9 +810,24 @@ send_accountcontrol_modify(Slapi_DN *sdn, Private_Repl_Protocol *prp)
{
ConnResult mod_return = 0;
Slapi_Mods smods = {0};
+ Slapi_Entry *remote_entry = NULL;
+ int retval;
+ unsigned long acctval = 0;
+ char acctvalstr[32];
+
+ /* have to first retrieve the existing entry - userAccountControl is
+ a bit array, and we must preserve the existing values if any */
+ /* Get the remote entry */
+ retval = windows_get_remote_entry(prp, sdn, &remote_entry);
+ if (0 == retval && remote_entry) {
+ acctval = slapi_entry_attr_get_ulong(remote_entry, "userAccountControl");
+ }
+ slapi_entry_free(remote_entry);
+ acctval |= 0x0200; /* normal account == 512 */
slapi_mods_init (&smods, 0);
- slapi_mods_add_string(&smods, LDAP_MOD_REPLACE, "userAccountControl", "512");
+ PR_snprintf(acctvalstr, sizeof(acctvalstr), "%lu", acctval);
+ slapi_mods_add_string(&smods, LDAP_MOD_REPLACE, "userAccountControl", acctvalstr);
mod_return = windows_conn_send_modify(prp->conn, slapi_sdn_get_dn(sdn), slapi_mods_get_ldapmods_byref(&smods), NULL, NULL );
@@ -1209,6 +1224,7 @@ windows_replay_update(Private_Repl_Protocol *prp, slapi_operation_parameters *op
winsync_plugin_call_pre_ad_mod_user_mods_cb(prp->agmt,
windows_private_get_raw_entry(prp->agmt),
local_dn,
+ local_entry,
op->p.p_modify.modify_mods,
remote_dn,
&mapped_mods);
@@ -1216,6 +1232,7 @@ windows_replay_update(Private_Repl_Protocol *prp, slapi_operation_parameters *op
winsync_plugin_call_pre_ad_mod_group_mods_cb(prp->agmt,
windows_private_get_raw_entry(prp->agmt),
local_dn,
+ local_entry,
op->p.p_modify.modify_mods,
remote_dn,
&mapped_mods);