git.samba.org
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7eee8e0
)
s4-ldb: validate the type of the ldb argument to ldb_dn_new()
author
Andrew Tridgell
<tridge@samba.org>
Fri, 8 Jan 2010 22:03:08 +0000
(09:03 +1100)
committer
Andrew Tridgell
<tridge@samba.org>
Fri, 8 Jan 2010 23:15:12 +0000
(10:15 +1100)
It has been a common bug to get the first two arguments the wrong way
around
source4/lib/ldb/common/ldb_dn.c
patch
|
blob
|
history
diff --git
a/source4/lib/ldb/common/ldb_dn.c
b/source4/lib/ldb/common/ldb_dn.c
index 79953c6018451bcd7d0243f52d473fd1764820c3..252a0c632b16178277b5ab3e14c4d603f5c9b69a 100644
(file)
--- a/
source4/lib/ldb/common/ldb_dn.c
+++ b/
source4/lib/ldb/common/ldb_dn.c
@@
-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;