summaryrefslogtreecommitdiffstats
path: root/source/python/py_common.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-04-05 04:47:43 +0000
committerTim Potter <tpot@samba.org>2002-04-05 04:47:43 +0000
commitcb243e2766260f03de6b748d20734b8183cf192b (patch)
treef36581b55d045b637d65a12329280752b20b90dc /source/python/py_common.c
parentf2a0e56b3c7b4bee21fc05efec0c0c738db44287 (diff)
downloadsamba-cb243e2766260f03de6b748d20734b8183cf192b.tar.gz
samba-cb243e2766260f03de6b748d20734b8183cf192b.tar.xz
samba-cb243e2766260f03de6b748d20734b8183cf192b.zip
Added functions to return Python tuples (error code, error string)
corresponding to NT and DOS errors.
Diffstat (limited to 'source/python/py_common.c')
-rw-r--r--source/python/py_common.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/python/py_common.c b/source/python/py_common.c
index a24a6009d3a..5c2e0f896cd 100644
--- a/source/python/py_common.c
+++ b/source/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 */