From nkinder at fedoraproject.org Thu Jan 7 20:40:10 2010 From: nkinder at fedoraproject.org (Nathan Kinder) Date: Thu, 7 Jan 2010 20:40:10 +0000 (UTC) Subject: [389-commits] ldapserver/ldap/servers/plugins/replication windows_protocol_util.c, 1.52, 1.52.2.1 Message-ID: <20100107204010.B901011C02BC@cvs1.fedora.phx.redhat.com> Author: nkinder Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/replication In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv10956/ldap/servers/plugins/replication Modified Files: Tag: Directory_Server_8_1_Branch windows_protocol_util.c Log Message: Bug 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. Index: windows_protocol_util.c =================================================================== RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/windows_protocol_util.c,v retrieving revision 1.52 retrieving revision 1.52.2.1 diff -u -r1.52 -r1.52.2.1 --- windows_protocol_util.c 19 Feb 2009 23:39:50 -0000 1.52 +++ windows_protocol_util.c 7 Jan 2010 20:40:08 -0000 1.52.2.1 @@ -2615,10 +2615,13 @@ "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);