mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
s4-ldb: validate the type of the ldb argument to ldb_dn_new()
It has been a common bug to get the first two arguments the wrong way around
This commit is contained in:
parent
7eee8e053b
commit
39a4e2a38d
@ -103,7 +103,13 @@ struct ldb_dn *ldb_dn_from_ldb_val(void *mem_ctx,
|
||||
dn = talloc_zero(mem_ctx, struct ldb_dn);
|
||||
LDB_DN_NULL_FAILED(dn);
|
||||
|
||||
dn->ldb = ldb;
|
||||
dn->ldb = talloc_get_type(ldb, struct ldb_context);
|
||||
if (dn->ldb == NULL) {
|
||||
/* the caller probably got the arguments to
|
||||
ldb_dn_new() mixed up */
|
||||
talloc_free(dn);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (strdn->data && strdn->length) {
|
||||
const char *data = (const char *)strdn->data;
|
||||
|
Loading…
Reference in New Issue
Block a user