diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/pydsdb.c | 27 | ||||
-rw-r--r-- | source4/scripting/python/samba/samdb.py | 3 |
2 files changed, 30 insertions, 0 deletions
diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c index 5ba69d7388..7f2e71550c 100644 --- a/source4/dsdb/pydsdb.c +++ b/source4/dsdb/pydsdb.c @@ -534,6 +534,30 @@ static PyObject *py_dsdb_get_partitions_dn(PyObject *self, PyObject *args) } +/* + call into samdb_rodc() + */ +static PyObject *py_dsdb_am_rodc(PyObject *self, PyObject *args) +{ + PyObject *py_ldb; + struct ldb_context *ldb; + int ret; + bool am_rodc; + + if (!PyArg_ParseTuple(args, "O", &py_ldb)) + return NULL; + + PyErr_LDB_OR_RAISE(py_ldb, ldb); + + ret = samdb_rodc(ldb, &am_rodc); + if (samdb_rodc(ldb, &am_rodc) != LDB_SUCCESS) { + PyErr_SetString(PyExc_RuntimeError, ldb_errstring(ldb)); + return NULL; + } + + return PyBool_FromLong(am_rodc); +} + static PyMethodDef py_dsdb_methods[] = { { "_samdb_server_site_name", (PyCFunction)py_samdb_server_site_name, @@ -573,6 +597,9 @@ static PyMethodDef py_dsdb_methods[] = { { "_dsdb_set_am_rodc", (PyCFunction)py_dsdb_set_am_rodc, METH_VARARGS, NULL }, + { "_am_rodc", + (PyCFunction)py_dsdb_am_rodc, METH_VARARGS, + NULL }, { "_dsdb_set_schema_from_ldif", (PyCFunction)py_dsdb_set_schema_from_ldif, METH_VARARGS, NULL }, { "_dsdb_set_schema_from_ldb", (PyCFunction)py_dsdb_set_schema_from_ldb, METH_VARARGS, diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py index c43c65da93..bbc52a9ebd 100644 --- a/source4/scripting/python/samba/samdb.py +++ b/source4/scripting/python/samba/samdb.py @@ -64,6 +64,9 @@ class SamDB(samba.Ldb): super(SamDB, self).connect(url=url, flags=flags, options=options) + def am_rodc(self): + return dsdb._am_rodc(self) + def domain_dn(self): # find the DNs for the domain res = self.search(base="", |