svn commit: samba r11111 - in branches/SAMBA_4_0/source/lib/ldb/ldb_tdb: .

tridge at samba.org tridge at samba.org
Mon Oct 17 11:27:30 GMT 2005


Author: tridge
Date: 2005-10-17 11:27:29 +0000 (Mon, 17 Oct 2005)
New Revision: 11111

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11111

Log:

fixed a talloc error in the dn shortcut code


Modified:
   branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c	2005-10-17 11:27:03 UTC (rev 11110)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c	2005-10-17 11:27:29 UTC (rev 11111)
@@ -323,9 +323,17 @@
 	}
 	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 @@
 
 	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);



More information about the samba-cvs mailing list