summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2013-01-26 09:09:23 +1100
committerStefan Metzmacher <metze@samba.org>2013-01-26 14:19:57 +0100
commita321dd3aafa0f6ec8b39cd4fc64146dfbf24ce65 (patch)
treee0a9e9c5bba327a29aabb29441cd4ae8f8196fcb /source4
parenta3054323d3fa1dadff1675e7f8ec672a991d8e56 (diff)
downloadsamba-a321dd3aafa0f6ec8b39cd4fc64146dfbf24ce65.tar.gz
samba-a321dd3aafa0f6ec8b39cd4fc64146dfbf24ce65.tar.bz2
samba-a321dd3aafa0f6ec8b39cd4fc64146dfbf24ce65.zip
pymessaging: Pass around the server_id struct to python callbacks rather than the tuple
This is not used currently, but may avoid going to and from the python types when we do not need to. Andrew Bartlett Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/messaging/pymessaging.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c
index f8703b25af..3901d4d599 100644
--- a/source4/lib/messaging/pymessaging.c
+++ b/source4/lib/messaging/pymessaging.c
@@ -163,10 +163,20 @@ static void py_msg_callback_wrapper(struct imessaging_context *msg, void *privat
uint32_t msg_type,
struct server_id server_id, DATA_BLOB *data)
{
- PyObject *callback = (PyObject *)private_data;
+ PyObject *py_server_id, *callback = (PyObject *)private_data;
- PyObject_CallFunction(callback, discard_const_p(char, "i(KII)s#"), msg_type,
- server_id.pid, server_id.task_id, server_id.vnn,
+ struct server_id *p_server_id = talloc(NULL, struct server_id);
+ if (!p_server_id) {
+ PyErr_NoMemory();
+ return;
+ }
+ *p_server_id = server_id;
+
+ py_server_id = py_return_ndr_struct("samba.dcerpc.server_id", "server_id", p_server_id, p_server_id);
+ talloc_unlink(NULL, p_server_id);
+
+ PyObject_CallFunction(callback, discard_const_p(char, "i(O)s#"), msg_type,
+ py_server_id,
data->data, data->length);
}