summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-10-17 11:27:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:44:51 -0500
commit70e73a45d9e473777eb3eecbd3babc397292da71 (patch)
tree45bc28172b25c2543d68cbea74da6bd3a177c55f /source4
parentbe5a24b3c0279b5b90aa61f13cf2d50a45394674 (diff)
downloadsamba-70e73a45d9e473777eb3eecbd3babc397292da71.tar.gz
samba-70e73a45d9e473777eb3eecbd3babc397292da71.tar.bz2
samba-70e73a45d9e473777eb3eecbd3babc397292da71.zip
r11111: fixed a talloc error in the dn shortcut code
(This used to be commit e28a334eeb8fa22f686d0c1dc48b2977d85b9e10)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_index.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c
index e80cf74c62..275aadbd78 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_index.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_index.c
@@ -323,9 +323,17 @@ static int ltdb_index_dn_leaf(struct ldb_module *module,
}
if (ldb_attr_cmp(tree->u.equality.attr, "distinguishedName") == 0 ||
ldb_attr_cmp(tree->u.equality.attr, "dn") == 0) {
- char *dn = talloc_strdup(list, (char *)tree->u.equality.value.data);
+ list->dn = talloc_array(list, char *, 1);
+ if (list->dn == NULL) {
+ ldb_oom(module->ldb);
+ return -1;
+ }
+ list->dn[0] = talloc_strdup(list, (char *)tree->u.equality.value.data);
+ if (list->dn[0] == NULL) {
+ ldb_oom(module->ldb);
+ return -1;
+ }
list->count = 1;
- list->dn = &dn;
return 1;
}
return ltdb_index_dn_simple(module, tree, index_list, list);
@@ -698,12 +706,17 @@ int ltdb_search_indexed(struct ldb_module *module,
if (scope == LDB_SCOPE_BASE) {
/* with BASE searches only one DN can match */
- char *dn = ldb_dn_linearize(dn_list, base);
- if (dn == NULL) {
+ dn_list->dn = talloc_array(dn_list, char *, 1);
+ if (dn_list->dn == NULL) {
+ ldb_oom(module->ldb);
+ return -1;
+ }
+ dn_list->dn[0] = ldb_dn_linearize(dn_list, base);
+ if (dn_list->dn[0] == NULL) {
+ ldb_oom(module->ldb);
return -1;
}
dn_list->count = 1;
- dn_list->dn = &dn;
ret = 1;
} else {
ret = ltdb_index_dn(module, tree, ltdb->cache->indexlist, dn_list);