mirror of
https://github.com/samba-team/samba.git
synced 2025-02-08 05:57:51 +03:00
pyldb: add pyldb_check_type()
This will be used by pyldb_Ldb_AsLdbContext(). Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
parent
19a13cbe06
commit
f5e0339a0d
@ -46,6 +46,8 @@ PyObject *pyldb_Dn_FromDn(struct ldb_dn *);
|
|||||||
bool pyldb_Object_AsDn(TALLOC_CTX *mem_ctx, PyObject *object, struct ldb_context *ldb_ctx, struct ldb_dn **dn);
|
bool pyldb_Object_AsDn(TALLOC_CTX *mem_ctx, PyObject *object, struct ldb_context *ldb_ctx, struct ldb_dn **dn);
|
||||||
#define pyldb_Dn_AsDn(pyobj) ((PyLdbDnObject *)pyobj)->dn
|
#define pyldb_Dn_AsDn(pyobj) ((PyLdbDnObject *)pyobj)->dn
|
||||||
|
|
||||||
|
bool pyldb_check_type(PyObject *obj, const char *type_name);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
TALLOC_CTX *mem_ctx;
|
TALLOC_CTX *mem_ctx;
|
||||||
|
@ -48,6 +48,17 @@ static PyTypeObject * PyLdb_GetPyType(const char *typename)
|
|||||||
return (PyTypeObject*)py_obj;
|
return (PyTypeObject*)py_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool pyldb_check_type(PyObject *obj, const char *typename)
|
||||||
|
{
|
||||||
|
bool ok = false;
|
||||||
|
PyTypeObject *type = PyLdb_GetPyType(typename);
|
||||||
|
if (type != NULL) {
|
||||||
|
ok = PyObject_TypeCheck(obj, type);
|
||||||
|
Py_DECREF(type);
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain a ldb DN from a Python object.
|
* Obtain a ldb DN from a Python object.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user