mirror of
https://github.com/samba-team/samba.git
synced 2025-03-05 20:58:40 +03:00
s4:dsdb Add a memory context for dsdb_get_schema()
When specified, we talloc_reference onto this context to ensure that pointers found in it are valid for the life of the objects they are placed into. (Such as the string form of LDAP attributes). Andrew Bartlett
This commit is contained in:
parent
c874b9f42e
commit
1e6fee4185
@ -413,9 +413,11 @@ int dsdb_set_global_schema(struct ldb_context *ldb)
|
||||
|
||||
/**
|
||||
* Find the schema object for this ldb
|
||||
*
|
||||
* If reference_ctx is not NULL, then talloc_reference onto that context
|
||||
*/
|
||||
|
||||
struct dsdb_schema *dsdb_get_schema(struct ldb_context *ldb)
|
||||
struct dsdb_schema *dsdb_get_schema(struct ldb_context *ldb, TALLOC_CTX *reference_ctx)
|
||||
{
|
||||
const void *p;
|
||||
struct dsdb_schema *schema;
|
||||
@ -431,7 +433,11 @@ struct dsdb_schema *dsdb_get_schema(struct ldb_context *ldb)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return schema;
|
||||
if (!reference_ctx) {
|
||||
return schema;
|
||||
} else {
|
||||
return talloc_reference(reference_ctx, schema);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -440,7 +446,7 @@ struct dsdb_schema *dsdb_get_schema(struct ldb_context *ldb)
|
||||
|
||||
void dsdb_make_schema_global(struct ldb_context *ldb)
|
||||
{
|
||||
struct dsdb_schema *schema = dsdb_get_schema(ldb);
|
||||
struct dsdb_schema *schema = dsdb_get_schema(ldb, NULL);
|
||||
if (!schema) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user