ldb_tdb: Change error code on unique index violation
authorAndrew Bartlett <abartlet@samba.org>
Mon, 21 Aug 2017 02:25:46 +0000 (14:25 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 22 Sep 2017 19:20:23 +0000 (21:20 +0200)
The LDB_ERR_ENTRY_ALREADY_EXISTS error code is detected in repl_meta_data as indicating
that the DN exists, and that a conflict record should be created.

This is really a constraint violation, not a duplicate record.

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

index 34632517127f2f5e1a1677dae680c5441e68565f..fad88fb3a73214ebfa69fe475322a346b725c421 100644 (file)
@@ -1510,7 +1510,7 @@ static int ltdb_index_add1(struct ldb_module *module,
                                       el->name,
                                       ldb_dn_get_linearized(msg->dn));
                talloc_free(list);
-               return LDB_ERR_ENTRY_ALREADY_EXISTS;
+               return LDB_ERR_CONSTRAINT_VIOLATION;
        }
 
        /* overallocate the list a bit, to reduce the number of