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
Joe Martin
OpenLDAP
Commits
bc2558eb
Commit
bc2558eb
authored
Nov 26, 2017
by
Hallvard Furuseth
Committed by
Quanah Gibson-Mount
Feb 09, 2018
Browse files
ITS#8778 Fix telephoneNumberNormalize("-" or " ")
parent
c9fb4f51
Changes
1
Hide whitespace changes
Inline
Side-by-side
servers/slapd/schema_init.c
View file @
bc2558eb
...
...
@@ -2225,7 +2225,7 @@ approxFilter(
return
LDAP_SUCCESS
;
}
/* Remove all spaces and '-' characters */
/* Remove all spaces and '-' characters
, unless the result would be empty
*/
static
int
telephoneNumberNormalize
(
slap_mask_t
usage
,
...
...
@@ -2239,8 +2239,11 @@ telephoneNumberNormalize(
assert
(
SLAP_MR_IS_VALUE_OF_SYNTAX
(
usage
)
!=
0
);
/* validator should have refused an empty string */
assert
(
!
BER_BVISEMPTY
(
val
)
);
/* Ensure q is big enough, though validator should have caught this */
if
(
BER_BVISEMPTY
(
val
))
{
BER_BVZERO
(
normalized
);
return
LDAP_INVALID_SYNTAX
;
}
q
=
normalized
->
bv_val
=
slap_sl_malloc
(
val
->
bv_len
+
1
,
ctx
);
...
...
@@ -2249,16 +2252,13 @@ telephoneNumberNormalize(
*
q
++
=
*
p
;
}
}
if
(
q
==
normalized
->
bv_val
)
{
*
q
++
=
' '
;
}
*
q
=
'\0'
;
normalized
->
bv_len
=
q
-
normalized
->
bv_val
;
if
(
BER_BVISEMPTY
(
normalized
)
)
{
slap_sl_free
(
normalized
->
bv_val
,
ctx
);
BER_BVZERO
(
normalized
);
return
LDAP_INVALID_SYNTAX
;
}
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