}
}
- if (ret == LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS) {
+ if (ret == LDB_ERR_OPERATIONS_ERROR || ret == LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS) {
/* We might be on a read-only DB */
ret = LDB_SUCCESS;
}
ret = samdb_replace(ldb, mem_ctx, mod_msg);
}
}
- if (ret == LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS) {
+ if (ret == LDB_ERR_OPERATIONS_ERROR || ret == LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS) {
/* We might be on a read-only DB */
ret = LDB_SUCCESS;
}
/**
* Make this ldb use a specified schema, already fully calculated and belonging to another ldb
*/
-int dsdb_reference_schema(struct ldb_context *ldb, struct dsdb_schema *schema)
+int dsdb_reference_schema(struct ldb_context *ldb, struct dsdb_schema *schema,
+ bool write_attributes)
{
int ret;
ret = ldb_set_opaque(ldb, "dsdb_schema", schema);
}
/* Set the new attributes based on the new schema */
- ret = dsdb_schema_set_attributes(ldb, schema, false);
+ ret = dsdb_schema_set_attributes(ldb, schema, write_attributes);
if (ret != LDB_SUCCESS) {
return ret;
}
return LDB_SUCCESS;
}
- return dsdb_reference_schema(ldb, global_schema);
+ return dsdb_reference_schema(ldb, global_schema, false /* Don't write attributes, it's expensive */);
}
/**
return NULL;
}
- ret = dsdb_reference_schema(ldb, schema);
+ ret = dsdb_reference_schema(ldb, schema, true);
PyErr_LDB_ERROR_IS_ERR_RAISE(py_ldb_get_exception(), ret, ldb);
Py_RETURN_NONE;