summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2013-09-22 19:26:10 -0700
committerKarolin Seeger <kseeger@samba.org>2013-09-27 09:28:59 +0200
commit2c4f2c598f1bf5cedfe55e0b173bb88236da305f (patch)
tree107c33a071273b790fbcaa763f36b3ad71c9826d
parentc3e535362f6ad3c6940c96b061dd00d52d7bfb76 (diff)
downloadsamba-2c4f2c598f1bf5cedfe55e0b173bb88236da305f.tar.gz
pydsdb: Raise a more useful exception when dsdb_wellknown_dn fails.
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> (cherry picked from commit d787f7af4979ed80aad07db928d1ae84eaaef35a)
-rw-r--r--source4/dsdb/pydsdb.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c
index 793c49522b0..ee02483acd4 100644
--- a/source4/dsdb/pydsdb.c
+++ b/source4/dsdb/pydsdb.c
@@ -981,6 +981,11 @@ static PyObject *py_dsdb_get_wellknown_dn(PyObject *self, PyObject *args)
PyErr_LDB_DN_OR_RAISE(py_nc_dn, nc_dn);
ret = dsdb_wellknown_dn(ldb, ldb, nc_dn, wkguid, &wk_dn);
+ if (ret == LDB_ERR_NO_SUCH_OBJECT) {
+ PyErr_Format(PyExc_KeyError, "Failed to find well known DN for GUID %s", wkguid);
+ return NULL;
+ }
+
PyErr_LDB_ERROR_IS_ERR_RAISE(py_ldb_get_exception(), ret, ldb);
py_wk_dn = pyldb_Dn_FromDn(wk_dn);