Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
openldap
OpenLDAP
Commits
627de4de
Commit
627de4de
authored
Feb 25, 2003
by
Kurt Zeilenga
Browse files
Additional indexer normalization (need to check all Indexers)
parent
c98ef452
Changes
1
Hide whitespace changes
Inline
Side-by-side
servers/slapd/schema_init.c
View file @
627de4de
...
@@ -1390,11 +1390,11 @@ static int caseExactIgnoreSubstringsIndexer(
...
@@ -1390,11 +1390,11 @@ static int caseExactIgnoreSubstringsIndexer(
BerVarray
values
,
BerVarray
values
,
BerVarray
*
keysp
)
BerVarray
*
keysp
)
{
{
unsigned
casefold
;
unsigned
casefold
,
wasspace
;
ber_len_t
i
,
nkeys
;
ber_len_t
i
,
j
,
nkeys
;
size_t
slen
,
mlen
;
size_t
slen
,
mlen
;
BerVarray
keys
;
BerVarray
keys
;
BerVarray
nvalues
;
BerVarray
tvalues
,
nvalues
;
HASH_CONTEXT
HASHcontext
;
HASH_CONTEXT
HASHcontext
;
unsigned
char
HASHdigest
[
HASH_BYTES
];
unsigned
char
HASHdigest
[
HASH_BYTES
];
...
@@ -1414,10 +1414,39 @@ static int caseExactIgnoreSubstringsIndexer(
...
@@ -1414,10 +1414,39 @@ static int caseExactIgnoreSubstringsIndexer(
casefold
=
(
mr
!=
caseExactSubstringsMatchingRule
)
casefold
=
(
mr
!=
caseExactSubstringsMatchingRule
)
?
LDAP_UTF8_CASEFOLD
:
LDAP_UTF8_NOCASEFOLD
;
?
LDAP_UTF8_CASEFOLD
:
LDAP_UTF8_NOCASEFOLD
;
tvalues
=
ch_malloc
(
sizeof
(
struct
berval
)
*
(
i
+
1
)
);
nvalues
=
ch_malloc
(
sizeof
(
struct
berval
)
*
(
i
+
1
)
);
nvalues
=
ch_malloc
(
sizeof
(
struct
berval
)
*
(
i
+
1
)
);
for
(
i
=
0
;
values
[
i
].
bv_val
!=
NULL
;
i
++
)
{
for
(
i
=
0
;
values
[
i
].
bv_val
!=
NULL
;
i
++
)
{
UTF8bvnormalize
(
&
values
[
i
],
&
nvalues
[
i
],
casefold
);
UTF8bvnormalize
(
&
values
[
i
],
&
tvalues
[
i
],
casefold
);
/* collapse spaces (in place) */
nvalues
[
i
].
bv_len
=
0
;
nvalues
[
i
].
bv_val
=
tvalues
[
i
].
bv_val
;
wasspace
=
1
;
for
(
j
=
0
;
j
<
tvalues
[
i
].
bv_len
;
j
++
)
{
if
(
ASCII_SPACE
(
tvalues
[
i
].
bv_val
[
j
]
))
{
if
(
wasspace
++
==
0
)
{
nvalues
[
i
].
bv_val
[
nvalues
[
i
].
bv_len
++
]
=
tvalues
[
i
].
bv_val
[
j
];
}
}
else
{
wasspace
=
0
;
nvalues
[
i
].
bv_val
[
nvalues
[
i
].
bv_len
++
]
=
tvalues
[
i
].
bv_val
[
j
];
}
}
if
(
nvalues
[
i
].
bv_len
==
0
)
{
nvalues
[
i
].
bv_val
=
" "
;
nvalues
[
i
].
bv_len
=
sizeof
(
" "
)
-
1
;
}
else
{
if
(
wasspace
)
--
nvalues
[
i
].
bv_len
;
nvalues
[
i
].
bv_val
[
nvalues
[
i
].
bv_len
]
=
'\0'
;
}
}
}
tvalues
[
i
].
bv_val
=
NULL
;
nvalues
[
i
].
bv_val
=
NULL
;
nvalues
[
i
].
bv_val
=
NULL
;
values
=
nvalues
;
values
=
nvalues
;
...
@@ -1455,7 +1484,8 @@ static int caseExactIgnoreSubstringsIndexer(
...
@@ -1455,7 +1484,8 @@ static int caseExactIgnoreSubstringsIndexer(
if
(
nkeys
==
0
)
{
if
(
nkeys
==
0
)
{
/* no keys to generate */
/* no keys to generate */
*
keysp
=
NULL
;
*
keysp
=
NULL
;
ber_bvarray_free
(
nvalues
);
ber_bvarray_free
(
tvalues
);
ch_free
(
nvalues
);
return
LDAP_SUCCESS
;
return
LDAP_SUCCESS
;
}
}
...
@@ -1556,7 +1586,8 @@ static int caseExactIgnoreSubstringsIndexer(
...
@@ -1556,7 +1586,8 @@ static int caseExactIgnoreSubstringsIndexer(
*
keysp
=
NULL
;
*
keysp
=
NULL
;
}
}
ber_bvarray_free
(
nvalues
);
ber_bvarray_free
(
tvalues
);
ch_free
(
nvalues
);
return
LDAP_SUCCESS
;
return
LDAP_SUCCESS
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment