]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4-pydsdb: Provide control of if we should write index attributes when reloading...
authorAndrew Bartlett <abartlet@samba.org>
Thu, 9 Aug 2012 04:23:12 +0000 (14:23 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 9 Aug 2012 04:39:20 +0000 (06:39 +0200)
This allows us to carefully control the loading of the schema.

Andrew Bartlett

source4/dsdb/pydsdb.c
source4/scripting/python/samba/samdb.py

index 355804943c89cb87668eb9b08c4ee9673928b73d..9023d69054b401b4672c7d341fc7c0326e3e64ac 100644 (file)
@@ -873,7 +873,9 @@ static PyObject *py_dsdb_set_schema_from_ldb(PyObject *self, PyObject *args)
        struct ldb_context *from_ldb;
        struct dsdb_schema *schema;
        int ret;
-       if (!PyArg_ParseTuple(args, "OO", &py_ldb, &py_from_ldb))
+       char write_attributes = true;
+       if (!PyArg_ParseTuple(args, "OO|b",
+                             &py_ldb, &py_from_ldb, &write_attributes))
                return NULL;
 
        PyErr_LDB_OR_RAISE(py_ldb, ldb);
@@ -886,7 +888,7 @@ static PyObject *py_dsdb_set_schema_from_ldb(PyObject *self, PyObject *args)
                return NULL;
        }
 
-       ret = dsdb_reference_schema(ldb, schema, true);
+       ret = dsdb_reference_schema(ldb, schema, write_attributes);
        PyErr_LDB_ERROR_IS_ERR_RAISE(py_ldb_get_exception(), ret, ldb);
 
        Py_RETURN_NONE;
index 7451b6c62457edaeb2708680c840e7b5339d665f..3355e9a58986cf9c1fa3ac8804513611fff42fb4 100644 (file)
@@ -608,11 +608,11 @@ accountExpires: %u
     def load_partition_usn(self, base_dn):
         return dsdb._dsdb_load_partition_usn(self, base_dn)
 
-    def set_schema(self, schema):
-        self.set_schema_from_ldb(schema.ldb)
+    def set_schema(self, schema, write_attributes=True):
+        self.set_schema_from_ldb(schema.ldb, write_attributes=write_attributes)
 
-    def set_schema_from_ldb(self, ldb_conn):
-        dsdb._dsdb_set_schema_from_ldb(self, ldb_conn)
+    def set_schema_from_ldb(self, ldb_conn, write_attributes=True):
+        dsdb._dsdb_set_schema_from_ldb(self, ldb_conn, write_attributes)
 
     def dsdb_DsReplicaAttribute(self, ldb, ldap_display_name, ldif_elements):
         '''convert a list of attribute values to a DRSUAPI DsReplicaAttribute'''