1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r437: fixed handling of a corner case with multi-valued indexing

(This used to be commit b386121856)
This commit is contained in:
Andrew Tridgell 2004-05-01 14:04:33 +00:00 committed by Gerald (Jerry) Carter
parent 3c117a4843
commit 29bc1f5c60
2 changed files with 14 additions and 0 deletions

View File

@ -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,

View File

@ -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;
}