summaryrefslogtreecommitdiff
path: root/lib/ldb
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2012-01-02 19:25:56 -0800
committerMatthieu Patou <mat@samba.org>2012-01-03 06:47:10 +0100
commitf05edc0ecb9da2cb00a83b38d0be5812cc4ccf77 (patch)
treee0df3ca1d3a5703adfea5161aa31a280054b688c /lib/ldb
parent3213d1e0b770690b1a964f38fb57ebbcd8ce0746 (diff)
downloadsamba-f05edc0ecb9da2cb00a83b38d0be5812cc4ccf77.tar.gz
samba-f05edc0ecb9da2cb00a83b38d0be5812cc4ccf77.tar.bz2
samba-f05edc0ecb9da2cb00a83b38d0be5812cc4ccf77.zip
pyldb: raise an exception if we can't add the attribute
Diffstat (limited to 'lib/ldb')
-rw-r--r--lib/ldb/pyldb.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index b2315e6751..b253bcd28e 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -2668,12 +2668,17 @@ static int py_ldb_msg_setitem(PyLdbMessageObject *self, PyObject *name, PyObject
/* delitem */
ldb_msg_remove_attr(self->msg, attr_name);
} else {
+ int ret;
struct ldb_message_element *el = PyObject_AsMessageElement(self->msg,
value, 0, attr_name);
if (el == NULL)
return -1;
ldb_msg_remove_attr(pyldb_Message_AsMessage(self), attr_name);
- ldb_msg_add(pyldb_Message_AsMessage(self), el, el->flags);
+ ret = ldb_msg_add(pyldb_Message_AsMessage(self), el, el->flags);
+ if (ret != LDB_SUCCESS) {
+ PyErr_SetLdbError(PyExc_LdbError, ret, NULL);
+ return -1;
+ }
}
return 0;
}