pyldb: Fix deleting an ldb.Control critical flag
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Fri, 24 Sep 2021 23:16:09 +0000 (11:16 +1200)
committerStefan Metzmacher <metze@samba.org>
Tue, 26 Oct 2021 12:00:28 +0000 (12:00 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14845

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 9d25a21d6024c6c2f8e4634f45e3944d8acbf8b8)

lib/ldb/pyldb.c
selftest/knownfail.d/python-segfaults

index e31d2d083bd1cfca02ad97fa4a4418bb429cae07..ff6c1c6f1abd399547604ab0d609a5f8770640e8 100644 (file)
@@ -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 {
index 0c6e52d63d4af29544c96f417c201c64954bb86f..d129dab7d474d0d121521c8529c7701fc90badef 100644 (file)
@@ -1,4 +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
-samba.tests.segfault.samba.tests.segfault.SegfaultTests.test_ldb_control_del_critical