diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/python/py_common.c | 17 | ||||
-rw-r--r-- | source3/python/py_common.h | 2 |
2 files changed, 19 insertions, 0 deletions
diff --git a/source3/python/py_common.c b/source3/python/py_common.c index a24a6009d3..5c2e0f896c 100644 --- a/source3/python/py_common.c +++ b/source3/python/py_common.c @@ -19,6 +19,23 @@ */ #include "includes.h" +#include "Python.h" + +/* Return a tuple of (error code, error string) from a WERROR */ + +PyObject *py_werror_tuple(WERROR werror) +{ + return Py_BuildValue("is", W_ERROR_V(werror), + dos_errstr(werror)); +} + +/* Return a tuple of (error code, error string) from a WERROR */ + +PyObject *py_ntstatus_tuple(NTSTATUS ntstatus) +{ + return Py_BuildValue("is", NT_STATUS_V(ntstatus), + nt_errstr(ntstatus)); +} /* Initialise samba client routines */ diff --git a/source3/python/py_common.h b/source3/python/py_common.h index 1d2d4d6cd0..30a47eba25 100644 --- a/source3/python/py_common.h +++ b/source3/python/py_common.h @@ -24,5 +24,7 @@ /* Function prototypes */ void py_samba_init(void); +PyObject *py_werror_tuple(WERROR werror); +PyObject *py_ntstatus_tuple(NTSTATUS ntstatus); #endif /* _PY_COMMON_H */ |