diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-09-14 13:24:07 -0700 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-09-14 13:24:07 -0700 |
commit | 5464ce6df678a6ce3022f4a30fd9553996cefb69 (patch) | |
tree | 86982aa8eda44b0de296f46171fdebb9a4be8597 /source4/lib/ldb/pyldb.c | |
parent | 72fcc6344f1ddfece4dd41790fc1add9c6d2c0f7 (diff) | |
parent | 3dd404abad878fa7e760ba50ce84fc80b82ea159 (diff) | |
download | samba-5464ce6df678a6ce3022f4a30fd9553996cefb69.tar.gz samba-5464ce6df678a6ce3022f4a30fd9553996cefb69.tar.bz2 samba-5464ce6df678a6ce3022f4a30fd9553996cefb69.zip |
Merge branch 'master' of /home/tridge/samba/git/combined
Diffstat (limited to 'source4/lib/ldb/pyldb.c')
-rw-r--r-- | source4/lib/ldb/pyldb.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c index 3f7fa2f395..b4f03dc538 100644 --- a/source4/lib/ldb/pyldb.c +++ b/source4/lib/ldb/pyldb.c @@ -1758,8 +1758,13 @@ static PyObject *py_ldb_msg_keys(PyLdbMessageObject *self) static PyObject *py_ldb_msg_getitem_helper(PyLdbMessageObject *self, PyObject *py_name) { struct ldb_message_element *el; - char *name = PyString_AsString(py_name); + char *name; struct ldb_message *msg = PyLdbMessage_AsMessage(self); + if (!PyString_Check(py_name)) { + PyErr_SetNone(PyExc_TypeError); + return NULL; + } + name = PyString_AsString(py_name); if (!strcmp(name, "dn")) return PyLdbDn_FromDn(msg->dn); el = ldb_msg_find_element(msg, name); @@ -1786,8 +1791,11 @@ static PyObject *py_ldb_msg_get(PyLdbMessageObject *self, PyObject *args) return NULL; ret = py_ldb_msg_getitem_helper(self, name); - if (ret == NULL) + if (ret == NULL) { + if (PyErr_Occurred()) + return NULL; Py_RETURN_NONE; + } return ret; } |