summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2013-09-22 19:26:10 -0700
committerMichael Adam <obnox@samba.org>2013-09-24 07:44:29 +0200
commitd787f7af4979ed80aad07db928d1ae84eaaef35a (patch)
treed5f85a555ae81359882f41eaac2cb20450ee7e28
parent51101b310adedb4eeb4c4382e631594ffa679ff2 (diff)
downloadsamba-d787f7af4979ed80aad07db928d1ae84eaaef35a.tar.gz
samba-d787f7af4979ed80aad07db928d1ae84eaaef35a.tar.bz2
samba-d787f7af4979ed80aad07db928d1ae84eaaef35a.zip
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>
-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 793c49522b..ee02483acd 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);