[SCM] Samba Shared Repository - branch master updated

Garming Sam garming at samba.org
Fri Dec 4 08:17:04 UTC 2015


The branch, master has been updated
       via  e153501 ldb torture: Test ldb unpacking and printing
       via  5137daa ldb: Move ldb_(un)pack_data into ldb_module.h for testing
       via  60dc26b ldb: Fix installation of _ldb_text.py
       via  2a55a0b Fix little typo in README file
       via  c505076 Fix propagation of LDB errors through TDB.
       via  99b2fd4 ldb: Fix bug triggered by having an empty message in database during search.
      from  c118fbc clitar: cope with functions of older versions of libarchive

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e153501474be47d8a6bdfa0dbf8fbb72ff74e319
Author: Adrian Cochrane <adrianc at catalyst.net.nz>
Date:   Tue Sep 1 09:54:09 2015 +1200

    ldb torture: Test ldb unpacking and printing
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11602
    Signed-off-by: Adrian Cochrane <adrianc at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    
    Autobuild-User(master): Garming Sam <garming at samba.org>
    Autobuild-Date(master): Fri Dec  4 09:16:22 CET 2015 on sn-devel-104

commit 5137daa10efe3f1b88dbf01bf6605cc37f4779f0
Author: Adrian Cochrane <adrianc at catalyst.net.nz>
Date:   Tue Sep 1 09:53:12 2015 +1200

    ldb: Move ldb_(un)pack_data into ldb_module.h for testing
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11602
    Signed-off-by: Adrian Cochrane <adrianc at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>

commit 60dc26bfe1573265dcbd87b9dd3439f945e57d97
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 3 12:07:27 2015 +0100

    ldb: Fix installation of _ldb_text.py
    
    _ldb_text.py is installed as part of the ldb package and also if you
    compile Samba with the system ldb version. This way we have have the
    file twice in the same location and run into file confilcts.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>

commit 2a55a0b370affaef0455320ddfd78bae4e413743
Author: Guillaume Gomez <guillaume1.gomez at gmail.com>
Date:   Thu Dec 3 16:01:05 2015 +0100

    Fix little typo in README file
    
    Reviewed-by: Bjoern Jacke <bj at sernet.de>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>

commit c505076422522f2b61bb7397d8dc56d309ce4570
Author: Adrian Cochrane <adrianc at catalyst.net.nz>
Date:   Thu Dec 3 16:30:59 2015 +1300

    Fix propagation of LDB errors through TDB.
    
    Returning a non-zero value from a tdb_traverse callback indicates that tdb_traverse
    should stop traversing the database. This error code IS NOT propagated back to the
    caller, so LTDB must record the error otherwise. This patch corrects LTDB for this
    misunderstanding.
    
    Naturally exposing these errors changes the behaviour of some tests. This commit fixes
    that as well.
    
    Signed-off-by: Adrian Cochrane <adrianc at catalyst.net.nz>
    Reviewed-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 99b2fd4f5be9dca1ef66c8a8096e3e75fee84a7f
Author: Adrian Cochrane <adrianc at catalyst.net.nz>
Date:   Wed Nov 18 15:25:20 2015 +1300

    ldb: Fix bug triggered by having an empty message in database during search.
    
    Previously if the message had 0 elements, Talloc would reallocate the projected
    array to NULL, fooling LDB into thinking that it failed to reallocate. This fix
    corrects LDB to be able to handle the case where the message has no attributes
    in common with the filter.
    
    Also the realloc call resized the array to the number of elements in the message,
    not the number of elements in common with the filter -- it essentially did nothing.
    
    Unlike talloc_realloc, talloc_array always returns a non-null pointer. This would
    help protect against possible errors.
    
    Signed-off-by: Adrian Cochrane <adrianc at catalyst.net.nz>
    Signed-off-by: Garming Sam <garming at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 README                             |   2 +-
 lib/ldb-samba/tests/match_rules.py | 116 ++++++++-----
 lib/ldb/include/ldb_module.h       |  12 ++
 lib/ldb/include/ldb_private.h      |  11 --
 lib/ldb/ldb_tdb/ldb_search.c       |  19 ++-
 lib/ldb/ldb_tdb/ldb_tdb.h          |   3 +
 lib/ldb/tests/python/api.py        |  29 +++-
 lib/ldb/wscript                    |  10 +-
 selftest/knownfail                 |   1 +
 source4/torture/ldb/ldb.c          | 333 +++++++++++++++++++++++++++++++++++++
 10 files changed, 470 insertions(+), 66 deletions(-)


Changeset truncated at 500 lines:

diff --git a/README b/README
index e3982d9..bdc1cb2 100644
--- a/README
+++ b/README
@@ -148,7 +148,7 @@ collection of information under docs/.
 A list of Samba documentation in languages other than English is
 available on the web page.
 
-If you would like to help with the documentation, please coodinate 
+If you would like to help with the documentation, please coordinate
 on the samba at samba.org mailing list.  See the next section for details 
 on subscribing to samba mailing lists.
 
diff --git a/lib/ldb-samba/tests/match_rules.py b/lib/ldb-samba/tests/match_rules.py
index 6b31392..1b30e9f 100755
--- a/lib/ldb-samba/tests/match_rules.py
+++ b/lib/ldb-samba/tests/match_rules.py
@@ -14,7 +14,7 @@ from samba.dcerpc import security, misc
 from samba.samdb import SamDB
 from samba.auth import system_session
 from samba.ndr import ndr_unpack
-from ldb import Message, MessageElement, Dn
+from ldb import Message, MessageElement, Dn, LdbError
 from ldb import FLAG_MOD_ADD, FLAG_MOD_REPLACE, FLAG_MOD_DELETE
 from ldb import SCOPE_BASE, SCOPE_SUBTREE
 
@@ -301,11 +301,14 @@ class MatchRulesTests(samba.tests.TestCase):
                         expression="memberOf=cn=g4,%s" % self.ou_groups)
         self.assertTrue(len(res1) == 0)
 
-        # Search with transitive match must return 1 results
-        res1 = self.ldb.search("cn=g4,%s" % self.ou_groups,
-                        scope=SCOPE_BASE,
-                        expression="member:1.2.840.113556.1.4.1941:=cn=u1,%s" % self.ou_users)
-        self.assertTrue(len(res1) == 1)
+        try:
+            # Search with transitive match must return 1 results
+            res1 = self.ldb.search("cn=g4,%s" % self.ou_groups,
+                            scope=SCOPE_BASE,
+                            expression="member:1.2.840.113556.1.4.1941:=cn=u1,%s" % self.ou_users)
+            self.assertTrue(len(res1) == 1)
+        except LdbError, err:
+            self.fail(str(err))
 
         res1 = self.ldb.search("cn=u1,%s" % self.ou_users,
                         scope=SCOPE_BASE,
@@ -324,11 +327,14 @@ class MatchRulesTests(samba.tests.TestCase):
                         expression="memberOf=cn=g4,%s" % self.ou_groups)
         self.assertTrue(len(res1) == 0)
 
-        # Search with transitive match must return 1 results
-        res1 = self.ldb.search("cn=g4,%s" % self.ou_groups,
-                        scope=SCOPE_BASE,
-                        expression="member:1.2.840.113556.1.4.1941:=cn=g1,%s" % self.ou_groups)
-        self.assertTrue(len(res1) == 1)
+        try:
+            # Search with transitive match must return 1 results
+            res1 = self.ldb.search("cn=g4,%s" % self.ou_groups,
+                            scope=SCOPE_BASE,
+                            expression="member:1.2.840.113556.1.4.1941:=cn=g1,%s" % self.ou_groups)
+            self.assertTrue(len(res1) == 1)
+        except LdbError, err:
+            self.fail(str(err))
 
         res1 = self.ldb.search("cn=g1,%s" % self.ou_groups,
                         scope=SCOPE_BASE,
@@ -341,10 +347,13 @@ class MatchRulesTests(samba.tests.TestCase):
                         expression="member=cn=u1,%s" % self.ou_users)
         self.assertTrue(len(res1) == 1)
 
-        res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=cn=u1,%s" % self.ou_users)
-        self.assertTrue(len(res1) == 4)
+        try:
+            res1 = self.ldb.search(self.ou_groups,
+                            scope=SCOPE_SUBTREE,
+                            expression="member:1.2.840.113556.1.4.1941:=cn=u1,%s" % self.ou_users)
+            self.assertTrue(len(res1) == 4)
+        except LdbError, err:
+            self.fail(str(err))
 
     def test_u2_groups(self):
         res1 = self.ldb.search(self.ou_groups,
@@ -352,10 +361,13 @@ class MatchRulesTests(samba.tests.TestCase):
                         expression="member=cn=u2,%s" % self.ou_users)
         self.assertTrue(len(res1) == 1)
 
-        res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=cn=u2,%s" % self.ou_users)
-        self.assertTrue(len(res1) == 3)
+        try:
+            res1 = self.ldb.search(self.ou_groups,
+                            scope=SCOPE_SUBTREE,
+                            expression="member:1.2.840.113556.1.4.1941:=cn=u2,%s" % self.ou_users)
+            self.assertTrue(len(res1) == 3)
+        except LdbError, err:
+            self.fail(str(err))
 
     def test_u3_groups(self):
         res1 = self.ldb.search(self.ou_groups,
@@ -363,10 +375,13 @@ class MatchRulesTests(samba.tests.TestCase):
                         expression="member=cn=u3,%s" % self.ou_users)
         self.assertTrue(len(res1) == 1)
 
-        res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=cn=u3,%s" % self.ou_users)
-        self.assertTrue(len(res1) == 2)
+        try:
+            res1 = self.ldb.search(self.ou_groups,
+                            scope=SCOPE_SUBTREE,
+                            expression="member:1.2.840.113556.1.4.1941:=cn=u3,%s" % self.ou_users)
+            self.assertTrue(len(res1) == 2)
+        except LdbError, err:
+            self.fail(str(err))
 
     def test_u4_groups(self):
         res1 = self.ldb.search(self.ou_groups,
@@ -374,10 +389,13 @@ class MatchRulesTests(samba.tests.TestCase):
                         expression="member=cn=u4,%s" % self.ou_users)
         self.assertTrue(len(res1) == 1)
 
-        res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=cn=u4,%s" % self.ou_users)
-        self.assertTrue(len(res1) == 1)
+        try:
+            res1 = self.ldb.search(self.ou_groups,
+                            scope=SCOPE_SUBTREE,
+                            expression="member:1.2.840.113556.1.4.1941:=cn=u4,%s" % self.ou_users)
+            self.assertTrue(len(res1) == 1)
+        except LdbError, err:
+            self.fail(str(err))
 
     def test_extended_dn(self):
         res1 = self.ldb.search("cn=u1,%s" % self.ou_users,
@@ -399,10 +417,13 @@ class MatchRulesTests(samba.tests.TestCase):
                         expression="member=<GUID=%s>" % guid)
         self.assertTrue(len(res1) == 1)
 
-        res1 = self.ldb.search(self.ou_groups,
-                        scope=SCOPE_SUBTREE,
-                        expression="member:1.2.840.113556.1.4.1941:=<SID=%s>" % sid)
-        self.assertTrue(len(res1) == 4)
+        try:
+            res1 = self.ldb.search(self.ou_groups,
+                            scope=SCOPE_SUBTREE,
+                            expression="member:1.2.840.113556.1.4.1941:=<SID=%s>" % sid)
+            self.assertTrue(len(res1) == 4)
+        except LdbError, err:
+            self.fail(str(err))
 
         res1 = self.ldb.search(self.ou_groups,
                         scope=SCOPE_SUBTREE,
@@ -415,10 +436,13 @@ class MatchRulesTests(samba.tests.TestCase):
                         expression="msDS-RevealedUsers=B:8:01010101:cn=c3,%s" % self.ou_computers)
         self.assertTrue(len(res1) == 1)
 
-        res1 = self.ldb.search(self.ou_computers,
-                        scope=SCOPE_SUBTREE,
-                        expression="msDS-RevealedUsers:1.2.840.113556.1.4.1941:=B:8:01010101:cn=c3,%s" % self.ou_computers)
-        self.assertTrue(len(res1) == 2)
+        try:
+            res1 = self.ldb.search(self.ou_computers,
+                            scope=SCOPE_SUBTREE,
+                            expression="msDS-RevealedUsers:1.2.840.113556.1.4.1941:=B:8:01010101:cn=c3,%s" % self.ou_computers)
+            self.assertTrue(len(res1) == 2)
+        except LdbError, err:
+            self.fail(str(err))
 
     def test_one_way_links(self):
         res1 = self.ldb.search(self.ou,
@@ -426,10 +450,13 @@ class MatchRulesTests(samba.tests.TestCase):
                         expression="addressBookRoots2=cn=c1,%s" % self.ou_computers)
         self.assertTrue(len(res1) == 1)
 
-        res1 = self.ldb.search(self.ou,
-                        scope=SCOPE_SUBTREE,
-                        expression="addressBookRoots2:1.2.840.113556.1.4.1941:=cn=c1,%s" % self.ou_computers)
-        self.assertTrue(len(res1) == 2)
+        try:
+            res1 = self.ldb.search(self.ou,
+                            scope=SCOPE_SUBTREE,
+                            expression="addressBookRoots2:1.2.840.113556.1.4.1941:=cn=c1,%s" % self.ou_computers)
+            self.assertTrue(len(res1) == 2)
+        except LdbError, err:
+            self.fail(str(err))
 
     def test_not_linked_attrs(self):
         res1 = self.ldb.search(self.base_dn,
@@ -437,10 +464,13 @@ class MatchRulesTests(samba.tests.TestCase):
                         expression="wellKnownObjects=B:32:aa312825768811d1aded00c04fd8d5cd:CN=computers,%s" % self.base_dn)
         self.assertTrue(len(res1) == 1)
 
-        res1 = self.ldb.search(self.base_dn,
-                        scope=SCOPE_BASE,
-                        expression="wellKnownObjects:1.2.840.113556.1.4.1941:=B:32:aa312825768811d1aded00c04fd8d5cd:CN=computers,%s" % self.base_dn)
-        self.assertTrue(len(res1) == 0)
+        try:
+            res1 = self.ldb.search(self.base_dn,
+                            scope=SCOPE_BASE,
+                            expression="wellKnownObjects:1.2.840.113556.1.4.1941:=B:32:aa312825768811d1aded00c04fd8d5cd:CN=computers,%s" % self.base_dn)
+            self.assertTrue(len(res1) == 0)
+        except LdbError, err:
+            self.fail(str(err))
 
 
 	res1 = self.ldb.search(self.ou,
diff --git a/lib/ldb/include/ldb_module.h b/lib/ldb/include/ldb_module.h
index 34e33c0..f00ba50 100644
--- a/lib/ldb/include/ldb_module.h
+++ b/lib/ldb/include/ldb_module.h
@@ -382,4 +382,16 @@ struct ldb_extended_match_rule
 int ldb_register_extended_match_rule(struct ldb_context *ldb,
 				     const struct ldb_extended_match_rule *rule);
 
+/*
+ * these pack/unpack functions are exposed in the library for use by
+ * ldb tools like ldbdump and for use in tests,
+ * but are not part of the public API
+ */
+int ldb_pack_data(struct ldb_context *ldb,
+		  const struct ldb_message *message,
+		  struct ldb_val *data);
+int ldb_unpack_data(struct ldb_context *ldb,
+		    const struct ldb_val *data,
+		    struct ldb_message *message);
+
 #endif
diff --git a/lib/ldb/include/ldb_private.h b/lib/ldb/include/ldb_private.h
index eef5e1b..26a9d42 100644
--- a/lib/ldb/include/ldb_private.h
+++ b/lib/ldb/include/ldb_private.h
@@ -201,17 +201,6 @@ char *ldb_ldif_write_redacted_trace_string(struct ldb_context *ldb, TALLOC_CTX *
 					   const struct ldb_ldif *ldif);
 
 /*
- * these pack/unpack functions are exposed in the library for use by
- * ldb tools like ldbdump, but are not part of the public API
- */
-int ldb_pack_data(struct ldb_context *ldb,
-		  const struct ldb_message *message,
-		  struct ldb_val *data);
-int ldb_unpack_data(struct ldb_context *ldb,
-		    const struct ldb_val *data,
-		    struct ldb_message *message);
-
-/*
  * Get the LDB context in use on an LDB DN.
  *
  * This is helpful to the python LDB code, which may use as part of
diff --git a/lib/ldb/ldb_tdb/ldb_search.c b/lib/ldb/ldb_tdb/ldb_search.c
index 1e7e7ea..62a36c7 100644
--- a/lib/ldb/ldb_tdb/ldb_search.c
+++ b/lib/ldb/ldb_tdb/ldb_search.c
@@ -407,10 +407,18 @@ int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs)
 	}
 
 	talloc_free(msg->elements);
-	msg->elements = talloc_realloc(msg, el2, struct ldb_message_element, msg->num_elements);
+
+	if (num_elements > 0) {
+		msg->elements = talloc_realloc(msg, el2, struct ldb_message_element,
+					       num_elements);
+	} else {
+		msg->elements = talloc_array(msg, struct ldb_message_element, 0);
+		talloc_free(el2);
+	}
 	if (msg->elements == NULL) {
 		return -1;
 	}
+
 	msg->num_elements = num_elements;
 
 	return 0;
@@ -437,6 +445,7 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
 
 	msg = ldb_msg_new(ac);
 	if (!msg) {
+		ac->error = LDB_ERR_OPERATIONS_ERROR;
 		return -1;
 	}
 
@@ -444,6 +453,7 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
 	ret = ldb_unpack_data(ldb, (struct ldb_val *)&data, msg);
 	if (ret == -1) {
 		talloc_free(msg);
+		ac->error = LDB_ERR_OPERATIONS_ERROR;
 		return -1;
 	}
 
@@ -452,6 +462,7 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
 				     (char *)key.dptr + 3);
 		if (msg->dn == NULL) {
 			talloc_free(msg);
+			ac->error = LDB_ERR_OPERATIONS_ERROR;
 			return -1;
 		}
 	}
@@ -461,6 +472,7 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
 				  ac->tree, ac->base, ac->scope, &matched);
 	if (ret != LDB_SUCCESS) {
 		talloc_free(msg);
+		ac->error = LDB_ERR_OPERATIONS_ERROR;
 		return -1;
 	}
 	if (!matched) {
@@ -473,6 +485,7 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
 
 	if (ret == -1) {
 		talloc_free(msg);
+		ac->error = LDB_ERR_OPERATIONS_ERROR;
 		return -1;
 	}
 
@@ -480,6 +493,7 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
 	if (ret != LDB_SUCCESS) {
 		ac->request_terminated = true;
 		/* the callback failed, abort the operation */
+		ac->error = LDB_ERR_OPERATIONS_ERROR;
 		return -1;
 	}
 
@@ -497,6 +511,7 @@ static int ltdb_search_full(struct ltdb_context *ctx)
 	struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
 	int ret;
 
+	ctx->error = LDB_SUCCESS;
 	if (ltdb->in_transaction != 0) {
 		ret = tdb_traverse(ltdb->tdb, search_func, ctx);
 	} else {
@@ -507,7 +522,7 @@ static int ltdb_search_full(struct ltdb_context *ctx)
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
 
-	return LDB_SUCCESS;
+	return ctx->error;
 }
 
 /*
diff --git a/lib/ldb/ldb_tdb/ldb_tdb.h b/lib/ldb/ldb_tdb/ldb_tdb.h
index 3521800..caa98eb 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb.h
+++ b/lib/ldb/ldb_tdb/ldb_tdb.h
@@ -48,6 +48,9 @@ struct ltdb_context {
 	enum ldb_scope scope;
 	const char * const *attrs;
 	struct tevent_timer *timeout_event;
+
+	/* error handling */
+	int error;
 };
 
 /* special record types */
diff --git a/lib/ldb/tests/python/api.py b/lib/ldb/tests/python/api.py
index cb65199..af1ff03 100755
--- a/lib/ldb/tests/python/api.py
+++ b/lib/ldb/tests/python/api.py
@@ -256,6 +256,23 @@ class SimpleLdb(TestCase):
         finally:
             l.delete(ldb.Dn(l, "dc=bar"))
 
+    def test_empty_dn(self):
+        l = ldb.Ldb(filename())
+        self.assertEqual(0, len(l.search()))
+        m = ldb.Message()
+        m.dn = ldb.Dn(l, "dc=empty")
+        l.add(m)
+        rm = l.search()
+        self.assertEqual(1, len(rm))
+        self.assertEqual(set(["dn", "distinguishedName"]), set(rm[0].keys()))
+
+        rm = l.search(m.dn)
+        self.assertEqual(1, len(rm))
+        self.assertEqual(set(["dn", "distinguishedName"]), set(rm[0].keys()))
+        rm = l.search(m.dn, attrs=["blah"])
+        self.assertEqual(1, len(rm))
+        self.assertEqual(0, len(rm[0]))
+
     def test_modify_delete(self):
         l = ldb.Ldb(filename())
         m = ldb.Message()
@@ -270,10 +287,12 @@ class SimpleLdb(TestCase):
             m["bla"] = ldb.MessageElement([], ldb.FLAG_MOD_DELETE, "bla")
             self.assertEqual(ldb.FLAG_MOD_DELETE, m["bla"].flags())
             l.modify(m)
-            rm = l.search(m.dn)[0]
+            rm = l.search(m.dn)
             self.assertEqual(1, len(rm))
+            self.assertEqual(set(["dn", "distinguishedName"]), set(rm[0].keys()))
             rm = l.search(m.dn, attrs=["bla"])
-            self.assertEqual(0, len(rm))
+            self.assertEqual(1, len(rm))
+            self.assertEqual(0, len(rm[0]))
         finally:
             l.delete(ldb.Dn(l, "dc=modifydelete"))
 
@@ -291,10 +310,12 @@ class SimpleLdb(TestCase):
             m["bla"] = ldb.MessageElement([], ldb.FLAG_MOD_DELETE, "bla")
             self.assertEqual(ldb.FLAG_MOD_DELETE, m["bla"].flags())
             l.modify(m)
-            rm = l.search(m.dn)[0]
+            rm = l.search(m.dn)
             self.assertEqual(1, len(rm))
+            self.assertEqual(set(["dn", "distinguishedName"]), set(rm[0].keys()))
             rm = l.search(m.dn, attrs=["bla"])
-            self.assertEqual(0, len(rm))
+            self.assertEqual(1, len(rm))
+            self.assertEqual(0, len(rm[0]))
         finally:
             l.delete(ldb.Dn(l, "dc=modifydelete"))
 
diff --git a/lib/ldb/wscript b/lib/ldb/wscript
index 41eca8a..6a6cd83 100755
--- a/lib/ldb/wscript
+++ b/lib/ldb/wscript
@@ -142,12 +142,12 @@ def build(bld):
                                      realname='ldb.so',
                                      cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
 
-        for env in bld.gen_python_environments(['PKGCONFIGDIR']):
-            bld.SAMBA_SCRIPT('_ldb_text.py',
-                             pattern='_ldb_text.py',
-                             installdir='python')
+            for env in bld.gen_python_environments(['PKGCONFIGDIR']):
+                bld.SAMBA_SCRIPT('_ldb_text.py',
+                                 pattern='_ldb_text.py',
+                                 installdir='python')
 
-            bld.INSTALL_FILES('${PYTHONARCHDIR}', '_ldb_text.py')
+                bld.INSTALL_FILES('${PYTHONARCHDIR}', '_ldb_text.py')
 
     if not bld.CONFIG_SET('USING_SYSTEM_LDB'):
         if bld.is_install:
diff --git a/selftest/knownfail b/selftest/knownfail
index d184f41..191d391 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -297,6 +297,7 @@
 #
 ^samba4.ldap.match_rules.python.__main__.MatchRulesTests.test_extended_dn
 ^samba4.ldap.match_rules.python.__main__.MatchRulesTests.test_g1_member_of_g4
+^samba4.ldap.match_rules.python.__main__.MatchRulesTests.test_not_linked_attrs
 ^samba4.ldap.match_rules.python.__main__.MatchRulesTests.test_object_dn_binary
 ^samba4.ldap.match_rules.python.__main__.MatchRulesTests.test_one_way_links
 ^samba4.ldap.match_rules.python.__main__.MatchRulesTests.test_u1_groups
diff --git a/source4/torture/ldb/ldb.c b/source4/torture/ldb/ldb.c
index fbf82d8..1abc9a9 100644
--- a/source4/torture/ldb/ldb.c
+++ b/source4/torture/ldb/ldb.c
@@ -22,7 +22,9 @@
 #include "includes.h"
 #include "lib/events/events.h"
 #include <ldb.h>
+#include <ldb-samba/ldb_wrap.h>
 #include <ldb_errors.h>
+#include <ldb_module.h>
 #include "lib/ldb-samba/ldif_handlers.h"
 #include "ldb_wrap.h"
 #include "dsdb/samdb/samdb.h"
@@ -39,6 +41,216 @@ static const char *hex_guid = "fac55a97d9351d43b86a845bcd34fff9";
 static const char *prefix_map_newline = "2:1.2.840.113556.1.2\n5:2.16.840.1.101.2.2.3";
 static const char *prefix_map_semi = "2:1.2.840.113556.1.2;5:2.16.840.1.101.2.2.3";
 
+/**
+ * This is the hex code derived from the tdbdump for
+ * "st/ad_dc/private/sam.ldb.d/DC=ADDC,DC=SAMBA,DC=EXAMPLE,DC=COM.ldb"
+ * key "DN=CN=DDA1D01D-4BD7-4C49-A184-46F9241B560E,CN=OPERATIONS,CN=DOMAINUPDATES,CN=SYSTEM,DC=ADDC,DC=SAMBA,DC=EXAMPLE,DC=COM\00"
+ *   -- adrianc
+ */
+
+static const uint8_t dda1d01d_bin[] = {
+	0x67, 0x19, 0x01, 0x26, 0x0d, 0x00, 0x00, 0x00, 0x43, 0x4e, 0x3d, 0x64, 0x64, 0x61, 0x31, 0x64,
+	0x30, 0x31, 0x64, 0x2d, 0x34, 0x62, 0x64, 0x37, 0x2d, 0x34, 0x63, 0x34, 0x39, 0x2d, 0x61, 0x31,
+	0x38, 0x34, 0x2d, 0x34, 0x36, 0x66, 0x39, 0x32, 0x34, 0x31, 0x62, 0x35, 0x36, 0x30, 0x65, 0x2c,
+	0x43, 0x4e, 0x3d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2c, 0x43, 0x4e,
+	0x3d, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x2c, 0x43,
+	0x4e, 0x3d, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2c, 0x44, 0x43, 0x3d, 0x61, 0x64, 0x64, 0x63,
+	0x2c, 0x44, 0x43, 0x3d, 0x73, 0x61, 0x6d, 0x62, 0x61, 0x2c, 0x44, 0x43, 0x3d, 0x65, 0x78, 0x61,
+	0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x44, 0x43, 0x3d, 0x63, 0x6f, 0x6d, 0x00, 0x6f, 0x62, 0x6a, 0x65,
+	0x63, 0x74, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+	0x74, 0x6f, 0x70, 0x00, 0x09, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
+	0x72, 0x00, 0x63, 0x6e, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x64, 0x64, 0x61,
+	0x31, 0x64, 0x30, 0x31, 0x64, 0x2d, 0x34, 0x62, 0x64, 0x37, 0x2d, 0x34, 0x63, 0x34, 0x39, 0x2d,
+	0x61, 0x31, 0x38, 0x34, 0x2d, 0x34, 0x36, 0x66, 0x39, 0x32, 0x34, 0x31, 0x62, 0x35, 0x36, 0x30,
+	0x65, 0x00, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x00, 0x01,
+	0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x34, 0x00, 0x77, 0x68, 0x65, 0x6e, 0x43, 0x72, 0x65,
+	0x61, 0x74, 0x65, 0x64, 0x00, 0x01, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x32, 0x30, 0x31,
+	0x35, 0x30, 0x37, 0x30, 0x38, 0x32, 0x32, 0x34, 0x33, 0x31, 0x30, 0x2e, 0x30, 0x5a, 0x00, 0x77,
+	0x68, 0x65, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x00, 0x01, 0x00, 0x00, 0x00, 0x11,
+	0x00, 0x00, 0x00, 0x32, 0x30, 0x31, 0x35, 0x30, 0x37, 0x30, 0x38, 0x32, 0x32, 0x34, 0x33, 0x31,
+	0x30, 0x2e, 0x30, 0x5a, 0x00, 0x75, 0x53, 0x4e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x00,
+	0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x33, 0x34, 0x36, 0x37, 0x00, 0x75, 0x53, 0x4e,
+	0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+	0x33, 0x34, 0x36, 0x37, 0x00, 0x73, 0x68, 0x6f, 0x77, 0x49, 0x6e, 0x41, 0x64, 0x76, 0x61, 0x6e,
+	0x63, 0x65, 0x64, 0x56, 0x69, 0x65, 0x77, 0x4f, 0x6e, 0x6c, 0x79, 0x00, 0x01, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x54, 0x52, 0x55, 0x45, 0x00, 0x6e, 0x54, 0x53, 0x65, 0x63, 0x75, 0x72,
+	0x69, 0x74, 0x79, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x00, 0x01, 0x00,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list