summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-01-06 01:04:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:37:05 -0500
commit6bffcc6d45c496678bd3f8ab2f9fb88e94a17d0a (patch)
tree724f1415be6d15813203a7261b1aea504cd2e645
parentb31875ba75057e94fff9df67ed025570245a282b (diff)
downloadsamba-6bffcc6d45c496678bd3f8ab2f9fb88e94a17d0a.tar.gz
samba-6bffcc6d45c496678bd3f8ab2f9fb88e94a17d0a.tar.bz2
samba-6bffcc6d45c496678bd3f8ab2f9fb88e94a17d0a.zip
r20576: add functions to get and set dsdb_schema on the ldb context
metze (This used to be commit 2e054be8e023e23420e7ddd8cd73497400a875f9)
-rw-r--r--source4/dsdb/schema/schema_init.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c
index bed4e78525..22d366d4f3 100644
--- a/source4/dsdb/schema/schema_init.c
+++ b/source4/dsdb/schema/schema_init.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "dsdb/samdb/samdb.h"
+#include "lib/ldb/include/ldb_errors.h"
#include "lib/util/dlinklist.h"
#include "librpc/gen_ndr/ndr_misc.h"
#include "librpc/gen_ndr/ndr_drsuapi.h"
@@ -796,3 +797,36 @@ const char *dsdb_lDAPDisplayName_by_id(const struct dsdb_schema *schema,
return NULL;
}
+
+int dsdb_set_schema(struct ldb_context *ldb, struct dsdb_schema *schema)
+{
+ int ret;
+
+ ret = ldb_set_opaque(ldb, "dsdb_schema", schema);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+
+ talloc_steal(ldb, schema);
+
+ return LDB_SUCCESS;
+}
+
+const struct dsdb_schema *dsdb_get_schema(struct ldb_context *ldb)
+{
+ const void *p;
+ const struct dsdb_schema *schema;
+
+ /* see if we have a cached copy */
+ p = ldb_get_opaque(ldb, "dsdb_schema");
+ if (!p) {
+ return NULL;
+ }
+
+ schema = talloc_get_type(p, struct dsdb_schema);
+ if (!schema) {
+ return NULL;
+ }
+
+ return schema;
+}