summaryrefslogtreecommitdiff
path: root/lib/ldb
diff options
context:
space:
mode:
authorJoseph Sutton <josephsutton@catalyst.net.nz>2021-09-25 11:12:16 +1200
committerStefan Metzmacher <metze@samba.org>2021-10-26 14:22:09 +0000
commit6db664a07dab079c60fde9413e48bfd91edd6878 (patch)
tree92eb84882fc17cf2ad46d4f274f6d50d500ac8ca /lib/ldb
parentf4ca03b0cc2baab80ec45ae2f3d3f277a4a3c5b3 (diff)
downloadsamba-6db664a07dab079c60fde9413e48bfd91edd6878.tar.gz
pyldb: Fix deleting an ldb.Message dn
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 d7af772de88885f46708329ff7bb5798da91d2c7)
Diffstat (limited to 'lib/ldb')
-rw-r--r--lib/ldb/pyldb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index f1538b37c6b..ed62a396530 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -3741,6 +3741,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;