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

Stefan Metzmacher metze at samba.org
Thu Oct 28 09:50:02 UTC 2021


The branch, v4-13-test has been updated
       via  74e65d7c06c ldb: Release ldb 2.2.1
       via  c532b425e73 pyldb: Make ldb.Message containment testing consistent with indexing
       via  64c41d30986 pyldb: Add tests for ldb.Message containment testing
       via  65f3e987675 pyldb: Raise TypeError for an invalid ldb.Message index
       via  4ff0a23a04b pyldb: Add test for an invalid ldb.Message index type
       via  f45e89e4326 s4/torture/drs/python: Fix attribute existence check
       via  4d1c5cc73b0 pyldb: Fix deleting an ldb.Control critical flag
       via  5e9441d55f6 pytest:segfault: Add test for deleting an ldb.Control critical flag
       via  a2e0682d928 pyldb: Fix deleting an ldb.Message dn
       via  d2189833c7e pytest:segfault: Add test for deleting an ldb.Message dn
       via  c7c10298973 Fix Python docstrings
       via  0c36416e319 pyldb: Avoid use-after-free in msg_diff()
       via  400d04533ab ldb_msg: Don't fail in ldb_msg_copy() if source DN is NULL
       via  f47f0f9f459 pytest:segfault: Add test for ldb.msg_diff()
      from  0cea7f53c01 lib/krb5_wrap: Fix missing error check in new salt code

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


- Log -----------------------------------------------------------------
commit 74e65d7c06c5eda79105f43d87efcaec09dfbb77
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Oct 4 21:57:25 2021 +1300

    ldb: Release ldb 2.2.1
    
    * Corrected python behaviour for 'in' for LDAP attributes
      contained as part of ldb.Message (bug 14845)
    * Fix memory handling in ldb.msg_diff (bug 14836)
    * Corrected python docstrings
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14845
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14836
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14848
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14881
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(v4-14-test): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(v4-14-test): Tue Oct 26 13:03:37 UTC 2021 on sn-devel-184
    
    Autobuild-User(v4-13-test): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(v4-13-test): Thu Oct 28 09:49:45 UTC 2021 on sn-devel-184

commit c532b425e739a5a6860e37fd616dc5293cea0f37
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Sat Sep 25 14:39:59 2021 +1200

    pyldb: Make ldb.Message containment testing consistent with indexing
    
    Previously, containment testing using the 'in' operator was handled by
    performing an equality comparison between the chosen object and each of
    the message's keys in turn. This behaviour was prone to errors due to
    not considering differences in case between otherwise equal elements, as
    the indexing operations do.
    
    Containment testing should now be more consistent with the indexing
    operations and with the get() method of ldb.Message.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14845
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14848
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 860d8902a9c502d4be83396598cf4a53c80fea69)

commit 64c41d30986a34b3311bc03ffce9a8856c7f4f18
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Sat Sep 25 13:48:57 2021 +1200

    pyldb: Add tests for ldb.Message containment testing
    
    These tests verify that the 'in' operator on ldb.Message is consistent
    with indexing and the get() method. This means that the 'dn' element
    should always be present, lookups should be case-insensitive, and use of
    an invalid type should result in a TypeError.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14845
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14848
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 865fe238599a732360b77e06e592cb85d459acf8)

commit 65f3e987675d378afd7df4445d04c86d83cde853
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Sat Sep 25 13:39:56 2021 +1200

    pyldb: Raise TypeError for an invalid ldb.Message index
    
    Previously, a TypeError was raised and subsequently overridden by a
    KeyError.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14845
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14848
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 22353767ca75af9d9e8fa1e7da372dcb5eddfcb7)

commit 4ff0a23a04b230bab3454cf88d317304df2cb5cb
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Sat Sep 25 13:22:05 2021 +1200

    pyldb: Add test for an invalid ldb.Message index type
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14845
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14848
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit b018e51d2725a23b2fedd3058644b8021f6a6a06)

commit f45e89e4326666644b5c569808f29d27a537e07f
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Sat Sep 25 19:18:39 2021 +1200

    s4/torture/drs/python: Fix attribute existence check
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14845
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14848
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit fb758c32e7633178f42dc2c031667b10c2ca6e90)

commit 4d1c5cc73b0c9eee33231713e527792a59c1d364
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Sat Sep 25 11:16:09 2021 +1200

    pyldb: Fix deleting an ldb.Control critical flag
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14845
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14848
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    (cherry picked from commit 9d25a21d6024c6c2f8e4634f45e3944d8acbf8b8)

commit 5e9441d55f6b3ddd2c7b4945754f317123b1d318
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Sat Sep 25 11:13:02 2021 +1200

    pytest:segfault: Add test for deleting an ldb.Control critical flag
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14845
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14848
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    [abartlet at samba.org backported from commit b1adaa517c1237a473bdcf818523f5107df3d6b0
     as @no_gdb_backtrace is not in Samba 4.14]

commit a2e0682d928678f2d9538fc861cba08413e54446
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Sat Sep 25 11:12:16 2021 +1200

    pyldb: Fix deleting an ldb.Message dn
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14845
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14848
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    [abartlet at samba.org backported from commit d7af772de88885f46708329ff7bb5798da91d2c7
     due to conflicts in knownfail.d/python-segfaults]

commit d2189833c7ede6ac2cd919c80aaadac14a0a193a
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Sat Sep 25 10:56:25 2021 +1200

    pytest:segfault: Add test for deleting an ldb.Message dn
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14845
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14848
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    [abartlet at samba.org backported from commit 6a041f6a99c39632d5c32e9d53b06719c20bef2c
     as other segfaulting tests are listed in knownfail.d/python-segfaults
     and @no_gdb_backtrace is not in 4.14]

commit c7c10298973fbf5b234b372d00296e2d400973a9
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Wed Apr 28 16:48:55 2021 +1200

    Fix Python docstrings
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14848
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Sat Sep  4 00:55:32 UTC 2021 on sn-devel-184
    
    (cherry picked from commit 02b187303369d3ce0c19dfb72ffa78f86a3911f0)

commit 0c36416e319e307022d11a915a4ac508c0ab2eea
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Mon Sep 13 11:15:17 2021 +1200

    pyldb: Avoid use-after-free in msg_diff()
    
    Make a deep copy of the message elements in msg_diff() so that if either
    of the input messages are deallocated early, the result does not refer
    to non-existing elements.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14645
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14836
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14848
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    
    [abartlet at samba.org backported from commit
     19a2af02f57d99db8ed3c6b028c3abdf4b553700 due to conflicts in
     the knownfail.d/python-segfaults file]
    
    Autobuild-User(v4-14-test): Jule Anger <janger at samba.org>
    Autobuild-Date(v4-14-test): Wed Sep 29 13:14:22 UTC 2021 on sn-devel-184

commit 400d04533ab3525f29721dffa137faf096c274e8
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Tue Sep 14 11:08:41 2021 +1200

    ldb_msg: Don't fail in ldb_msg_copy() if source DN is NULL
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14645
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14836
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14848
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    (cherry picked from commit c2bbe774ce03661666a1f48922a9ab681ef4f64b)

commit f47f0f9f4595ab9e83479b493a1110e602aee4fc
Author: Joseph Sutton <josephsutton at catalyst.net.nz>
Date:   Mon Sep 13 11:34:56 2021 +1200

    pytest:segfault: Add test for ldb.msg_diff()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14645
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14836
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14848
    
    Signed-off-by: Joseph Sutton <josephsutton at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    
    [abartlet at samba.org backported form from commit
    a99a76722d6046a5d63032e3d2bb3f791da948a6 due to conflicts
    with other new segfault tests]

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

Summary of changes:
 lib/ldb/ABI/{ldb-2.0.5.sigs => ldb-2.2.2.sigs}     |  0
 ...pyldb-util-2.1.0.sigs => pyldb-util-2.2.2.sigs} |  0
 lib/ldb/common/ldb_msg.c                           |  6 +-
 lib/ldb/pyldb.c                                    | 69 ++++++++++++++++------
 lib/ldb/tests/python/api.py                        | 29 +++++++++
 lib/ldb/wscript                                    |  2 +-
 lib/tdb/pytdb.c                                    |  2 +-
 lib/tevent/pytevent.c                              |  2 +-
 python/samba/tests/segfault.py                     | 23 ++++++++
 selftest/knownfail.d/python-segfaults              |  2 +
 source4/librpc/ndr/py_security.c                   |  2 +-
 source4/torture/drs/python/replica_sync.py         |  2 +-
 12 files changed, 115 insertions(+), 24 deletions(-)
 copy lib/ldb/ABI/{ldb-2.0.5.sigs => ldb-2.2.2.sigs} (100%)
 copy lib/ldb/ABI/{pyldb-util-2.1.0.sigs => pyldb-util-2.2.2.sigs} (100%)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/ABI/ldb-2.0.5.sigs b/lib/ldb/ABI/ldb-2.2.2.sigs
similarity index 100%
copy from lib/ldb/ABI/ldb-2.0.5.sigs
copy to lib/ldb/ABI/ldb-2.2.2.sigs
diff --git a/lib/ldb/ABI/pyldb-util-2.1.0.sigs b/lib/ldb/ABI/pyldb-util-2.2.2.sigs
similarity index 100%
copy from lib/ldb/ABI/pyldb-util-2.1.0.sigs
copy to lib/ldb/ABI/pyldb-util-2.2.2.sigs
diff --git a/lib/ldb/common/ldb_msg.c b/lib/ldb/common/ldb_msg.c
index 2346e66ec39..7131f013f71 100644
--- a/lib/ldb/common/ldb_msg.c
+++ b/lib/ldb/common/ldb_msg.c
@@ -876,8 +876,10 @@ struct ldb_message *ldb_msg_copy(TALLOC_CTX *mem_ctx,
 	msg2 = ldb_msg_copy_shallow(mem_ctx, msg);
 	if (msg2 == NULL) return NULL;
 
-	msg2->dn = ldb_dn_copy(msg2, msg2->dn);
-	if (msg2->dn == NULL) goto failed;
+	if (msg2->dn != NULL) {
+		msg2->dn = ldb_dn_copy(msg2, msg2->dn);
+		if (msg2->dn == NULL) goto failed;
+	}
 
 	for (i=0;i<msg2->num_elements;i++) {
 		struct ldb_message_element *el = &msg2->elements[i];
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index 813cdb0870e..d093daedf5c 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -182,6 +182,10 @@ static PyObject *py_ldb_control_get_critical(PyLdbControlObject *self,
 
 static int py_ldb_control_set_critical(PyLdbControlObject *self, PyObject *value, void *closure)
 {
+	if (value == NULL) {
+		PyErr_SetString(PyExc_AttributeError, "cannot delete critical flag");
+		return -1;
+	}
 	if (PyObject_IsTrue(value)) {
 		self->data->critical = true;
 	} else {
@@ -839,7 +843,7 @@ static PyMethodDef py_ldb_dn_methods[] = {
 		"S.get_component_value(num) -> string\n"
 		"get the attribute value of the specified component as a binary string" },
 	{ "set_component", (PyCFunction)py_ldb_dn_set_component, METH_VARARGS,
-		"S.get_component_value(num, name, value) -> None\n"
+		"S.set_component(num, name, value) -> None\n"
 		"set the attribute name and value of the specified component" },
 	{ "get_rdn_name", (PyCFunction)py_ldb_dn_get_rdn_name, METH_NOARGS,
 		"S.get_rdn_name() -> string\n"
@@ -1804,6 +1808,7 @@ static PyObject *py_ldb_msg_diff(PyLdbObject *self, PyObject *args)
 	struct ldb_message *diff;
 	struct ldb_context *ldb;
 	PyObject *py_ret;
+	TALLOC_CTX *mem_ctx = NULL;
 
 	if (!PyArg_ParseTuple(args, "OO", &py_msg_old, &py_msg_new))
 		return NULL;
@@ -1818,19 +1823,32 @@ static PyObject *py_ldb_msg_diff(PyLdbObject *self, PyObject *args)
 		return NULL;
 	}
 
+	mem_ctx = talloc_new(NULL);
+	if (mem_ctx == NULL) {
+		PyErr_NoMemory();
+		return NULL;
+	}
+
 	ldb = pyldb_Ldb_AS_LDBCONTEXT(self);
-	ldb_ret = ldb_msg_difference(ldb, ldb,
+	ldb_ret = ldb_msg_difference(ldb, mem_ctx,
 	                             pyldb_Message_AsMessage(py_msg_old),
 	                             pyldb_Message_AsMessage(py_msg_new),
 	                             &diff);
 	if (ldb_ret != LDB_SUCCESS) {
+		talloc_free(mem_ctx);
 		PyErr_SetString(PyExc_RuntimeError, "Failed to generate the Ldb Message diff");
 		return NULL;
 	}
 
+	diff = ldb_msg_copy(mem_ctx, diff);
+	if (diff == NULL) {
+		PyErr_NoMemory();
+		return NULL;
+	}
+
 	py_ret = PyLdbMessage_FromMessage(diff);
 
-	talloc_unlink(ldb, diff);
+	talloc_free(mem_ctx);
 
 	return py_ret;
 }
@@ -3415,33 +3433,41 @@ static PyObject *py_ldb_msg_keys(PyLdbMessageObject *self,
 	return obj;
 }
 
-static PyObject *py_ldb_msg_getitem_helper(PyLdbMessageObject *self, PyObject *py_name)
+static int py_ldb_msg_contains(PyLdbMessageObject *self, PyObject *py_name)
 {
-	struct ldb_message_element *el;
-	const char *name;
+	struct ldb_message_element *el = NULL;
+	const char *name = NULL;
 	struct ldb_message *msg = pyldb_Message_AsMessage(self);
 	name = PyUnicode_AsUTF8(py_name);
 	if (name == NULL) {
-		PyErr_SetNone(PyExc_TypeError);
-		return NULL;
+		return -1;
 	}
-	if (!ldb_attr_cmp(name, "dn"))
-		return pyldb_Dn_FromDn(msg->dn);
-	el = ldb_msg_find_element(msg, name);
-	if (el == NULL) {
-		return NULL;
+	if (!ldb_attr_cmp(name, "dn")) {
+		return 1;
 	}
-	return (PyObject *)PyLdbMessageElement_FromMessageElement(el, msg->elements);
+	el = ldb_msg_find_element(msg, name);
+	return el != NULL ? 1 : 0;
 }
 
 static PyObject *py_ldb_msg_getitem(PyLdbMessageObject *self, PyObject *py_name)
 {
-	PyObject *ret = py_ldb_msg_getitem_helper(self, py_name);
-	if (ret == NULL) {
+	struct ldb_message_element *el = NULL;
+	const char *name = NULL;
+	struct ldb_message *msg = pyldb_Message_AsMessage(self);
+	name = PyUnicode_AsUTF8(py_name);
+	if (name == NULL) {
+		return NULL;
+	}
+	if (!ldb_attr_cmp(name, "dn")) {
+		return pyldb_Dn_FromDn(msg->dn);
+	}
+	el = ldb_msg_find_element(msg, name);
+	if (el == NULL) {
 		PyErr_SetString(PyExc_KeyError, "No such element");
 		return NULL;
 	}
-	return ret;
+
+	return PyLdbMessageElement_FromMessageElement(el, msg->elements);
 }
 
 static PyObject *py_ldb_msg_get(PyLdbMessageObject *self, PyObject *args, PyObject *kwargs)
@@ -3651,6 +3677,10 @@ static Py_ssize_t py_ldb_msg_length(PyLdbMessageObject *self)
 	return pyldb_Message_AsMessage(self)->num_elements;
 }
 
+static PySequenceMethods py_ldb_msg_sequence = {
+	.sq_contains = (objobjproc)py_ldb_msg_contains,
+};
+
 static PyMappingMethods py_ldb_msg_mapping = {
 	.mp_length = (lenfunc)py_ldb_msg_length,
 	.mp_subscript = (binaryfunc)py_ldb_msg_getitem,
@@ -3727,6 +3757,10 @@ static PyObject *py_ldb_msg_get_dn(PyLdbMessageObject *self, void *closure)
 static int py_ldb_msg_set_dn(PyLdbMessageObject *self, PyObject *value, void *closure)
 {
 	struct ldb_message *msg = pyldb_Message_AsMessage(self);
+	if (value == NULL) {
+		PyErr_SetString(PyExc_AttributeError, "cannot delete dn");
+		return -1;
+	}
 	if (!pyldb_Dn_Check(value)) {
 		PyErr_SetString(PyExc_TypeError, "expected dn");
 		return -1;
@@ -3824,6 +3858,7 @@ static PyTypeObject PyLdbMessage = {
 	.tp_name = "ldb.Message",
 	.tp_methods = py_ldb_msg_methods,
 	.tp_getset = py_ldb_msg_getset,
+	.tp_as_sequence = &py_ldb_msg_sequence,
 	.tp_as_mapping = &py_ldb_msg_mapping,
 	.tp_basicsize = sizeof(PyLdbMessageObject),
 	.tp_dealloc = (destructor)py_ldb_msg_dealloc,
diff --git a/lib/ldb/tests/python/api.py b/lib/ldb/tests/python/api.py
index 1d3d765e607..675b5859af8 100755
--- a/lib/ldb/tests/python/api.py
+++ b/lib/ldb/tests/python/api.py
@@ -3056,6 +3056,12 @@ class LdbMsgTests(TestCase):
     def test_notpresent(self):
         self.assertRaises(KeyError, lambda: self.msg["foo"])
 
+    def test_invalid(self):
+        try:
+            self.assertRaises(TypeError, lambda: self.msg[42])
+        except KeyError:
+            self.fail()
+
     def test_del(self):
         del self.msg["foo"]
 
@@ -3171,6 +3177,29 @@ class LdbMsgTests(TestCase):
     def test_get_unknown_text(self):
         self.assertEqual(None, self.msg.text.get("lalalala"))
 
+    def test_contains(self):
+        self.msg['foo'] = ['bar']
+        self.assertIn('foo', self.msg)
+
+        self.msg['Foo'] = ['bar']
+        self.assertIn('Foo', self.msg)
+
+    def test_contains_case(self):
+        self.msg['foo'] = ['bar']
+        self.assertIn('Foo', self.msg)
+
+        self.msg['Foo'] = ['bar']
+        self.assertIn('foo', self.msg)
+
+    def test_contains_dn(self):
+        self.assertIn('dn', self.msg)
+
+    def test_contains_dn_case(self):
+        self.assertIn('DN', self.msg)
+
+    def test_contains_invalid(self):
+        self.assertRaises(TypeError, lambda: None in self.msg)
+
     def test_msg_diff(self):
         l = ldb.Ldb()
         msgs = l.parse_ldif("dn: foo=bar\nfoo: bar\nbaz: do\n\ndn: foo=bar\nfoo: bar\nbaz: dont\n")
diff --git a/lib/ldb/wscript b/lib/ldb/wscript
index 164065ab79a..b2bb923379f 100644
--- a/lib/ldb/wscript
+++ b/lib/ldb/wscript
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 APPNAME = 'ldb'
-VERSION = '2.2.1'
+VERSION = '2.2.2'
 
 import sys, os
 
diff --git a/lib/tdb/pytdb.c b/lib/tdb/pytdb.c
index 2ea2042c1e5..e2f8ace227f 100644
--- a/lib/tdb/pytdb.c
+++ b/lib/tdb/pytdb.c
@@ -577,7 +577,7 @@ static PyMethodDef tdb_object_methods[] = {
 	{ "add_flags", (PyCFunction)obj_add_flags, METH_VARARGS, "S.add_flags(flags) -> None" },
 	{ "remove_flags", (PyCFunction)obj_remove_flags, METH_VARARGS, "S.remove_flags(flags) -> None" },
 #if PY_MAJOR_VERSION >= 3
-	{ "keys", (PyCFunction)tdb_object_iter, METH_NOARGS, "S.iterkeys() -> iterator" },
+	{ "keys", (PyCFunction)tdb_object_iter, METH_NOARGS, "S.keys() -> iterator" },
 #else
 	{ "iterkeys", (PyCFunction)tdb_object_iter, METH_NOARGS, "S.iterkeys() -> iterator" },
 #endif
diff --git a/lib/tevent/pytevent.c b/lib/tevent/pytevent.c
index 93375f71868..62dfe2419ff 100644
--- a/lib/tevent/pytevent.c
+++ b/lib/tevent/pytevent.c
@@ -573,7 +573,7 @@ static PyMethodDef py_tevent_context_methods[] = {
 	{ "add_timer", (PyCFunction)py_tevent_context_add_timer,
 		METH_VARARGS, "S.add_timer(next_event, handler) -> timer" },
 	{ "add_timer_offset", (PyCFunction)py_tevent_context_add_timer_offset,
-		METH_VARARGS, "S.add_timer(offset_seconds, handler) -> timer" },
+		METH_VARARGS, "S.add_timer_offset(offset_seconds, handler) -> timer" },
 	{ "add_fd", (PyCFunction)py_tevent_context_add_fd, 
 		METH_VARARGS, "S.add_fd(fd, flags, handler) -> fd" },
 	{0},
diff --git a/python/samba/tests/segfault.py b/python/samba/tests/segfault.py
index 07e2d46d56a..62b51e71794 100644
--- a/python/samba/tests/segfault.py
+++ b/python/samba/tests/segfault.py
@@ -174,3 +174,26 @@ class SegfaultTests(samba.tests.TestCase):
     def test_dcerpc_idl_inline_arrays(self):
         """Inline arrays were incorrectly handled."""
         dnsserver.DNS_RPC_SERVER_INFO_DOTNET().pExtensions
+
+    @segfault_detector
+    def test_ldb_msg_diff(self):
+        samdb = self.get_samdb()
+
+        msg = ldb.Message()
+        msg.dn = ldb.Dn(samdb, '')
+        diff = samdb.msg_diff(msg, msg)
+
+        del msg
+        diff.dn
+
+    @segfault_detector
+    def test_ldb_msg_del_dn(self):
+        msg = ldb.Message()
+        del msg.dn
+
+    @segfault_detector
+    def test_ldb_control_del_critical(self):
+        samdb = self.get_samdb()
+
+        c = ldb.Control(samdb, 'relax:1')
+        del c.critical
diff --git a/selftest/knownfail.d/python-segfaults b/selftest/knownfail.d/python-segfaults
index 1be0566dcb1..d129dab7d47 100644
--- a/selftest/knownfail.d/python-segfaults
+++ b/selftest/knownfail.d/python-segfaults
@@ -1 +1,3 @@
 samba.tests.segfault.samba.tests.segfault.SegfaultTests.test_net_replicate_init__3
+samba.tests.segfault.samba.tests.segfault.SegfaultTests.test_dnsp_string_list
+samba.tests.segfault.samba.tests.segfault.SegfaultTests.test_dns_record
diff --git a/source4/librpc/ndr/py_security.c b/source4/librpc/ndr/py_security.c
index d4a2cd4f6f7..cb2a26aecc4 100644
--- a/source4/librpc/ndr/py_security.c
+++ b/source4/librpc/ndr/py_security.c
@@ -447,7 +447,7 @@ static PyMethodDef py_token_extra_methods[] = {
 	{ "has_sid", (PyCFunction)py_token_has_sid, METH_VARARGS,
 		NULL },
 	{ "is_anonymous", (PyCFunction)py_token_is_anonymous, METH_NOARGS,
-		"S.is_anonymus() -> bool\n"
+		"S.is_anonymous() -> bool\n"
 		"Check whether this is an anonymous token." },
 	{ "is_system", (PyCFunction)py_token_is_system, METH_NOARGS,
 		NULL },
diff --git a/source4/torture/drs/python/replica_sync.py b/source4/torture/drs/python/replica_sync.py
index ad03d1b061e..62545be6fee 100644
--- a/source4/torture/drs/python/replica_sync.py
+++ b/source4/torture/drs/python/replica_sync.py
@@ -140,7 +140,7 @@ objectClass: organizationalUnit
         # now check properties of the user
         name_cur = ou_cur["ou"][0]
         self.assertEqual(ou_cur["isDeleted"][0], b"TRUE")
-        self.assertTrue(not(b"objectCategory" in ou_cur))
+        self.assertTrue(not("objectCategory" in ou_cur))
         self.assertTrue(dodn in str(ou_cur["dn"]),
                         "OU %s is deleted but it is not located under %s!" % (name_cur, dodn))
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list