Author: metze Date: 2007-01-06 01:04:12 +0000 (Sat, 06 Jan 2007) New Revision: 20576
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20576 Log: add functions to get and set dsdb_schema on the ldb context metze Modified: branches/SAMBA_4_0/source/dsdb/schema/schema_init.c Changeset: Modified: branches/SAMBA_4_0/source/dsdb/schema/schema_init.c =================================================================== --- branches/SAMBA_4_0/source/dsdb/schema/schema_init.c 2007-01-05 23:00:46 UTC (rev 20575) +++ branches/SAMBA_4_0/source/dsdb/schema/schema_init.c 2007-01-06 01:04:12 UTC (rev 20576) @@ -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 @@ 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; +}