1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-24 02:04:21 +03:00

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
This commit is contained in:
Volker Lendecke 2014-11-27 12:28:40 +01:00
parent c6a5eab369
commit f9acb949cc

View File

@ -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);