diff options
author | Andrew Bartlett <abartlet@samba.org> | 2012-07-06 19:57:58 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2012-07-06 22:55:50 +1000 |
commit | 023508ed17155309013ec684fa49d2d76d030dd0 (patch) | |
tree | b8b6b9d79de76a3555e3eca63b11d49a0525678c /source4 | |
parent | 979215ad59e3a1dcb2dddeb1749d8f2eb1a920c3 (diff) | |
download | samba-023508ed17155309013ec684fa49d2d76d030dd0.tar.gz samba-023508ed17155309013ec684fa49d2d76d030dd0.tar.bz2 samba-023508ed17155309013ec684fa49d2d76d030dd0.zip |
pydsdb: Add bindings for dsdb_wellknown_dn()
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/pydsdb.c | 35 | ||||
-rw-r--r-- | source4/scripting/python/samba/samdb.py | 3 |
2 files changed, 38 insertions, 0 deletions
diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c index 2690c14171..4db9d361d1 100644 --- a/source4/dsdb/pydsdb.c +++ b/source4/dsdb/pydsdb.c @@ -963,6 +963,28 @@ static PyObject *py_dsdb_get_nc_root(PyObject *self, PyObject *args) return py_nc_root; } +static PyObject *py_dsdb_get_wellknown_dn(PyObject *self, PyObject *args) +{ + struct ldb_context *ldb; + struct ldb_dn *nc_dn, *wk_dn; + char *wkguid; + PyObject *py_ldb, *py_nc_dn, *py_wk_dn; + int ret; + + if (!PyArg_ParseTuple(args, "OOs", &py_ldb, &py_nc_dn, &wkguid)) + return NULL; + + PyErr_LDB_OR_RAISE(py_ldb, ldb); + PyErr_LDB_DN_OR_RAISE(py_nc_dn, nc_dn); + + ret = dsdb_wellknown_dn(ldb, ldb, nc_dn, wkguid, &wk_dn); + PyErr_LDB_ERROR_IS_ERR_RAISE(py_ldb_get_exception(), ret, ldb); + + py_wk_dn = pyldb_Dn_FromDn(wk_dn); + talloc_unlink(ldb, wk_dn); + return py_wk_dn; +} + /* call into samdb_rodc() @@ -1069,6 +1091,7 @@ static PyMethodDef py_dsdb_methods[] = { NULL }, { "_dsdb_get_partitions_dn", (PyCFunction)py_dsdb_get_partitions_dn, METH_VARARGS, NULL }, { "_dsdb_get_nc_root", (PyCFunction)py_dsdb_get_nc_root, METH_VARARGS, NULL }, + { "_dsdb_get_wellknown_dn", (PyCFunction)py_dsdb_get_wellknown_dn, METH_VARARGS, NULL }, { "_dsdb_DsReplicaAttribute", (PyCFunction)py_dsdb_DsReplicaAttribute, METH_VARARGS, NULL }, { "_dsdb_normalise_attributes", (PyCFunction)py_dsdb_normalise_attributes, METH_VARARGS, NULL }, { NULL } @@ -1249,4 +1272,16 @@ void initdsdb(void) ADD_DSDB_STRING(DSDB_SYNTAX_STRING_DN); ADD_DSDB_STRING(DSDB_SYNTAX_OR_NAME); ADD_DSDB_STRING(DSDB_CONTROL_DBCHECK); + + ADD_DSDB_STRING(DS_GUID_COMPUTERS_CONTAINER); + ADD_DSDB_STRING(DS_GUID_DELETED_OBJECTS_CONTAINER); + ADD_DSDB_STRING(DS_GUID_DOMAIN_CONTROLLERS_CONTAINER); + ADD_DSDB_STRING(DS_GUID_FOREIGNSECURITYPRINCIPALS_CONTAINER); + ADD_DSDB_STRING(DS_GUID_INFRASTRUCTURE_CONTAINER); + ADD_DSDB_STRING(DS_GUID_LOSTANDFOUND_CONTAINER); + ADD_DSDB_STRING(DS_GUID_MICROSOFT_PROGRAM_DATA_CONTAINER); + ADD_DSDB_STRING(DS_GUID_NTDS_QUOTAS_CONTAINER); + ADD_DSDB_STRING(DS_GUID_PROGRAM_DATA_CONTAINER); + ADD_DSDB_STRING(DS_GUID_SYSTEMS_CONTAINER); + ADD_DSDB_STRING(DS_GUID_USERS_CONTAINER); } diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py index 416cd163d7..7451b6c624 100644 --- a/source4/scripting/python/samba/samdb.py +++ b/source4/scripting/python/samba/samdb.py @@ -744,6 +744,9 @@ accountExpires: %u def get_nc_root(self, dn): return dsdb._dsdb_get_nc_root(self, dn) + def get_wellknown_dn(self, nc_root, wkguid): + return dsdb._dsdb_get_wellknown_dn(self, nc_root, wkguid) + def set_minPwdAge(self, value): m = ldb.Message() m.dn = ldb.Dn(self, self.domain_dn()) |