Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
openldap
OpenLDAP
Commits
215448ac
Commit
215448ac
authored
Feb 14, 2002
by
Pierangelo Masarati
Browse files
substrings match works with NULs in UTF8 strings
parent
55993dc6
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/lber_pvt.h
View file @
215448ac
...
...
@@ -83,6 +83,9 @@ ber_pvt_socket_set_nonblock LDAP_P(( ber_socket_t sd, int nb ));
#define ber_strccmp(s,c) \
( (s)[0] == (c) && (s)[1] == '\0' )
LBER_F
(
char
*
)
ber_bvchr
LDAP_P
((
struct
berval
*
bv
,
char
c
));
LDAP_END_DECL
#endif
...
...
libraries/liblber/memory.c
View file @
215448ac
...
...
@@ -697,3 +697,26 @@ ber_bvarray_add( BerVarray *a, BerValue *bv )
return
n
;
}
char
*
ber_bvchr
(
struct
berval
*
bv
,
char
c
)
{
ber_len_t
p
;
assert
(
bv
);
if
(
bv
->
bv_len
==
0
)
{
return
NULL
;
}
assert
(
bv
->
bv_val
);
for
(
p
=
0
;
p
<
bv
->
bv_len
;
p
++
)
{
if
(
bv
->
bv_val
[
p
]
==
c
)
{
return
&
bv
->
bv_val
[
p
];
}
}
return
NULL
;
}
servers/slapd/schema_init.c
View file @
215448ac
...
...
@@ -529,13 +529,7 @@ UTF8StringNormalize(
/* Ignore initial whitespace */
/* All space is ASCII. All ASCII is 1 byte */
while
(
ASCII_SPACE
(
*
p
)
)
{
p
++
;
}
if
(
*
p
==
'\0'
)
{
return
LDAP_INVALID_SYNTAX
;
}
for
(
;
p
<
val
->
bv_val
+
val
->
bv_len
&&
ASCII_SPACE
(
p
[
0
]
);
p
++
);
ber_mem2bv
(
p
,
val
->
bv_len
-
(
p
-
val
->
bv_val
),
1
,
normalized
);
e
=
normalized
->
bv_val
+
val
->
bv_len
-
(
p
-
val
->
bv_val
);
...
...
@@ -1046,7 +1040,7 @@ caseExactIgnoreSubstringsMatch(
struct
berval
left
=
{
0
,
NULL
};
int
i
;
ber_len_t
inlen
=
0
;
char
*
nav
;
char
*
nav
=
NULL
;
unsigned
casefold
;
casefold
=
strcmp
(
mr
->
smr_oid
,
caseExactSubstringsMatchOID
)
...
...
@@ -1083,7 +1077,7 @@ caseExactIgnoreSubstringsMatch(
goto
done
;
}
match
=
strn
cmp
(
sub
->
sa_initial
.
bv_val
,
left
.
bv_val
,
match
=
mem
cmp
(
sub
->
sa_initial
.
bv_val
,
left
.
bv_val
,
sub
->
sa_initial
.
bv_len
);
if
(
match
!=
0
)
{
...
...
@@ -1101,7 +1095,7 @@ caseExactIgnoreSubstringsMatch(
goto
done
;
}
match
=
strn
cmp
(
sub
->
sa_final
.
bv_val
,
match
=
mem
cmp
(
sub
->
sa_final
.
bv_val
,
&
left
.
bv_val
[
left
.
bv_len
-
sub
->
sa_final
.
bv_len
],
sub
->
sa_final
.
bv_len
);
...
...
@@ -1129,9 +1123,9 @@ retry:
continue
;
}
p
=
str
chr
(
left
.
bv_val
,
*
sub
->
sa_any
[
i
].
bv_val
);
p
=
ber_bv
chr
(
&
left
,
*
sub
->
sa_any
[
i
].
bv_val
);
if
(
p
==
NULL
)
{
if
(
p
==
NULL
)
{
match
=
1
;
goto
done
;
}
...
...
@@ -1160,7 +1154,7 @@ retry:
goto
done
;
}
match
=
strn
cmp
(
left
.
bv_val
,
match
=
mem
cmp
(
left
.
bv_val
,
sub
->
sa_any
[
i
].
bv_val
,
sub
->
sa_any
[
i
].
bv_len
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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