From: Garming Sam Date: Thu, 9 Mar 2017 02:56:12 +0000 (+1300) Subject: ldb_tdb: Do not check for duplicate values during a rename X-Git-Tag: tdb-1.3.13~504 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b562a90646ab540cc63d054c8500792794984166;p=thirdparty%2Fsamba.git ldb_tdb: Do not check for duplicate values during a rename This is not the time to be pretending to be dbcheck, and there are exceptions to the single-value rules in Samba. This is needed for the same reasons as the modify case. (Note: this error was triggered with the demote of an RODC with links) Signed-off-by: Garming Sam Reviewed-by: Andrew Bartlett Pair-programmed-with: Andrew Bartlett --- diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c index 2dde0244f13..502afd9c3c8 100644 --- a/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/lib/ldb/ldb_tdb/ldb_tdb.c @@ -355,13 +355,17 @@ static int ltdb_add_internal(struct ldb_module *module, continue; } - /* TODO: This is O(n^2) - replace with more efficient check */ - for (j=0; jnum_values; j++) { - if (ldb_msg_find_val(el, &el->values[j]) != &el->values[j]) { - ldb_asprintf_errstring(ldb, - "attribute '%s': value #%u on '%s' provided more than once", - el->name, j, ldb_dn_get_linearized(msg->dn)); - return LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS; + if (check_single_value) { + /* TODO: This is O(n^2) - replace with more efficient check */ + for (j=0; jnum_values; j++) { + if (ldb_msg_find_val(el, &el->values[j]) != &el->values[j]) { + ldb_asprintf_errstring(ldb, + "attribute '%s': value #%u on '%s' " + "provided more than once", + el->name, j, + ldb_dn_get_linearized(msg->dn)); + return LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS; + } } } }