Author: tridge Date: 2005-10-06 05:53:46 +0000 (Thu, 06 Oct 2005) New Revision: 10756
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10756 Log: another fix for the construction of expressions from subtrees for SUBSTRING searches. This time fix multi-part 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:41:32 UTC (rev 10755) +++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_parse.c 2005-10-06 05:53:46 UTC (rev 10756) @@ -695,16 +695,18 @@ talloc_free(ret); return NULL; } - s = talloc_asprintf_append(ret, "%s*", s2); + if (tree->u.substring.chunks[i+1] || + tree->u.substring.end_with_wildcard) { + s = talloc_asprintf_append(ret, "%s*", s2); + } else { + s = talloc_asprintf_append(ret, "%s", s2); + } if (s == NULL) { talloc_free(ret); return NULL; } ret = s; } - 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);