summaryrefslogtreecommitdiffstats
path: root/source4/lib/messaging/pymessaging.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-11-27 12:28:40 +0100
committerVolker Lendecke <vl@samba.org>2014-11-27 21:32:18 +0100
commitf9acb949ccea008e6332f49288a545e0cba40e3b (patch)
treef8cae8684c2911cd4cfbd7f9163a35c0c093a2ef /source4/lib/messaging/pymessaging.c
parentc6a5eab3690d2926d66024a35e3c3e818d7e4935 (diff)
downloadsamba-f9acb949ccea008e6332f49288a545e0cba40e3b.tar.gz
samba-f9acb949ccea008e6332f49288a545e0cba40e3b.tar.xz
samba-f9acb949ccea008e6332f49288a545e0cba40e3b.zip
messaging4: Fix types
According to python docs, PyArg_ParseTuple takes "int" and "unsigned long long". With pointers down to functions, in particular with varargs, there is no automatic conversion. So we need to be very strict about types. Automatic conversion to for example uint64_t happes only with assignment. This fixes a crash on FreeBSD10/clang. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <rb@sernet.de> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Nov 27 21:32:18 CET 2014 on sn-devel-104
Diffstat (limited to 'source4/lib/messaging/pymessaging.c')
-rw-r--r--source4/lib/messaging/pymessaging.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c
index 1e9588c673..199532f948 100644
--- a/source4/lib/messaging/pymessaging.c
+++ b/source4/lib/messaging/pymessaging.c
@@ -51,9 +51,19 @@ static bool server_id_from_py(PyObject *object, struct server_id *server_id)
return true;
}
if (PyTuple_Size(object) == 3) {
- return PyArg_ParseTuple(object, "KII", &server_id->pid, &server_id->task_id, &server_id->vnn);
+ unsigned long long pid;
+ int task_id, vnn;
+
+ if (!PyArg_ParseTuple(object, "KII", &pid, &task_id, &vnn)) {
+ return false;
+ }
+ server_id->pid = pid;
+ server_id->task_id = task_id;
+ server_id->vnn = vnn;
+ return true;
} else {
- int pid, task_id;
+ unsigned long long pid;
+ int task_id;
if (!PyArg_ParseTuple(object, "KI", &pid, &task_id))
return false;
*server_id = cluster_id(pid, task_id);