From 07e6a0fd8a873be7ce047d01ac775c6e68b7616c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 30 May 2008 16:11:07 +1000 Subject: fixed a segv in the python messaging code on 64 bit systems (This used to be commit 7598c8389745fcc77da341b4af2dcef6a01db700) --- source4/lib/messaging/pymessaging.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c index 1c22fb431a..869508fca6 100644 --- a/source4/lib/messaging/pymessaging.c +++ b/source4/lib/messaging/pymessaging.c @@ -127,12 +127,15 @@ static PyObject *py_messaging_send(PyObject *self, PyObject *args, PyObject *kwa NTSTATUS status; struct server_id server; const char *kwnames[] = { "target", "msg_type", "data", NULL }; + int length; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Ois#|:send", - discard_const_p(char *, kwnames), &target, &msg_type, &data.data, &data.length)) { + discard_const_p(char *, kwnames), &target, &msg_type, &data.data, &length)) { return NULL; } + data.length = length; + if (!server_id_from_py(target, &server)) return NULL; -- cgit From 27f465619b2d8e01397b6d15434c9f2c577c5457 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 30 May 2008 16:19:22 +1000 Subject: two more places where the wrong type is passed to PyArg_ParseTupleAndKeywords() (This used to be commit db6122ec104e80ee2e02b1170ff808b6456b780b) --- source4/lib/messaging/pymessaging.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c index 869508fca6..41c9c82b1f 100644 --- a/source4/lib/messaging/pymessaging.c +++ b/source4/lib/messaging/pymessaging.c @@ -162,11 +162,11 @@ static void py_msg_callback_wrapper(struct messaging_context *msg, void *private static PyObject *py_messaging_register(PyObject *self, PyObject *args, PyObject *kwargs) { messaging_Object *iface = (messaging_Object *)self; - uint32_t msg_type = -1; + int msg_type = -1; PyObject *callback; NTSTATUS status; const char *kwnames[] = { "callback", "msg_type", NULL }; - + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:send", discard_const_p(char *, kwnames), &callback, &msg_type)) { return NULL; @@ -175,8 +175,10 @@ static PyObject *py_messaging_register(PyObject *self, PyObject *args, PyObject Py_INCREF(callback); if (msg_type == -1) { + uint32_t msg_type32 = msg_type; status = messaging_register_tmp(iface->msg_ctx, callback, - py_msg_callback_wrapper, &msg_type); + py_msg_callback_wrapper, &msg_type32); + msg_type = msg_type32; } else { status = messaging_register(iface->msg_ctx, callback, msg_type, py_msg_callback_wrapper); @@ -192,7 +194,7 @@ static PyObject *py_messaging_register(PyObject *self, PyObject *args, PyObject static PyObject *py_messaging_deregister(PyObject *self, PyObject *args, PyObject *kwargs) { messaging_Object *iface = (messaging_Object *)self; - uint32_t msg_type = -1; + int msg_type = -1; PyObject *callback; const char *kwnames[] = { "callback", "msg_type", NULL }; -- cgit