Bug 13948 - LdbControl object set function has incorrect signature
Summary: LdbControl object set function has incorrect signature
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: AD: LDB/DSDB/SAMDB (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Noel Power
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-15 10:02 UTC by Noel Power
Modified: 2019-05-15 10:08 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Noel Power 2019-05-15 10:02:24 UTC
Not sure really what the effect of this is (if any) opening bug here for a queued up master fix that (may) need to be backported.

lib/ldb/pyldb.c

has

static PyObject *py_ldb_control_set_critical(PyLdbControlObject *self, PyObject *value, void *closure)

this function should match 'setter' func signature

		.name = discard_const_p(char, "critical"),
		.get  = (getter)py_ldb_control_get_critical,
		.set  = (setter)py_ldb_control_set_critical, <<<======

so return type is incorrect.

from https://docs.python.org/3/c-api/structures.html

"set functions take two PyObject* parameters (the instance and the value to be set) and a function pointer (the associated closure):

typedef int (*setter)(PyObject *, PyObject *, void *);

In case the attribute should be deleted the second parameter is NULL. Should return 0 on success or -1 with a set exception on failure."

so although we don't ever return -1 we also never return 0.
Comment 1 Noel Power 2019-05-15 10:08:20 UTC
(In reply to Noel Power from comment #0)
>so although we don't ever return -1 we also never return 0.

erm, well we have an invalid signature and we always return 0 (e.g. NULL) which will always be zero. So never a problem I guess