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
39891e4e
Commit
39891e4e
authored
Feb 13, 2002
by
Pierangelo Masarati
Browse files
make UTF8STringNormalize handle NUL
parent
6e88ea71
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/lber.h
View file @
39891e4e
...
...
@@ -567,6 +567,10 @@ LBER_F( struct berval * )
ber_str2bv
LDAP_P
((
LDAP_CONST
char
*
,
ber_len_t
len
,
int
dup
,
struct
berval
*
bv
));
LBER_F
(
struct
berval
*
)
ber_mem2bv
LDAP_P
((
LDAP_CONST
char
*
,
ber_len_t
len
,
int
dup
,
struct
berval
*
bv
));
#define ber_bvstr(a) ber_str2bv(a, 0, 0, NULL)
#define ber_bvstrdup(a) ber_str2bv(a, 0, 1, NULL)
...
...
libraries/liblber/memory.c
View file @
39891e4e
...
...
@@ -523,6 +523,46 @@ ber_str2bv(
return
(
new
);
}
struct
berval
*
ber_mem2bv
(
LDAP_CONST
char
*
s
,
ber_len_t
len
,
int
dup
,
struct
berval
*
bv
)
{
struct
berval
*
new
;
ber_int_options
.
lbo_valid
=
LBER_INITIALIZED
;
if
(
s
==
NULL
||
len
==
0
)
{
ber_errno
=
LBER_ERROR_PARAM
;
return
NULL
;
}
if
(
bv
)
{
new
=
bv
;
}
else
{
if
((
new
=
LBER_MALLOC
(
sizeof
(
struct
berval
)
))
==
NULL
)
{
ber_errno
=
LBER_ERROR_MEMORY
;
return
NULL
;
}
}
new
->
bv_len
=
len
;
if
(
dup
)
{
if
(
(
new
->
bv_val
=
LBER_MALLOC
(
new
->
bv_len
+
1
))
==
NULL
)
{
ber_errno
=
LBER_ERROR_MEMORY
;
if
(
!
bv
)
LBER_FREE
(
new
);
return
NULL
;
}
AC_MEMCPY
(
new
->
bv_val
,
s
,
new
->
bv_len
);
new
->
bv_val
[
new
->
bv_len
]
=
'\0'
;
}
else
{
new
->
bv_val
=
(
char
*
)
s
;
}
return
(
new
);
}
char
*
ber_strdup
(
LDAP_CONST
char
*
s
)
{
...
...
servers/slapd/schema_init.c
View file @
39891e4e
...
...
@@ -522,7 +522,7 @@ UTF8StringNormalize(
struct
berval
*
val
,
struct
berval
*
normalized
)
{
char
*
p
,
*
q
,
*
s
;
char
*
p
,
*
q
,
*
s
,
*
e
;
int
len
=
0
;
p
=
val
->
bv_val
;
...
...
@@ -537,14 +537,15 @@ UTF8StringNormalize(
return
LDAP_INVALID_SYNTAX
;
}
ber_str2bv
(
p
,
val
->
bv_len
-
(
p
-
val
->
bv_val
),
1
,
normalized
);
ber_mem2bv
(
p
,
val
->
bv_len
-
(
p
-
val
->
bv_val
),
1
,
normalized
);
e
=
normalized
->
bv_val
+
val
->
bv_len
-
(
p
-
val
->
bv_val
);
assert
(
normalized
->
bv_val
);
p
=
q
=
normalized
->
bv_val
;
s
=
NULL
;
while
(
*
p
)
{
while
(
p
<
e
)
{
q
+=
len
;
if
(
ASCII_SPACE
(
*
p
)
)
{
s
=
q
-
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