diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-04-04 01:54:57 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-04-06 13:12:43 +0200 |
commit | ae9761349904ac9c4c2745018903d8c2fcc2abf1 (patch) | |
tree | 9207a8602b1eaa85c2fb08e69882d6534db44eb2 /source4/dsdb/pydsdb.c | |
parent | b72a5c033670a84423d1099aedbcfa5047ac47e6 (diff) | |
download | samba-ae9761349904ac9c4c2745018903d8c2fcc2abf1.tar.gz samba-ae9761349904ac9c4c2745018903d8c2fcc2abf1.tar.xz samba-ae9761349904ac9c4c2745018903d8c2fcc2abf1.zip |
s4-python: Move set_opaque_integer to pyldb.
Diffstat (limited to 'source4/dsdb/pydsdb.c')
-rw-r--r-- | source4/dsdb/pydsdb.c | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c index 6e3e50a871c..ac9b93cc27a 100644 --- a/source4/dsdb/pydsdb.c +++ b/source4/dsdb/pydsdb.c @@ -57,70 +57,6 @@ static PyObject *py_samdb_server_site_name(PyObject *self, PyObject *args) return result; } -/* XXX: This function really should be in pyldb.c */ -static PyObject *py_dsdb_set_opaque_integer(PyObject *self, PyObject *args) -{ - PyObject *py_ldb; - int value; - int *old_val, *new_val; - char *py_opaque_name, *opaque_name_talloc; - struct ldb_context *ldb; - TALLOC_CTX *tmp_ctx; - - if (!PyArg_ParseTuple(args, "Osi", &py_ldb, &py_opaque_name, &value)) - return NULL; - - PyErr_LDB_OR_RAISE(py_ldb, ldb); - - /* see if we have a cached copy */ - old_val = (int *)ldb_get_opaque(ldb, py_opaque_name); - /* XXX: We shouldn't just blindly assume that the value that is - * already present has the size of an int and is not shared - * with other code that may rely on it not changing. - * JRV 20100403 */ - - if (old_val) { - *old_val = value; - Py_RETURN_NONE; - } - - tmp_ctx = talloc_new(ldb); - if (tmp_ctx == NULL) { - PyErr_NoMemory(); - return NULL; - } - - new_val = talloc(tmp_ctx, int); - if (new_val == NULL) { - talloc_free(tmp_ctx); - PyErr_NoMemory(); - return NULL; - } - - opaque_name_talloc = talloc_strdup(tmp_ctx, py_opaque_name); - if (opaque_name_talloc == NULL) { - talloc_free(tmp_ctx); - PyErr_NoMemory(); - return NULL; - } - - *new_val = value; - - /* cache the domain_sid in the ldb */ - if (ldb_set_opaque(ldb, opaque_name_talloc, new_val) != LDB_SUCCESS) { - talloc_free(tmp_ctx); - PyErr_SetString(PyExc_RuntimeError, - "Failed to set opaque integer into the ldb"); - return NULL; - } - - talloc_steal(ldb, new_val); - talloc_steal(ldb, opaque_name_talloc); - talloc_free(tmp_ctx); - - Py_RETURN_NONE; -} - static PyObject *py_dsdb_convert_schema_to_openldap(PyObject *self, PyObject *args) { @@ -150,8 +86,6 @@ static PyObject *py_dsdb_convert_schema_to_openldap(PyObject *self, static PyMethodDef py_dsdb_methods[] = { { "samdb_server_site_name", (PyCFunction)py_samdb_server_site_name, METH_VARARGS, "Get the server site name as a string"}, - { "dsdb_set_opaque_integer", (PyCFunction)py_dsdb_set_opaque_integer, - METH_VARARGS, NULL }, { "dsdb_convert_schema_to_openldap", (PyCFunction)py_dsdb_convert_schema_to_openldap, METH_VARARGS, "dsdb_convert_schema_to_openldap(ldb, target_str, mapping) -> str\n" |