summaryrefslogtreecommitdiff
path: root/libgpo/pygpo.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2017-10-24 15:58:45 +1300
committerGarming Sam <garming@samba.org>2017-11-20 21:41:15 +0100
commit9339227eb98ad05fdb8d06d593db9b90e5f37844 (patch)
tree32556b9f46e4689caa9aa6fd56336ae7ecfa9521 /libgpo/pygpo.c
parent8be71f97b64cf95a2a980f5036e1bf689d2ba908 (diff)
downloadsamba-9339227eb98ad05fdb8d06d593db9b90e5f37844.tar.gz
pygpo: Check for errors in gpo.gpo_get_sysvol_gpt_version()
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'libgpo/pygpo.c')
-rw-r--r--libgpo/pygpo.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libgpo/pygpo.c b/libgpo/pygpo.c
index 3a31c59d6cc..757c713b027 100644
--- a/libgpo/pygpo.c
+++ b/libgpo/pygpo.c
@@ -25,6 +25,7 @@
#include "secrets.h"
#include "../libds/common/flags.h"
#include "auth/credentials/pycredentials.h"
+#include "libcli/util/pyerrors.h"
/* A Python C API module to use LIBGPO */
@@ -288,13 +289,22 @@ static PyObject *py_gpo_get_sysvol_gpt_version(PyObject * self, PyObject * args)
char *display_name = NULL;
uint32_t sysvol_version = 0;
PyObject *result;
+ NTSTATUS status;
tmp_ctx = talloc_new(NULL);
if (!PyArg_ParseTuple(args, "s", &unix_path)) {
return NULL;
}
- gpo_get_sysvol_gpt_version(tmp_ctx, unix_path, &sysvol_version, &display_name);
+ status = gpo_get_sysvol_gpt_version(tmp_ctx, unix_path,
+ &sysvol_version,
+ &display_name);
+ if (!NT_STATUS_IS_OK(status)) {
+ PyErr_SetNTSTATUS(status);
+ TALLOC_FREE(tmp_ctx);
+ return NULL;
+ }
+
talloc_free(tmp_ctx);
result = Py_BuildValue("[s,i]", display_name, sysvol_version);
return result;