Skip to content

Commit

Permalink
pygpo: Fix error handing when getting gpo unix path.
Browse files Browse the repository at this point in the history
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13822
Signed-off-by: Kristján Valur Jónsson <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
Reviewed-by: Noel Power <[email protected]>
  • Loading branch information
Kristján Valur authored and Noel Power committed Mar 7, 2019
1 parent 08b5b11 commit a8b316d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions libgpo/pygpo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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;
}

Expand All @@ -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;
}

Expand Down

0 comments on commit a8b316d

Please sign in to comment.