summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Kinder <nkinder@redhat.com>2009-10-30 10:28:09 -0700
committerNathan Kinder <nkinder@redhat.com>2009-11-06 08:03:48 -0800
commit07b5f941afb8817c145b8fc73e91c5ea92482948 (patch)
treea95f6adcc3db0ca0be9f70ff545d759de23a0f51
parentfaf68949bba456988ec4aaa2715c8d9cd664f513 (diff)
387681 - Fix errors in mapping AD tombstones
The AD tombstone mapping code is not behaving correctly if a cn contains a comma (such as a "last, first" type value). The code is supposed to locate the first ":" in the tombstone DN, then scan for the first "," after that. Everything between is the GUID. The problem is that the code is starting at the beginning of the string when searching for the "," instead of starting at the ":" that was previously found. This causes the "," in the cn to be found instead, which makes us fail to find the GUID. The fix is to simply start searching for the "," from the ":" in the tombstone DN.
-rw-r--r--ldap/servers/plugins/replication/windows_protocol_util.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c b/ldap/servers/plugins/replication/windows_protocol_util.c
index ed5b8a32..2c31c4f9 100644
--- a/ldap/servers/plugins/replication/windows_protocol_util.c
+++ b/ldap/servers/plugins/replication/windows_protocol_util.c
@@ -2615,10 +2615,13 @@ extract_guid_from_tombstone_dn(const char *dn)
"CN=WDel Userdb1\\\nDEL:551706bc-ecf2-4b38-9284-9a8554171d69,CN=Deleted Objects,DC=magpie,DC=com" */
/* First find the 'DEL:' */
- colon_offset = strchr(dn,':');
- /* Then scan forward to the next ',' */
- comma_offset = strchr(dn,',');
- /* The characters inbetween are the GUID, copy them to a new string and return to the caller */
+ if (colon_offset = strchr(dn,':')) {
+ /* Then scan forward to the next ',' */
+ comma_offset = strchr(colon_offset,',');
+ }
+
+ /* The characters inbetween are the GUID, copy them
+ * to a new string and return to the caller */
if (comma_offset && colon_offset && comma_offset > colon_offset) {
guid = slapi_ch_malloc(comma_offset - colon_offset);
strncpy(guid,colon_offset+1,(comma_offset-colon_offset)-1);