[SCM] Samba Shared Repository - branch v4-8-test updated

Stefan Metzmacher metze at samba.org
Thu Mar 1 05:09:03 UTC 2018


The branch, v4-8-test has been updated
       via  4cfa1f5 s4:kdc: disable support for CROSS_ORGANIZATION domains
       via  1d92e79 s4:kdc: only support LSA_TRUST_TYPE_UPLEVEL domains in samba_kdc_trust_message2entry()
       via  b524562 s4:kdc: make use of dsdb_trust_parse_tdo_info() in samba_kdc_trust_message2entry()
       via  896a530 winbindd: disable support for CROSS_ORGANIZATION domains
       via  a775187 vfs_fruit: use off_t, not size_t for TM size calculations
       via  95dd73c build: fix libceph-common detection
       via  222a361 WHATSNEW: Explain implications of GUID index change
       via  b0120b5 ldb: version 1.3.2
       via  7aee235 ldb_debug tests: Fix binary data in debug log
       via  da216fa ldb_debug: Fix binary data in debug log
       via  93cfa46 ldb tests: fix null test on incorrect variable
      from  105a5b0 repl_md: avoid returning LDB_SUCCESS on failure

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-8-test


- Log -----------------------------------------------------------------
commit 4cfa1f5e1a0f63fad354f55f1f1b01f8179eff10
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 1 11:06:10 2018 +0100

    s4:kdc: disable support for CROSS_ORGANIZATION domains
    
    We don't support selective authentication yet,
    so we shouldn't silently allow domain wide authentication
    for such a trust.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13299
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Wed Feb 28 19:45:13 CET 2018 on sn-devel-144
    
    (cherry picked from commit 31b5328c46c5f510ba234f75688886987276ee9e)
    
    Autobuild-User(v4-8-test): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(v4-8-test): Thu Mar  1 06:08:56 CET 2018 on sn-devel-144

commit 1d92e79cb0c3704f825d90d1f6bb588bda6ffade
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 1 11:10:14 2018 +0100

    s4:kdc: only support LSA_TRUST_TYPE_UPLEVEL domains in samba_kdc_trust_message2entry()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13299
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit d0a813a173be630c2def93cc55e4514204d265a2)

commit b524562f329b5ee45c5916e5354a48db3b5a0ea6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 1 11:10:14 2018 +0100

    s4:kdc: make use of dsdb_trust_parse_tdo_info() in samba_kdc_trust_message2entry()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13299
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 274209f5cd4eec2ffe4ffe12bfbb41eb8ed0c9df)

commit 896a530398d13c894d331719f2bd50862b162f8d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 1 11:06:10 2018 +0100

    winbindd: disable support for CROSS_ORGANIZATION domains
    
    We don't support selective authentication yet,
    so we shouldn't silently allow domain wide authentication
    for such a trust.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13299
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit afd97e72090aaf31b084646b5fcecaeb8cde653d)

commit a775187f55a37f5be323ff025a9d996c4a1caa3f
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Feb 22 15:52:46 2018 +0100

    vfs_fruit: use off_t, not size_t for TM size calculations
    
    size_t is only a 32-bit integer on 32-bit platforms. We must use off_t
    for file sizes.
    
    https://bugzilla.samba.org/show_bug.cgi?id=13296
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit f9e2cb1369fa9636ff613a4e9c7387151409eafc)

commit 95dd73c1fdd936eacc66584e29b279b6b2ea39f6
Author: Günther Deschner <gd at samba.org>
Date:   Mon Jan 15 23:20:39 2018 +0100

    build: fix libceph-common detection
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13277
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: David Disseldorp <ddiss at samba.org>
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Thu Feb 22 19:30:12 CET 2018 on sn-devel-144
    
    (cherry picked from commit 6a59619844e0def505a6bfa778c17721c062e0ee)

commit 222a3613023d2b74ae068866537d34dc0937d061
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Feb 22 14:01:07 2018 +1300

    WHATSNEW: Explain implications of GUID index change
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>

commit b0120b587783f8de8e8e71366e52f9fffb92dc54
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Feb 27 10:44:44 2018 +0100

    ldb: version 1.3.2
    
    * Expose the SHOW_BINARY, ENABLE_TRACING and DONT_CREATE_DB flag constants
      in the python api.
    * Extend dn.is_child_of() test.
    * Don't load LDB_MODULESDIR as a module file.
    * Fix binary data in debug log (bug #13185).
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Wed Feb 28 04:54:21 CET 2018 on sn-devel-144
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13306
    
    (cherry picked from commit cb58e188008bf920df88dc0212b9f9bb23263179)

commit 7aee235f88175ffe16358dd91337aba6f33f4980
Author: Gary Lockyer <gary at catalyst.net.nz>
Date:   Fri Feb 23 15:04:36 2018 +1300

    ldb_debug tests: Fix binary data in debug log
    
    Tests to ensure:
        When duplicate objects are added, the GUID was printed in the debug log
        are passed through the escape function.
        And that duplicate DN's do not generate debug log entries.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13185
    
    Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Mon Feb 26 07:29:49 CET 2018 on sn-devel-144
    
    (cherry picked from commit 2a85bcb3f486ae6f473b934bbe920d1733b7f7a4)

commit da216fa4f568f21b6d2ab85219896bf9946f7079
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Feb 26 14:31:24 2018 +1300

    ldb_debug: Fix binary data in debug log
    
    When duplicate objects were added, the GUID was printed in the debug log
    The GUID was not escaped and therefore displayed as binary content.
    
    This patch splits out the duplicate DN creation error and the duplicate
    GIUD error.  Duplicate DN's are a normal event and don't require debug
    logging.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13185
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
    (cherry picked from commit c5a14306c82f702f4788faea262c9ec6ade584cb)

commit 93cfa4634745d60797de9346ad56cc9d8c3f6122
Author: Gary Lockyer <gary at catalyst.net.nz>
Date:   Fri Feb 23 15:03:20 2018 +1300

    ldb tests: fix null test on incorrect variable
    
    Fix up tests that were  performing a null check on the wrong variable
    after a call to ldb_msg_new
    
    Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Sat Feb 24 15:50:35 CET 2018 on sn-devel-144
    
    (cherry picked from commit 1ed693423d7a30c3810ddc1b6f052d376c8cd4e7)

-----------------------------------------------------------------------

Summary of changes:
 WHATSNEW.txt                                       |  22 ++
 lib/ldb/ABI/{ldb-1.3.0.sigs => ldb-1.3.2.sigs}     |   0
 ...yldb-util-1.1.10.sigs => pyldb-util-1.3.2.sigs} |   0
 ...-util-1.1.10.sigs => pyldb-util.py3-1.3.2.sigs} |   0
 lib/ldb/ldb_tdb/ldb_index.c                        |  65 ++++-
 lib/ldb/tests/ldb_mod_op_test.c                    | 302 ++++++++++++++++++++-
 lib/ldb/wscript                                    |   2 +-
 source3/modules/vfs_fruit.c                        |  13 +-
 source3/winbindd/winbindd_util.c                   |  11 +
 source3/wscript                                    |   6 +-
 source4/kdc/db-glue.c                              |  48 +++-
 11 files changed, 434 insertions(+), 35 deletions(-)
 copy lib/ldb/ABI/{ldb-1.3.0.sigs => ldb-1.3.2.sigs} (100%)
 copy lib/ldb/ABI/{pyldb-util-1.1.10.sigs => pyldb-util-1.3.2.sigs} (100%)
 copy lib/ldb/ABI/{pyldb-util-1.1.10.sigs => pyldb-util.py3-1.3.2.sigs} (100%)


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 6b111c4..357a8f6 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -12,10 +12,32 @@ Samba 4.8 will be the next version of the Samba suite.
 UPGRADING
 =========
 
+New GUID Index mode in sam.ldb for the AD DC
+--------------------------------------------
+
+Users who upgrade a Samba AD DC in-place will experience a short delay
+in the first startup of Samba while the sam.ldb is re-indexed.
+
+Unlike in previous releases a transparent downgrade is not possible.
+If you wish to downgrade such a DB to a Samba 4.7 or earlier version,
+please run the source4/scripting/bin/sambaundoguididx script first.
 
 NEW FEATURES/CHANGES
 ====================
 
+New GUID Index mode in sam.ldb for the AD DC
+--------------------------------------------
+
+The new layout used for sam.ldb is GUID, rather than DN oriented.
+This provides Samba's Active Directory Domain Controller with a faster
+database, particularly at larger scale.
+
+The underlying DB is still TDB, simply the choice of key has changed.
+
+The new mode is not optional, so no configuration is required.  Older
+Samba versions cannot read the new database (see the upgrade
+note above).
+
 KDC GPO application
 -------------------
 
diff --git a/lib/ldb/ABI/ldb-1.3.0.sigs b/lib/ldb/ABI/ldb-1.3.2.sigs
similarity index 100%
copy from lib/ldb/ABI/ldb-1.3.0.sigs
copy to lib/ldb/ABI/ldb-1.3.2.sigs
diff --git a/lib/ldb/ABI/pyldb-util-1.1.10.sigs b/lib/ldb/ABI/pyldb-util-1.3.2.sigs
similarity index 100%
copy from lib/ldb/ABI/pyldb-util-1.1.10.sigs
copy to lib/ldb/ABI/pyldb-util-1.3.2.sigs
diff --git a/lib/ldb/ABI/pyldb-util-1.1.10.sigs b/lib/ldb/ABI/pyldb-util.py3-1.3.2.sigs
similarity index 100%
copy from lib/ldb/ABI/pyldb-util-1.1.10.sigs
copy to lib/ldb/ABI/pyldb-util.py3-1.3.2.sigs
diff --git a/lib/ldb/ldb_tdb/ldb_index.c b/lib/ldb/ldb_tdb/ldb_index.c
index f2fce42..99fef23 100644
--- a/lib/ldb/ldb_tdb/ldb_index.c
+++ b/lib/ldb/ldb_tdb/ldb_index.c
@@ -1820,28 +1820,67 @@ static int ltdb_index_add1(struct ldb_module *module,
 	}
 
 	/*
-	 * Check for duplicates in unique indexes and for the @IDXDN
-	 * DN -> GUID record
+	 * Check for duplicates in the @IDXDN DN -> GUID record
+	 *
+	 * This is very normal, it just means a duplicate DN creation
+	 * was attempted, so don't set the error string or print scary
+	 * messages.
+	 */
+	if (list->count > 0 &&
+	    ldb_attr_cmp(el->name, LTDB_IDXDN) == 0) {
+		talloc_free(list);
+		return LDB_ERR_CONSTRAINT_VIOLATION;
+	}
+
+	/*
+	 * Check for duplicates in unique indexes
 	 */
 	if (list->count > 0 &&
 	    ((a != NULL
 	      && (a->flags & LDB_ATTR_FLAG_UNIQUE_INDEX ||
-		 (el->flags & LDB_FLAG_INTERNAL_FORCE_UNIQUE_INDEX))) ||
-	     ldb_attr_cmp(el->name, LTDB_IDXDN) == 0)) {
+		  (el->flags & LDB_FLAG_INTERNAL_FORCE_UNIQUE_INDEX))))) {
 		/*
 		 * We do not want to print info about a possibly
 		 * confidential DN that the conflict was with in the
 		 * user-visible error string
 		 */
-		ldb_debug(ldb, LDB_DEBUG_WARNING,
-			  __location__ ": unique index violation on %s in %s, "
-			  "conficts with %*.*s in %s",
-			  el->name, ldb_dn_get_linearized(msg->dn),
-			  (int)list->dn[0].length,
-			  (int)list->dn[0].length,
-			  list->dn[0].data,
-			  ldb_dn_get_linearized(dn_key));
-		ldb_asprintf_errstring(ldb, __location__ ": unique index violation on %s in %s",
+
+		if (ltdb->cache->GUID_index_attribute == NULL) {
+			ldb_debug(ldb, LDB_DEBUG_WARNING,
+				  __location__
+				  ": unique index violation on %s in %s, "
+				  "conficts with %*.*s in %s",
+				  el->name, ldb_dn_get_linearized(msg->dn),
+				  (int)list->dn[0].length,
+				  (int)list->dn[0].length,
+				  list->dn[0].data,
+				  ldb_dn_get_linearized(dn_key));
+		} else {
+			/* This can't fail, gives a default at worst */
+			const struct ldb_schema_attribute *attr
+				= ldb_schema_attribute_by_name(
+					ldb,
+					ltdb->cache->GUID_index_attribute);
+			struct ldb_val v;
+			ret = attr->syntax->ldif_write_fn(ldb, list,
+							  &list->dn[0], &v);
+			if (ret == LDB_SUCCESS) {
+				ldb_debug(ldb, LDB_DEBUG_WARNING,
+					  __location__
+					  ": unique index violation on %s in "
+					  "%s, conficts with %s %*.*s in %s",
+					  el->name,
+					  ldb_dn_get_linearized(msg->dn),
+					  ltdb->cache->GUID_index_attribute,
+					  (int)v.length,
+					  (int)v.length,
+					  v.data,
+					  ldb_dn_get_linearized(dn_key));
+			}
+		}
+		ldb_asprintf_errstring(ldb,
+				       __location__ ": unique index violation "
+				       "on %s in %s",
 				       el->name,
 				       ldb_dn_get_linearized(msg->dn));
 		talloc_free(list);
diff --git a/lib/ldb/tests/ldb_mod_op_test.c b/lib/ldb/tests/ldb_mod_op_test.c
index cf2288c..766ca79 100644
--- a/lib/ldb/tests/ldb_mod_op_test.c
+++ b/lib/ldb/tests/ldb_mod_op_test.c
@@ -3226,7 +3226,7 @@ static void test_ldb_add_duplicate_value_to_unique_index(void **state)
 	assert_int_equal(ret, LDB_SUCCESS);
 
 	msg02 = ldb_msg_new(tmp_ctx);
-	assert_non_null(msg01);
+	assert_non_null(msg02);
 
 	msg02->dn = ldb_dn_new_fmt(msg02, test_ctx->ldb, "dc=test02");
 	assert_non_null(msg02->dn);
@@ -3267,7 +3267,7 @@ static void test_ldb_add_to_index_duplicates_allowed(void **state)
 	assert_int_equal(ret, LDB_SUCCESS);
 
 	msg02 = ldb_msg_new(tmp_ctx);
-	assert_non_null(msg01);
+	assert_non_null(msg02);
 
 	msg02->dn = ldb_dn_new_fmt(msg02, test_ctx->ldb, "dc=test02");
 	assert_non_null(msg02->dn);
@@ -3308,6 +3308,227 @@ static void test_ldb_add_to_index_unique_values_required(void **state)
 	assert_int_equal(ret, LDB_SUCCESS);
 
 	msg02 = ldb_msg_new(tmp_ctx);
+	assert_non_null(msg02);
+
+	msg02->dn = ldb_dn_new_fmt(msg02, test_ctx->ldb, "dc=test02");
+	assert_non_null(msg02->dn);
+
+	ret = ldb_msg_add_string(msg02, "cn", "test_unique_index");
+	assert_int_equal(ret, LDB_SUCCESS);
+
+	ret = ldb_add(test_ctx->ldb, msg02);
+	assert_int_equal(ret, LDB_ERR_CONSTRAINT_VIOLATION);
+	talloc_free(tmp_ctx);
+}
+
+static void ldb_debug_string(void *context, enum ldb_debug_level level,
+			     const char *fmt, va_list ap)
+{
+
+	if (level <= LDB_DEBUG_WARNING) {
+		*((char **)context) = talloc_vasprintf(NULL, fmt, ap);
+	}
+}
+
+static void test_ldb_unique_index_duplicate_logging(void **state)
+{
+	int ret;
+	struct ldb_message *msg01;
+	struct ldb_message *msg02;
+	struct ldbtest_ctx *test_ctx = talloc_get_type_abort(*state,
+							struct ldbtest_ctx);
+	TALLOC_CTX *tmp_ctx;
+	char *debug_string = NULL;
+	char *p = NULL;
+
+	ldb_set_debug(test_ctx->ldb, ldb_debug_string, &debug_string);
+	tmp_ctx = talloc_new(test_ctx);
+	assert_non_null(tmp_ctx);
+
+	msg01 = ldb_msg_new(tmp_ctx);
+	assert_non_null(msg01);
+
+	msg01->dn = ldb_dn_new_fmt(msg01, test_ctx->ldb, "dc=test01");
+	assert_non_null(msg01->dn);
+
+	ret = ldb_msg_add_string(msg01, "cn", "test_unique_index");
+	assert_int_equal(ret, LDB_SUCCESS);
+
+	ret = ldb_add(test_ctx->ldb, msg01);
+	assert_int_equal(ret, LDB_SUCCESS);
+
+	msg02 = ldb_msg_new(tmp_ctx);
+	assert_non_null(msg02);
+
+	msg02->dn = ldb_dn_new_fmt(msg02, test_ctx->ldb, "dc=test02");
+	assert_non_null(msg02->dn);
+
+	ret = ldb_msg_add_string(msg02, "cn", "test_unique_index");
+	assert_int_equal(ret, LDB_SUCCESS);
+
+	ret = ldb_add(test_ctx->ldb, msg02);
+	assert_int_equal(ret, LDB_ERR_CONSTRAINT_VIOLATION);
+
+	assert_non_null(debug_string);
+	p = strstr(
+		debug_string,
+		"unique index violation on cn "
+		"in dc=test02, conficts with dc=test01 in "
+		"@INDEX:CN:test_unique_index");
+	assert_non_null(p);
+	TALLOC_FREE(debug_string);
+	talloc_free(tmp_ctx);
+}
+
+static void test_ldb_duplicate_dn_logging(void **state)
+{
+	int ret;
+	struct ldb_message *msg01;
+	struct ldb_message *msg02;
+	struct ldbtest_ctx *test_ctx = talloc_get_type_abort(*state,
+							struct ldbtest_ctx);
+	TALLOC_CTX *tmp_ctx;
+	char *debug_string = NULL;
+
+	ldb_set_debug(test_ctx->ldb, ldb_debug_string, &debug_string);
+	tmp_ctx = talloc_new(test_ctx);
+	assert_non_null(tmp_ctx);
+
+	msg01 = ldb_msg_new(tmp_ctx);
+	assert_non_null(msg01);
+
+	msg01->dn = ldb_dn_new_fmt(msg01, test_ctx->ldb, "dc=test01");
+	assert_non_null(msg01->dn);
+
+	ret = ldb_msg_add_string(msg01, "cn", "test_unique_index01");
+	assert_int_equal(ret, LDB_SUCCESS);
+
+	ret = ldb_add(test_ctx->ldb, msg01);
+	assert_int_equal(ret, LDB_SUCCESS);
+
+	msg02 = ldb_msg_new(tmp_ctx);
+	assert_non_null(msg02);
+
+	msg02->dn = ldb_dn_new_fmt(msg02, test_ctx->ldb, "dc=test01");
+	assert_non_null(msg02->dn);
+
+	ret = ldb_msg_add_string(msg02, "cn", "test_unique_index02");
+	assert_int_equal(ret, LDB_SUCCESS);
+
+	ret = ldb_add(test_ctx->ldb, msg02);
+	assert_int_equal(ret, LDB_ERR_ENTRY_ALREADY_EXISTS);
+
+	assert_null(debug_string);
+	talloc_free(tmp_ctx);
+}
+
+static int ldb_guid_index_test_setup(void **state)
+{
+	int ret;
+	struct ldb_ldif *ldif;
+	struct ldbtest_ctx *ldb_test_ctx;
+	const char *attrs_ldif =  \
+		"dn: @ATTRIBUTES\n"
+		"cn: UNIQUE_INDEX\n"
+		"\n";
+	const char *index_ldif =  \
+		"dn: @INDEXLIST\n"
+		"@IDXATTR: cn\n"
+		"@IDXGUID: objectUUID\n"
+		"@IDX_DN_GUID: GUID\n"
+		"\n";
+
+	ldbtest_noconn_setup((void **) &ldb_test_ctx);
+
+
+	ret = ldb_connect(ldb_test_ctx->ldb, ldb_test_ctx->dbpath, 0, NULL);
+	assert_int_equal(ret, 0);
+
+	while ((ldif = ldb_ldif_read_string(ldb_test_ctx->ldb, &attrs_ldif))) {
+		ret = ldb_add(ldb_test_ctx->ldb, ldif->msg);
+		assert_int_equal(ret, LDB_SUCCESS);
+	}
+
+	while ((ldif = ldb_ldif_read_string(ldb_test_ctx->ldb, &index_ldif))) {
+		ret = ldb_add(ldb_test_ctx->ldb, ldif->msg);
+		assert_int_equal(ret, LDB_SUCCESS);
+	}
+
+	*state = ldb_test_ctx;
+	return 0;
+}
+
+static int ldb_guid_index_test_teardown(void **state)
+{
+	int ret;
+	struct ldbtest_ctx *ldb_test_ctx = talloc_get_type_abort(*state,
+			struct ldbtest_ctx);
+	struct ldb_dn *del_dn;
+
+	del_dn = ldb_dn_new_fmt(ldb_test_ctx,
+				ldb_test_ctx->ldb,
+				"@INDEXLIST");
+	assert_non_null(del_dn);
+
+	ret = ldb_delete(ldb_test_ctx->ldb, del_dn);
+	if (ret != LDB_ERR_NO_SUCH_OBJECT) {
+		assert_int_equal(ret, LDB_SUCCESS);
+	}
+
+	assert_dn_doesnt_exist(ldb_test_ctx,
+			       "@INDEXLIST");
+
+	TALLOC_FREE(del_dn);
+
+	del_dn = ldb_dn_new_fmt(ldb_test_ctx,
+				ldb_test_ctx->ldb,
+				"@ATTRIBUTES");
+	assert_non_null(del_dn);
+
+	ret = ldb_delete(ldb_test_ctx->ldb, del_dn);
+	if (ret != LDB_ERR_NO_SUCH_OBJECT) {
+		assert_int_equal(ret, LDB_SUCCESS);
+	}
+
+	assert_dn_doesnt_exist(ldb_test_ctx,
+			       "@ATTRIBUTES");
+
+	ldbtest_teardown((void **) &ldb_test_ctx);
+	return 0;
+}
+
+
+static void test_ldb_unique_index_duplicate_with_guid(void **state)
+{
+	int ret;
+	struct ldb_message *msg01;
+	struct ldb_message *msg02;
+	struct ldbtest_ctx *test_ctx = talloc_get_type_abort(*state,
+							struct ldbtest_ctx);
+	TALLOC_CTX *tmp_ctx;
+	char *debug_string = NULL;
+	char *p = NULL;
+
+	ldb_set_debug(test_ctx->ldb, ldb_debug_string, &debug_string);
+	tmp_ctx = talloc_new(test_ctx);
+	assert_non_null(tmp_ctx);
+
+	msg01 = ldb_msg_new(tmp_ctx);
+	assert_non_null(msg01);
+
+	msg01->dn = ldb_dn_new_fmt(msg01, test_ctx->ldb, "dc=test01");
+	assert_non_null(msg01->dn);
+
+	ret = ldb_msg_add_string(msg01, "cn", "test_unique_index");
+	assert_int_equal(ret, LDB_SUCCESS);
+
+	ret = ldb_msg_add_string(msg01, "objectUUID", "0123456789abcdef");
+	assert_int_equal(ret, LDB_SUCCESS);
+
+	ret = ldb_add(test_ctx->ldb, msg01);
+	assert_int_equal(ret, LDB_SUCCESS);
+
+	msg02 = ldb_msg_new(tmp_ctx);
 	assert_non_null(msg01);
 
 	msg02->dn = ldb_dn_new_fmt(msg02, test_ctx->ldb, "dc=test02");
@@ -3316,10 +3537,71 @@ static void test_ldb_add_to_index_unique_values_required(void **state)
 	ret = ldb_msg_add_string(msg02, "cn", "test_unique_index");
 	assert_int_equal(ret, LDB_SUCCESS);
 
+	ret = ldb_msg_add_string(msg02, "objectUUID", "0123456789abcde0");
+	assert_int_equal(ret, LDB_SUCCESS);
+
 	ret = ldb_add(test_ctx->ldb, msg02);
 	assert_int_equal(ret, LDB_ERR_CONSTRAINT_VIOLATION);
+
+	assert_non_null(debug_string);
+	p = strstr(
+		debug_string,
+		"unique index violation on cn in dc=test02, conficts with "
+		"objectUUID 0123456789abcdef in @INDEX:CN:test_unique_index");
+	assert_non_null(p);
+	TALLOC_FREE(debug_string);
 	talloc_free(tmp_ctx);
 }
+
+static void test_ldb_guid_index_duplicate_dn_logging(void **state)
+{
+	int ret;
+	struct ldb_message *msg01;
+	struct ldb_message *msg02;
+	struct ldbtest_ctx *test_ctx = talloc_get_type_abort(*state,
+							struct ldbtest_ctx);
+	TALLOC_CTX *tmp_ctx;
+	char *debug_string = NULL;
+
+	ldb_set_debug(test_ctx->ldb, ldb_debug_string, &debug_string);
+	tmp_ctx = talloc_new(test_ctx);
+	assert_non_null(tmp_ctx);
+
+	msg01 = ldb_msg_new(tmp_ctx);
+	assert_non_null(msg01);
+
+	msg01->dn = ldb_dn_new_fmt(msg01, test_ctx->ldb, "dc=test01");
+	assert_non_null(msg01->dn);
+
+	ret = ldb_msg_add_string(msg01, "cn", "test_unique_index01");
+	assert_int_equal(ret, LDB_SUCCESS);
+
+	ret = ldb_msg_add_string(msg01, "objectUUID", "0123456789abcdef");
+	assert_int_equal(ret, LDB_SUCCESS);
+
+	ret = ldb_add(test_ctx->ldb, msg01);
+	assert_int_equal(ret, LDB_SUCCESS);
+
+	msg02 = ldb_msg_new(tmp_ctx);
+	assert_non_null(msg02);
+
+	msg02->dn = ldb_dn_new_fmt(msg02, test_ctx->ldb, "dc=test01");
+	assert_non_null(msg02->dn);
+
+	ret = ldb_msg_add_string(msg02, "cn", "test_unique_index02");
+	assert_int_equal(ret, LDB_SUCCESS);
+
+	ret = ldb_msg_add_string(msg02, "objectUUID", "0123456789abcde1");
+	assert_int_equal(ret, LDB_SUCCESS);
+
+	ret = ldb_add(test_ctx->ldb, msg02);
+	assert_int_equal(ret, LDB_ERR_ENTRY_ALREADY_EXISTS);
+
+	assert_null(debug_string);
+	talloc_free(tmp_ctx);
+}
+
+
 int main(int argc, const char **argv)
 {
 	const struct CMUnitTest tests[] = {
@@ -3459,6 +3741,22 @@ int main(int argc, const char **argv)
 			test_ldb_add_to_index_unique_values_required,
 			ldb_non_unique_index_test_setup,
 			ldb_non_unique_index_test_teardown),
+		cmocka_unit_test_setup_teardown(
+			test_ldb_unique_index_duplicate_logging,
+			ldb_unique_index_test_setup,
+			ldb_unique_index_test_teardown),
+		cmocka_unit_test_setup_teardown(
+			test_ldb_duplicate_dn_logging,
+			ldb_unique_index_test_setup,
+			ldb_unique_index_test_teardown),
+		cmocka_unit_test_setup_teardown(
+			test_ldb_guid_index_duplicate_dn_logging,
+			ldb_guid_index_test_setup,
+			ldb_guid_index_test_teardown),
+		cmocka_unit_test_setup_teardown(
+			test_ldb_unique_index_duplicate_with_guid,
+			ldb_guid_index_test_setup,
+			ldb_guid_index_test_teardown),
 	};
 
 	return cmocka_run_group_tests(tests, NULL, NULL);
diff --git a/lib/ldb/wscript b/lib/ldb/wscript
index 8ae5be3..6a204c0 100644
--- a/lib/ldb/wscript
+++ b/lib/ldb/wscript
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 APPNAME = 'ldb'
-VERSION = '1.3.1'
+VERSION = '1.3.2'
 
 blddir = 'bin'
 
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 40ee255..ec76f71 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -141,7 +141,7 @@ struct fruit_config_data {
 	bool aapl_zero_file_id;
 	const char *model;
 	bool time_machine;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list