svn commit: samba r2790 - in
branches/SAMBA_4_0/source/scripting/swig: .
tpot at samba.org
tpot at samba.org
Sat Oct 2 23:35:51 GMT 2004
Author: tpot
Date: 2004-10-02 23:35:50 +0000 (Sat, 02 Oct 2004)
New Revision: 2790
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/scripting/swig&rev=2790&nolog=1
Log:
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.
Modified:
branches/SAMBA_4_0/source/scripting/swig/dcerpc.i
Changeset:
Modified: branches/SAMBA_4_0/source/scripting/swig/dcerpc.i
===================================================================
--- branches/SAMBA_4_0/source/scripting/swig/dcerpc.i 2004-10-02 15:28:16 UTC (rev 2789)
+++ branches/SAMBA_4_0/source/scripting/swig/dcerpc.i 2004-10-02 23:35:50 UTC (rev 2790)
@@ -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 @@
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 @@
%pythoncode %{
NTSTATUS = _dcerpc.NTSTATUS
+ WERROR = _dcerpc.WERROR
%}
%init %{
@@ -808,7 +817,9 @@
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,8 +866,10 @@
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
if (NT_STATUS_IS_ERR(result)) {
@@ -865,7 +878,17 @@
}
}
-%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"
More information about the samba-cvs
mailing list