mirror of
https://github.com/samba-team/samba.git
synced 2025-08-07 09:49:30 +03:00
pyldb: raise an exception if we can't add the attribute
This commit is contained in:
committed by
Matthieu Patou
parent
3213d1e0b7
commit
f05edc0ecb
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user