The Samba-Bugzilla – Attachment 13604 Details for
Bug 13025
Continuous re-index possible
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for 4.7 cherry-picked from master
bug-13025-4.7.patch (text/plain), 6.37 KB, created by
Andrew Bartlett
on 2017-09-16 06:43:03 UTC
(
hide
)
Description:
patch for 4.7 cherry-picked from master
Filename:
MIME Type:
Creator:
Andrew Bartlett
Created:
2017-09-16 06:43:03 UTC
Size:
6.37 KB
patch
obsolete
>From bf1c9e995b1b04a3d8a83995f6ccb21a8a231be9 Mon Sep 17 00:00:00 2001 >From: Andrew Bartlett <abartlet@samba.org> >Date: Wed, 13 Sep 2017 16:13:06 +1200 >Subject: [PATCH 1/2] selftest: Check re-opening sam.ldb corrects the > @ATTRIBUTES and @INDEXLIST > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13025 > >Signed-off-by: Andrew Bartlett <abartlet@samba.org> >Reviewed-by: Garming Sam <garming@catalyst.net.nz> >(cherry picked from commit 51be27522caffde8a3806f8c0c877a0f85eaf398) >--- > python/samba/tests/dsdb_schema_attributes.py | 53 ++++++++++++++++++++++++++++ > selftest/knownfail.d/dsdb_schema_attributes | 2 ++ > 2 files changed, 55 insertions(+) > create mode 100644 selftest/knownfail.d/dsdb_schema_attributes > >diff --git a/python/samba/tests/dsdb_schema_attributes.py b/python/samba/tests/dsdb_schema_attributes.py >index df6c8bb..2bebbb5 100644 >--- a/python/samba/tests/dsdb_schema_attributes.py >+++ b/python/samba/tests/dsdb_schema_attributes.py >@@ -173,3 +173,56 @@ systemOnly: FALSE > > self.assertIn(attr_ldap_name, [str(x) for x in idx_res[0]["@IDXATTR"]]) > self.assertIn(attr_ldap_name2, [str(x) for x in idx_res[0]["@IDXATTR"]]) >+ >+ def test_modify_at_attributes(self): >+ m = {"dn": "@ATTRIBUTES", >+ "@TEST_EXTRA": ["HIDDEN"] >+ } >+ >+ msg = ldb.Message.from_dict(self.samdb, m, ldb.FLAG_MOD_ADD) >+ self.samdb.modify(msg) >+ >+ res = self.samdb.search(base="@ATTRIBUTES", scope=ldb.SCOPE_BASE, >+ attrs=["@TEST_EXTRA"]) >+ self.assertEquals(len(res), 1) >+ self.assertEquals(str(res[0].dn), "@ATTRIBUTES") >+ self.assertEquals(len(res[0]), 1) >+ self.assertTrue("@TEST_EXTRA" in res[0]) >+ self.assertEquals(len(res[0]["@TEST_EXTRA"]), 1) >+ self.assertEquals(res[0]["@TEST_EXTRA"][0], "HIDDEN") >+ >+ samdb2 = samba.tests.connect_samdb(self.lp.samdb_url()) >+ >+ res = self.samdb.search(base="@ATTRIBUTES", scope=ldb.SCOPE_BASE, >+ attrs=["@TEST_EXTRA"]) >+ self.assertEquals(len(res), 1) >+ self.assertEquals(str(res[0].dn), "@ATTRIBUTES") >+ self.assertEquals(len(res[0]), 0) >+ self.assertFalse("@TEST_EXTRA" in res[0]) >+ >+ >+ def test_modify_at_indexlist(self): >+ m = {"dn": "@INDEXLIST", >+ "@TEST_EXTRA": ["1"] >+ } >+ >+ msg = ldb.Message.from_dict(self.samdb, m, ldb.FLAG_MOD_ADD) >+ self.samdb.modify(msg) >+ >+ res = self.samdb.search(base="@INDEXLIST", scope=ldb.SCOPE_BASE, >+ attrs=["@TEST_EXTRA"]) >+ self.assertEquals(len(res), 1) >+ self.assertEquals(str(res[0].dn), "@INDEXLIST") >+ self.assertEquals(len(res[0]), 1) >+ self.assertTrue("@TEST_EXTRA" in res[0]) >+ self.assertEquals(len(res[0]["@TEST_EXTRA"]), 1) >+ self.assertEquals(res[0]["@TEST_EXTRA"][0], "1") >+ >+ samdb2 = samba.tests.connect_samdb(self.lp.samdb_url()) >+ >+ res = self.samdb.search(base="@INDEXLIST", scope=ldb.SCOPE_BASE, >+ attrs=["@TEST_EXTRA"]) >+ self.assertEquals(len(res), 1) >+ self.assertEquals(str(res[0].dn), "@INDEXLIST") >+ self.assertEquals(len(res[0]), 0) >+ self.assertFalse("@TEST_EXTRA" in res[0]) >diff --git a/selftest/knownfail.d/dsdb_schema_attributes b/selftest/knownfail.d/dsdb_schema_attributes >new file mode 100644 >index 0000000..4242212 >--- /dev/null >+++ b/selftest/knownfail.d/dsdb_schema_attributes >@@ -0,0 +1,2 @@ >+^samba.tests.dsdb_schema_attributes.samba.tests.dsdb_schema_attributes.SchemaAttributesTestCase.test_modify_at_indexlist >+^samba.tests.dsdb_schema_attributes.samba.tests.dsdb_schema_attributes.SchemaAttributesTestCase.test_modify_at_attributes >\ No newline at end of file >-- >2.9.5 > > >From 09a8390ddd9ebb9aa1dee2ff379b59662840a205 Mon Sep 17 00:00:00 2001 >From: Andrew Bartlett <abartlet@samba.org> >Date: Mon, 11 Sep 2017 15:22:23 +1200 >Subject: [PATCH 2/2] schema: Rework dsdb_schema_set_indices_and_attributes() > db operations > >Commit ec9b1e881c3eef503d6b4b311594113acf7d47d8 did not fully fix this. > >There is no value in using dsdb_replace(), we are under the read lock >and replace just confuses things further. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13025 > >Signed-off-by: Andrew Bartlett <abartlet@samba.org> >Reviewed-by: Garming Sam <garming@catalyst.net.nz> >(cherry picked from commit 5d9bb80a027ba2b03c97d80c10173f946c758f69) >--- > selftest/knownfail.d/dsdb_schema_attributes | 2 -- > source4/dsdb/schema/schema_set.c | 17 +++++++++-------- > 2 files changed, 9 insertions(+), 10 deletions(-) > delete mode 100644 selftest/knownfail.d/dsdb_schema_attributes > >diff --git a/selftest/knownfail.d/dsdb_schema_attributes b/selftest/knownfail.d/dsdb_schema_attributes >deleted file mode 100644 >index 4242212..0000000 >--- a/selftest/knownfail.d/dsdb_schema_attributes >+++ /dev/null >@@ -1,2 +0,0 @@ >-^samba.tests.dsdb_schema_attributes.samba.tests.dsdb_schema_attributes.SchemaAttributesTestCase.test_modify_at_indexlist >-^samba.tests.dsdb_schema_attributes.samba.tests.dsdb_schema_attributes.SchemaAttributesTestCase.test_modify_at_attributes >\ No newline at end of file >diff --git a/source4/dsdb/schema/schema_set.c b/source4/dsdb/schema/schema_set.c >index cfd320b..8141e32 100644 >--- a/source4/dsdb/schema/schema_set.c >+++ b/source4/dsdb/schema/schema_set.c >@@ -175,11 +175,11 @@ int dsdb_schema_set_indices_and_attributes(struct ldb_context *ldb, > } > if (mod_msg->num_elements > 0) { > /* >- * Do the replace with the constructed message, >- * to avoid needing a lock between this search >- * and the replace >+ * Do the replace with the difference, as we >+ * are under the read lock and we wish to do a >+ * delete of any removed/renamed attributes > */ >- ret = dsdb_replace(ldb, msg, 0); >+ ret = dsdb_modify(ldb, mod_msg, 0); > } > talloc_free(mod_msg); > } >@@ -235,12 +235,13 @@ int dsdb_schema_set_indices_and_attributes(struct ldb_context *ldb, > * @SAMBA_FEATURES_SUPPORTED > */ > } else if (mod_msg->num_elements > 0) { >+ > /* >- * Do the replace with the constructed message, >- * to avoid needing a lock between this search >- * and the replace >+ * Do the replace with the difference, as we >+ * are under the read lock and we wish to do a >+ * delete of any removed/renamed attributes > */ >- ret = dsdb_replace(ldb, msg_idx, 0); >+ ret = dsdb_modify(ldb, mod_msg, 0); > } > talloc_free(mod_msg); > } >-- >2.9.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
metze
:
review+
Actions:
View
Attachments on
bug 13025
:
13580
| 13604