svn commit: samba r10755 - in branches/SAMBA_4_0/source/lib/ldb/common: .

tridge at samba.org tridge at samba.org
Thu Oct 6 05:41:33 GMT 2005


Author: tridge
Date: 2005-10-06 05:41:32 +0000 (Thu, 06 Oct 2005)
New Revision: 10755

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

Log:

fixed the construction of expressions from subtrees for SUBSTRING searches


Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_parse.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_parse.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_parse.c	2005-10-06 05:25:35 UTC (rev 10754)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_parse.c	2005-10-06 05:41:32 UTC (rev 10755)
@@ -686,7 +686,8 @@
 		talloc_free(s);
 		return ret;
 	case LDB_OP_SUBSTRING:
-		ret = talloc_strdup(mem_ctx, (tree->u.substring.start_with_wildcard)?"*":"");
+		ret = talloc_asprintf(mem_ctx, "(%s=%s", tree->u.substring.attr,
+				      tree->u.substring.start_with_wildcard?"*":"");
 		if (ret == NULL) return NULL;
 		for (i = 0; tree->u.substring.chunks[i]; i++) {
 			s2 = ldb_binary_encode(mem_ctx, *(tree->u.substring.chunks[i]));
@@ -704,6 +705,12 @@
 		if ( ! tree->u.substring.end_with_wildcard ) {
 			ret[strlen(ret) - 1] = '\0'; /* remove last wildcard */
 		}
+		s = talloc_asprintf_append(ret, ")");
+		if (s == NULL) {
+			talloc_free(ret);
+			return NULL;
+		}
+		ret = s;
 		return ret;
 	case LDB_OP_GREATER:
 		s = ldb_binary_encode(mem_ctx, tree->u.equality.value);



More information about the samba-cvs mailing list