summaryrefslogtreecommitdiff
path: root/source3/python
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
commitf243d4e7c8bf1eb4c9356dd1447e5cee77ba6949 (patch)
tree58f470366126eeaf733b082f56e3357b59f83c95 /source3/python
parent562706b32bda551e2674db4f7dae3017a8259e13 (diff)
downloadsamba-f243d4e7c8bf1eb4c9356dd1447e5cee77ba6949.tar.gz
samba-f243d4e7c8bf1eb4c9356dd1447e5cee77ba6949.tar.bz2
samba-f243d4e7c8bf1eb4c9356dd1447e5cee77ba6949.zip
Added functions to return Python tuples (error code, error string)
corresponding to NT and DOS errors. (This used to be commit cb243e2766260f03de6b748d20734b8183cf192b)
Diffstat (limited to 'source3/python')
-rw-r--r--source3/python/py_common.c17
-rw-r--r--source3/python/py_common.h2
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 */