s4-ldb: two DNs only match if they have the same deletion status
authorAndrew Tridgell <tridge@samba.org>
Thu, 4 Aug 2011 04:59:47 +0000 (14:59 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 4 Aug 2011 07:34:08 +0000 (09:34 +0200)
Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Thu Aug  4 09:34:08 CEST 2011 on sn-devel-104

lib/ldb-samba/ldif_handlers.c

index a89749750ffb53dedd5d0380aaf96bdfe7b4a832..6ca419b139bb60708cc659f0e1cad90deef1c7be 100644 (file)
@@ -1130,6 +1130,7 @@ static int samba_dn_extended_match(struct ldb_context *ldb,
        TALLOC_CTX *tmp_ctx;
        struct ldb_dn *dn1, *dn2;
        const struct ldb_val *guid1, *guid2, *sid1, *sid2;
+       uint32_t rmd_flags1, rmd_flags2;
 
        tmp_ctx = talloc_new(ldb);
 
@@ -1142,6 +1143,18 @@ static int samba_dn_extended_match(struct ldb_context *ldb,
                return LDB_SUCCESS;
        }
 
+       rmd_flags1 = dsdb_dn_rmd_flags(dn1);
+       rmd_flags2 = dsdb_dn_rmd_flags(dn2);
+
+       if ((rmd_flags1 & DSDB_RMD_FLAG_DELETED) !=
+           (rmd_flags2 & DSDB_RMD_FLAG_DELETED)) {
+               /* only match if they have the same deletion status */
+               talloc_free(tmp_ctx);
+               (*matched) = false;
+               return LDB_SUCCESS;
+       }
+
+
        guid1 = ldb_dn_get_extended_component(dn1, "GUID");
        guid2 = ldb_dn_get_extended_component(dn2, "GUID");
        if (guid1 && guid2) {