summaryrefslogtreecommitdiff
path: root/source4/dsdb/schema
diff options
context:
space:
mode:
authorNadezhda Ivanova <nadezhda.ivanova@postpath.com>2009-12-15 12:02:20 +0200
committerNadezhda Ivanova <nadezhda.ivanova@postpath.com>2009-12-15 12:02:20 +0200
commit4deaa84ce4a425bfba4b2612d79cc6fa1e00cca5 (patch)
treeee19276386889add1aeeba6547373853416d4018 /source4/dsdb/schema
parentef5508bc7864dcd7128cf91017407efede7572d2 (diff)
downloadsamba-4deaa84ce4a425bfba4b2612d79cc6fa1e00cca5.tar.gz
samba-4deaa84ce4a425bfba4b2612d79cc6fa1e00cca5.tar.bz2
samba-4deaa84ce4a425bfba4b2612d79cc6fa1e00cca5.zip
Fixed a problem with duplicate values of allowedAttributesEffective.
Diffstat (limited to 'source4/dsdb/schema')
-rw-r--r--source4/dsdb/schema/schema_query.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source4/dsdb/schema/schema_query.c b/source4/dsdb/schema/schema_query.c
index 0a58f7a23c..f563f01272 100644
--- a/source4/dsdb/schema/schema_query.c
+++ b/source4/dsdb/schema/schema_query.c
@@ -350,6 +350,14 @@ static const char **dsdb_full_attribute_list_internal_el(TALLOC_CTX *mem_ctx,
return attr_list;
}
+static int qsort_string(const void *v1,
+ const void *v2)
+{
+ char * const *s1 = v1;
+ char * const *s2 = v2;
+ return strcasecmp(*s1, *s2);
+}
+
/* Helper function to remove duplicates from the attribute list to be returned */
static const char **dedup_attr_list(const char **attr_list)
{
@@ -359,13 +367,14 @@ static const char **dedup_attr_list(const char **attr_list)
int i;
qsort(attr_list, new_len,
sizeof(*attr_list),
- (comparison_fn_t)strcasecmp);
+ (comparison_fn_t)qsort_string);
for (i=1 ; i < new_len; i++) {
const char **val1 = &attr_list[i-1];
const char **val2 = &attr_list[i];
if (ldb_attr_cmp(*val1, *val2) == 0) {
memmove(val1, val2, (new_len - i) * sizeof( *attr_list));
+ attr_list[new_len-1] = NULL;
new_len--;
i--;
}