mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-30 13:30:57 +08:00
Passes last test (empty value); also passes many of the invalid DN tests if liberal parsing is allowed
This commit is contained in:
parent
e15aa7b682
commit
e5f503c24a
@ -689,7 +689,20 @@ ldap_str2dn( const char *str, LDAPDN **dn, unsigned flags )
|
|||||||
tmpDN[nrdns++] = newRDN;
|
tmpDN[nrdns++] = newRDN;
|
||||||
newRDN = NULL;
|
newRDN = NULL;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/*
|
||||||
|
* prone to attacks?
|
||||||
|
*/
|
||||||
assert (nrdns < TMP_SLOTS);
|
assert (nrdns < TMP_SLOTS);
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
* make the static AVA array dynamically rescalable
|
||||||
|
*/
|
||||||
|
if (nrdns >= TMP_SLOTS) {
|
||||||
|
rc = LDAP_DECODING_ERROR;
|
||||||
|
goto parsing_error;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( p[ 0 ] == '\0' ) {
|
if ( p[ 0 ] == '\0' ) {
|
||||||
/*
|
/*
|
||||||
@ -1037,7 +1050,12 @@ ldap_str2rdn( const char *str, LDAPRDN **rdn, const char **n, unsigned flags )
|
|||||||
* here STRING means RFC 2253 string
|
* here STRING means RFC 2253 string
|
||||||
* FIXME: what about DCE strings?
|
* FIXME: what about DCE strings?
|
||||||
*/
|
*/
|
||||||
|
if ( !p[ 0 ] ) {
|
||||||
|
/* empty value */
|
||||||
|
state = GOTAVA;
|
||||||
|
} else {
|
||||||
state = B4STRINGVALUE;
|
state = B4STRINGVALUE;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B4BINARYVALUE:
|
case B4BINARYVALUE:
|
||||||
@ -1101,12 +1119,16 @@ ldap_str2rdn( const char *str, LDAPRDN **rdn, const char **n, unsigned flags )
|
|||||||
*/
|
*/
|
||||||
ava = ldapava_new( &attrType, &attrValue,
|
ava = ldapava_new( &attrType, &attrValue,
|
||||||
attrValueEncoding );
|
attrValueEncoding );
|
||||||
|
|
||||||
if ( ava == NULL ) {
|
if ( ava == NULL ) {
|
||||||
rc = LDAP_NO_MEMORY;
|
rc = LDAP_NO_MEMORY;
|
||||||
goto parsing_error;
|
goto parsing_error;
|
||||||
}
|
}
|
||||||
tmpRDN[navas++] = ava;
|
tmpRDN[navas++] = ava;
|
||||||
|
|
||||||
|
attrValue.bv_val = NULL;
|
||||||
|
attrValue.bv_len = 0;
|
||||||
|
|
||||||
assert(navas < TMP_SLOTS);
|
assert(navas < TMP_SLOTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user