s4-dsdb: handle links with no backlinks in replmd_delete
authorAndrew Tridgell <tridge@samba.org>
Thu, 17 Dec 2009 12:50:41 +0000 (23:50 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 1 Jan 2010 21:16:50 +0000 (08:16 +1100)
source4/dsdb/samdb/ldb_modules/repl_meta_data.c

index 689b24f398e2652a2eb1fad8b28252715d5ba7e0..e184181f0154ee577facfa21687c5783deb4f9ed 100644 (file)
@@ -2038,10 +2038,9 @@ static int replmd_delete_remove_link(struct ldb_module *module,
 
                msg->dn = dsdb_dn->dn;
 
-               if (sa->linkID & 1) {
-                       target_attr = dsdb_attribute_by_linkID(schema, sa->linkID - 1);
-               } else {
-                       target_attr = dsdb_attribute_by_linkID(schema, sa->linkID + 1);
+               target_attr = dsdb_attribute_by_linkID(schema, sa->linkID ^ 1);
+               if (target_attr == NULL) {
+                       continue;
                }
 
                ret = ldb_msg_add_empty(msg, target_attr->lDAPDisplayName, LDB_FLAG_MOD_DELETE, &el2);