summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2004-10-02 23:35:50 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:34 -0500
commita248164de5f89cef824f5a1f7d8618fbe81ae0c4 (patch)
tree58bf2ad871524cf5bd0363def1c18e8e694fbf6b /source4/scripting
parent54ae58fbcdf18d6d4b0ab2227099e6b7d7bb963e (diff)
downloadsamba-a248164de5f89cef824f5a1f7d8618fbe81ae0c4.tar.gz
samba-a248164de5f89cef824f5a1f7d8618fbe81ae0c4.tar.bz2
samba-a248164de5f89cef824f5a1f7d8618fbe81ae0c4.zip
r2790: Add code to generate WERROR exceptions. Arrange inclusion of autogenerated
interface files to divvy them up into pipes that return WERRORs and pipes that return NTSTATUS values. (This used to be commit 294d1ae35c09432a41e5a07a3aa1884bfb9a93be)
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/swig/dcerpc.i29
1 files changed, 26 insertions, 3 deletions
diff --git a/source4/scripting/swig/dcerpc.i b/source4/scripting/swig/dcerpc.i
index 5c3ce0ceec..9508dc805e 100644
--- a/source4/scripting/swig/dcerpc.i
+++ b/source4/scripting/swig/dcerpc.i
@@ -37,7 +37,7 @@
#undef strcpy
-PyObject *ntstatus_exception;
+PyObject *ntstatus_exception, *werror_exception;
/* Set up return of a dcerpc.NTSTATUS exception */
@@ -49,6 +49,14 @@ void set_ntstatus_exception(int status)
PyErr_SetObject(ntstatus_exception, obj);
}
+void set_werror_exception(int status)
+{
+ PyObject *obj = Py_BuildValue("(i,s)", status,
+ win_errstr(W_ERROR(status)));
+
+ PyErr_SetObject(werror_exception, obj);
+}
+
/* Conversion functions for scalar types */
uint8 uint8_from_python(PyObject *obj, char *name)
@@ -801,6 +809,7 @@ PyObject *DATA_BLOB_to_python(DATA_BLOB obj)
%pythoncode %{
NTSTATUS = _dcerpc.NTSTATUS
+ WERROR = _dcerpc.WERROR
%}
%init %{
@@ -808,7 +817,9 @@ PyObject *DATA_BLOB_to_python(DATA_BLOB obj)
lp_load(dyn_CONFIGFILE, True, False, False);
load_interfaces();
ntstatus_exception = PyErr_NewException("_dcerpc.NTSTATUS", NULL, NULL);
+ werror_exception = PyErr_NewException("_dcerpc.WERROR", NULL, NULL);
PyDict_SetItemString(d, "NTSTATUS", ntstatus_exception);
+ PyDict_SetItemString(d, "WERROR", werror_exception);
%}
%typemap(in, numinputs=0) struct dcerpc_pipe **OUT (struct dcerpc_pipe *temp_dcerpc_pipe) {
@@ -855,7 +866,9 @@ NTSTATUS dcerpc_pipe_connect(struct dcerpc_pipe **OUT,
const char *username,
const char *password);
-/* Run this test after each wrapped function */
+%include "librpc/gen_ndr/misc.i"
+
+/* Wrapped functions returning NTSTATUS */
%exception {
$action
@@ -865,7 +878,17 @@ NTSTATUS dcerpc_pipe_connect(struct dcerpc_pipe **OUT,
}
}
-%include "librpc/gen_ndr/misc.i"
%include "librpc/gen_ndr/lsa.i"
%include "librpc/gen_ndr/samr.i"
+
+/* Wrapped functions returning WERROR */
+
+%exception {
+ $action
+ if (!W_ERROR_IS_OK(arg3->out.result)) {
+ set_werror_exception(W_ERROR_V(arg3->out.result));
+ return NULL;
+ }
+}
+
%include "librpc/gen_ndr/winreg.i"