mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
ldb: Update ldb.get_opaque() to return talloc‐managed opaque values
Signed-off-by: Jo Sutton <josutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Sun Mar 3 23:33:44 UTC 2024 on atb-devel-224
This commit is contained in:
parent
256320532a
commit
ee94d70855
@ -2414,9 +2414,42 @@ static PyObject *py_ldb_get_opaque(PyLdbObject *self, PyObject *args)
|
||||
if (data == NULL)
|
||||
Py_RETURN_NONE;
|
||||
|
||||
/* FIXME: More interpretation */
|
||||
if (data == (void *)1) {
|
||||
/*
|
||||
* This value is sometimes used to indicate that a opaque is
|
||||
* set.
|
||||
*/
|
||||
Py_RETURN_TRUE;
|
||||
}
|
||||
|
||||
Py_RETURN_TRUE;
|
||||
{
|
||||
/*
|
||||
* Let’s hope the opaque data is actually a talloc pointer,
|
||||
* otherwise calling this would be Very Bad.
|
||||
*/
|
||||
const bool *opaque = talloc_get_type(data, bool);
|
||||
if (opaque != NULL) {
|
||||
return PyBool_FromLong(*opaque);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const unsigned long long *opaque = talloc_get_type(
|
||||
data, unsigned long long);
|
||||
if (opaque != NULL) {
|
||||
return PyLong_FromUnsignedLongLong(*opaque);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const char *opaque = talloc_get_type(data, char);
|
||||
if (opaque != NULL) {
|
||||
return PyUnicode_FromString(opaque);
|
||||
}
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_ValueError, "Unsupported type for opaque");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static PyObject *py_ldb_set_opaque(PyLdbObject *self, PyObject *args)
|
||||
|
@ -1,8 +0,0 @@
|
||||
^ldb\.python\.api\.SimpleLdb\.test_opaque_bool\(none\)$
|
||||
^ldb\.python\.api\.SimpleLdb\.test_opaque_int\(none\)$
|
||||
^ldb\.python\.api\.SimpleLdb\.test_opaque_none\(none\)$
|
||||
^ldb\.python\.api\.SimpleLdb\.test_opaque_string\(none\)$
|
||||
^ldb\.python\.api\.SimpleLdbLmdb\.test_opaque_bool\(none\)$
|
||||
^ldb\.python\.api\.SimpleLdbLmdb\.test_opaque_int\(none\)$
|
||||
^ldb\.python\.api\.SimpleLdbLmdb\.test_opaque_none\(none\)$
|
||||
^ldb\.python\.api\.SimpleLdbLmdb\.test_opaque_string\(none\)$
|
Loading…
Reference in New Issue
Block a user