From: Kristján Valur Date: Wed, 27 Feb 2019 16:03:16 +0000 (+0000) Subject: pygpo: Fix error handing when getting gpo unix path. X-Git-Tag: talloc-2.2.0~142 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8b316d102e0e864dde4ab39cc20b98f32216ff4;p=thirdparty%2Fsamba.git pygpo: Fix error handing when getting gpo unix path. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13822 Signed-off-by: Kristján Valur Jónsson Reviewed-by: Andrew Bartlett Reviewed-by: Noel Power --- diff --git a/libgpo/pygpo.c b/libgpo/pygpo.c index ceb60e886bb..7ae3de31973 100644 --- a/libgpo/pygpo.c +++ b/libgpo/pygpo.c @@ -74,7 +74,7 @@ static PyObject *py_gpo_get_unix_path(PyObject *self, PyObject *args, { NTSTATUS status; const char *cache_dir = NULL; - PyObject *ret = Py_None; + PyObject *ret = NULL; char *unix_path = NULL; TALLOC_CTX *frame = NULL; static const char *kwlist[] = {"cache_dir", NULL}; @@ -86,9 +86,6 @@ static PyObject *py_gpo_get_unix_path(PyObject *self, PyObject *args, if (!PyArg_ParseTupleAndKeywords(args, kwds, "|s", discard_const_p(char *, kwlist), &cache_dir)) { - PyErr_SetString(PyExc_RuntimeError, - "Failed to parse arguments to " - "gpo_get_unix_path()"); goto out; } @@ -104,8 +101,9 @@ static PyObject *py_gpo_get_unix_path(PyObject *self, PyObject *args, status = gpo_get_unix_path(frame, cache_dir, gpo_ptr, &unix_path); if (!NT_STATUS_IS_OK(status)) { - PyErr_SetString(PyExc_RuntimeError, - "Failed to determine gpo unix path"); + PyErr_Format(PyExc_RuntimeError, + "Failed to determine gpo unix path: %s", + get_friendly_nt_error_msg(status)); goto out; }