diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-04-08 22:07:42 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-04-08 23:20:36 +0200 |
commit | 57ac0a6042c368a72beca3b48d0ae7210a9c999b (patch) | |
tree | 706145c836782fb043d2c593668262bef37fe184 /source4/scripting/python | |
parent | dd4ef4e106d372cfadf7b47db8bf9dc25728b3bc (diff) | |
download | samba-57ac0a6042c368a72beca3b48d0ae7210a9c999b.tar.gz samba-57ac0a6042c368a72beca3b48d0ae7210a9c999b.tar.bz2 samba-57ac0a6042c368a72beca3b48d0ae7210a9c999b.zip |
s4-python: Move load_partition_usn to dsdb module.
Diffstat (limited to 'source4/scripting/python')
-rw-r--r-- | source4/scripting/python/pyglue.c | 48 | ||||
-rw-r--r-- | source4/scripting/python/samba/samdb.py | 3 |
2 files changed, 3 insertions, 48 deletions
diff --git a/source4/scripting/python/pyglue.c b/source4/scripting/python/pyglue.c index 530c33e7d4..629c9b11e2 100644 --- a/source4/scripting/python/pyglue.c +++ b/source4/scripting/python/pyglue.c @@ -186,52 +186,6 @@ static PyObject *py_dsdb_set_schema_from_ldb(PyObject *self, PyObject *args) Py_RETURN_NONE; } -static PyObject *py_dsdb_load_partition_usn(PyObject *self, PyObject *args) -{ - PyObject *py_dn, *py_ldb, *result; - struct ldb_dn *dn; - uint64_t highest_uSN, urgent_uSN; - struct ldb_context *ldb; - TALLOC_CTX *mem_ctx; - int ret; - - mem_ctx = talloc_new(NULL); - if (mem_ctx == NULL) { - PyErr_NoMemory(); - return NULL; - } - - if (!PyArg_ParseTuple(args, "OO", &py_ldb, &py_dn)) { - talloc_free(mem_ctx); - return NULL; - } - - PyErr_LDB_OR_RAISE(py_ldb, ldb); - - if (!PyObject_AsDn(mem_ctx, py_dn, ldb, &dn)) { - talloc_free(mem_ctx); - return NULL; - } - - ret = dsdb_load_partition_usn(ldb, dn, &highest_uSN, &urgent_uSN); - if (ret != LDB_SUCCESS) { - char *errstr = talloc_asprintf(mem_ctx, "Failed to load partition uSN - %s", ldb_errstring(ldb)); - PyErr_SetString(PyExc_RuntimeError, errstr); - talloc_free(mem_ctx); - return NULL; - } - - talloc_free(mem_ctx); - - result = PyDict_New(); - - PyDict_SetItemString(result, "uSNHighest", PyInt_FromLong((uint64_t)highest_uSN)); - PyDict_SetItemString(result, "uSNUrgent", PyInt_FromLong((uint64_t)urgent_uSN)); - - - return result; -} - /* return the list of interface IPs we have configured takes an loadparm context, returns a list of IPs in string form @@ -302,8 +256,6 @@ static PyMethodDef py_misc_methods[] = { NULL }, { "set_debug_level", (PyCFunction)py_set_debug_level, METH_VARARGS, "set debug level" }, - { "dsdb_load_partition_usn", (PyCFunction)py_dsdb_load_partition_usn, METH_VARARGS, - "get uSNHighest and uSNUrgent from the partition @REPLCHANGED"}, { "interface_ips", (PyCFunction)py_interface_ips, METH_VARARGS, "get interface IP address list"}, { NULL } diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py index 2f33c31c63..790cb2badc 100644 --- a/source4/scripting/python/samba/samdb.py +++ b/source4/scripting/python/samba/samdb.py @@ -267,3 +267,6 @@ accountExpires: %u def server_site_name(self): "Get the server site name" return dsdb.samdb_server_site_name(self) + + def load_partition_usn(self, base_dn): + return dsdb.dsdb_load_partition_usn(self, base_dn) |