ldb_tdb: Add unique index checking for @IDXDN
authorAndrew Bartlett <abartlet@samba.org>
Mon, 21 Aug 2017 02:24:44 +0000 (14:24 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 22 Sep 2017 19:20:23 +0000 (21:20 +0200)
This will give us errors earlier if the index code becomes broken

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
lib/ldb/ldb_tdb/ldb_index.c

index 5eaa5328940db881b4d9bc0448e2233ebdf85914..34632517127f2f5e1a1677dae680c5441e68565f 100644 (file)
@@ -1486,8 +1486,13 @@ static int ltdb_index_add1(struct ldb_module *module,
                return ret;
        }
 
+       /*
+        * Check for duplicates in unique indexes and for the @IDXDN
+        * DN -> GUID record
+        */
        if (list->count > 0 &&
-           a->flags & LDB_ATTR_FLAG_UNIQUE_INDEX) {
+           (a->flags & LDB_ATTR_FLAG_UNIQUE_INDEX ||
+            ldb_attr_cmp(el->name, LTDB_IDXDN) == 0)) {
                /*
                 * We do not want to print info about a possibly
                 * confidential DN that the conflict was with in the