From 68aad436e61fa0a429ee1aaf51f43e091f195fe5 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 6 Sep 2004 11:09:27 +0000 Subject: r2236: Zero request structure to let the REF_ALLOC flag work its magic. Add argout typemap which throws an exception if NTSTATUS != OK and creates a dictionary of return values. samr_Connect2 function now works! (This used to be commit fdfabbd4a597b0d9b44832fdbfc200f857728c2b) --- source4/scripting/swig/samr.i | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'source4/scripting/swig') diff --git a/source4/scripting/swig/samr.i b/source4/scripting/swig/samr.i index 030f5defc2..89144a29d0 100644 --- a/source4/scripting/swig/samr.i +++ b/source4/scripting/swig/samr.i @@ -29,10 +29,31 @@ const int DCERPC_SAMR_VERSION = 1.0; PyErr_SetString(PyExc_TypeError, "dict arg expected"); return NULL; } + memset(&temp, 0, sizeof(temp)); temp.in.system_name = get_string_property($input, "system_name"); temp.in.access_mask = get_uint32_property($input, "access_mask"); $1 = &temp; } +%typemap(argout) struct samr_Connect2 * { + long status = PyLong_AsLong(resultobj); + PyObject *dict; + + /* Throw exception if result was not OK */ + + if (status != 0) { + set_ntstatus_exception(status); + return NULL; + } + + dict = PyDict_New(); + + PyDict_SetItem(dict, PyString_FromString("handle"), + PyString_FromStringAndSize($1->out.handle, + sizeof(*($1->out.handle)))); + + resultobj = dict; +} + %rename(samr_Connect2) dcerpc_samr_Connect2; NTSTATUS dcerpc_samr_Connect2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_Connect2 *r); -- cgit