summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-05-01 14:04:33 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:51:38 -0500
commit29bc1f5c605b53635eea805cdd3ca6b2873bc792 (patch)
tree024d23fec0e7debea335ec986aa75e433e4241bd /source4
parent3c117a484316f963114cbeb1ba83872cfa95d854 (diff)
downloadsamba-29bc1f5c605b53635eea805cdd3ca6b2873bc792.tar.gz
samba-29bc1f5c605b53635eea805cdd3ca6b2873bc792.tar.bz2
samba-29bc1f5c605b53635eea805cdd3ca6b2873bc792.zip
r437: fixed handling of a corner case with multi-valued indexing
(This used to be commit b38612185657512419c4b3dc806cf1183e0db0cb)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_index.c8
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_search.c6
2 files changed, 14 insertions, 0 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c
index 6c21ae2986..76e17cdfd5 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_index.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_index.c
@@ -590,6 +590,14 @@ static int ltdb_index_add1_add(struct ldb_context *ldb,
char *dn)
{
struct ldb_val *v2;
+ int i;
+
+ /* for multi-valued attributes we can end up with repeats */
+ for (i=0;i<msg->elements[idx].num_values;i++) {
+ if (strcmp(dn, msg->elements[idx].values[i].data) == 0) {
+ return 0;
+ }
+ }
v2 = realloc_p(msg->elements[idx].values,
struct ldb_val,
diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c
index 7059030212..1dce8f83a2 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_search.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_search.c
@@ -204,12 +204,18 @@ static struct ldb_message *ltdb_pull_attrs(struct ldb_context *ldb,
/*
see if a ldb_val is a wildcard
+ return 1 if yes, 0 if no
*/
int ltdb_has_wildcard(struct ldb_context *ldb, const char *attr_name,
const struct ldb_val *val)
{
int flags;
+ /* all attribute types recognise the "*" wildcard */
+ if (val->length == 1 && strncmp((char *)val->data, "*", 1) == 0) {
+ return 1;
+ }
+
if (strpbrk(val->data, "*?") == NULL) {
return 0;
}