summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-09-09 17:34:55 +1000
committerAndrew Tridgell <tridge@samba.org>2010-09-09 21:39:24 +1000
commit54e86d881d2955bae49bd87fe08e74bbfc86fd0e (patch)
tree2ad780d9df2cfe12c38db7892103567fd443d694 /source4/dsdb
parent650dcda2a2c59657b11052ebef622c351c4db477 (diff)
downloadsamba-54e86d881d2955bae49bd87fe08e74bbfc86fd0e.tar.gz
samba-54e86d881d2955bae49bd87fe08e74bbfc86fd0e.tar.bz2
samba-54e86d881d2955bae49bd87fe08e74bbfc86fd0e.zip
s4-pydsdb: expose samdb_partitions_dn() as get_partitions_dn() in python
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/pydsdb.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c
index ecf89b1d8c..5ba69d7388 100644
--- a/source4/dsdb/pydsdb.c
+++ b/source4/dsdb/pydsdb.c
@@ -505,6 +505,35 @@ static PyObject *py_dsdb_write_prefixes_from_schema_to_ldb(PyObject *self, PyObj
}
+static PyObject *py_dsdb_get_partitions_dn(PyObject *self, PyObject *args)
+{
+ struct ldb_context *ldb;
+ struct ldb_dn *dn;
+ PyObject *py_ldb, *ret;
+ TALLOC_CTX *tmp_ctx;
+ PyObject *mod;
+
+ mod = PyImport_ImportModule("ldb");
+
+ if (!PyArg_ParseTuple(args, "O", &py_ldb))
+ return NULL;
+
+ PyErr_LDB_OR_RAISE(py_ldb, ldb);
+
+ tmp_ctx = talloc_new(NULL);
+
+ dn = samdb_partitions_dn(ldb, tmp_ctx);
+
+ if (dn == NULL) {
+ talloc_free(tmp_ctx);
+ Py_RETURN_NONE;
+ }
+ ret = PyLdbDn_FromDn(dn);
+ talloc_free(tmp_ctx);
+ return ret;
+}
+
+
static PyMethodDef py_dsdb_methods[] = {
{ "_samdb_server_site_name", (PyCFunction)py_samdb_server_site_name,
@@ -550,6 +579,7 @@ static PyMethodDef py_dsdb_methods[] = {
NULL },
{ "_dsdb_write_prefixes_from_schema_to_ldb", (PyCFunction)py_dsdb_write_prefixes_from_schema_to_ldb, METH_VARARGS,
NULL },
+ { "_dsdb_get_partitions_dn", (PyCFunction)py_dsdb_get_partitions_dn, METH_VARARGS, NULL },
{ NULL }
};