svn commit: samba r2236 - in branches/SAMBA_4_0/source/scripting/swig: .

tpot at samba.org tpot at samba.org
Mon Sep 6 11:09:27 GMT 2004


Author: tpot
Date: 2004-09-06 11:09:27 +0000 (Mon, 06 Sep 2004)
New Revision: 2236

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/scripting/swig&rev=2236&nolog=1

Log:
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!

Modified:
   branches/SAMBA_4_0/source/scripting/swig/samr.i


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/swig/samr.i
===================================================================
--- branches/SAMBA_4_0/source/scripting/swig/samr.i	2004-09-06 11:01:10 UTC (rev 2235)
+++ branches/SAMBA_4_0/source/scripting/swig/samr.i	2004-09-06 11:09:27 UTC (rev 2236)
@@ -29,10 +29,31 @@
 		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);



More information about the samba-cvs mailing list