nhosoi(a)gmail.com wrote:
> Full_Name: Noriko Hosoi
> Version: 2.4.35-4
> OS: Fedora 18
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (209.132.181.86)
>
>
> We use the OpenLdap library in our software. LDAP clients could send too large
> ber and cause LBER_OVERFLOW (or LBER_DEFAULT) to the lber APIs. We'd like to
> learn how large the ber size we should prepare from the error. When we look
> into the BerElement ber using gdb, ber->ber_len stores the value. But the value
> is not returned to the caller when the API fails, e.g., by the overflow. Could
> it be possible to have a way to retrieve the ber size under any condition?
That doesn't sound like OpenLDAP, we have no LBER_OVERFLOW error code. Nor do
we have any particular size limits on a BerElement, other than fitting into a
long.
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
Full_Name: Noriko Hosoi
Version: 2.4.35-4
OS: Fedora 18
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (209.132.181.86)
We use the OpenLdap library in our software. LDAP clients could send too large
ber and cause LBER_OVERFLOW (or LBER_DEFAULT) to the lber APIs. We'd like to
learn how large the ber size we should prepare from the error. When we look
into the BerElement ber using gdb, ber->ber_len stores the value. But the value
is not returned to the caller when the API fails, e.g., by the overflow. Could
it be possible to have a way to retrieve the ber size under any condition?
marc.schmitzer(a)richard-wolf.com wrote:
> Full_Name: Marc Schmitzer
> Version: 2.4.28
> OS: Linux
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (217.6.229.211)
>
>
> The ldap_dn2bv_x function misbehaves for the LDAPV2 and LDAPV3 formats when it
> is passed an "empty" DN in the form of an LDAPRDN-array whose first element is
> NULL. The "len" variable remains zero throughout the function, as no RDNS are
> processed. Finally, the bv_len member of the output struct berval is set to
> len-1. The result is a berval with bv_len = UINT_MAX.
>
> Tested with 2.4.28, but the problem appears to present in the current git master
> as well.
Thanks for the report, fixed now in git master.
>
> The following code snippet demonstrates the problem:
>
> #include <stdio.h>
> #include <ldap.h>
>
> int main(int argc, char** argv)
> {
> LDAPRDN dn[1] = { NULL };
> struct berval bv = { 0, NULL };
> int res = ldap_dn2bv(dn, &bv, LDAP_DN_FORMAT_LDAPV3);
>
> printf("res: %d\n", res);
> printf("len: %u\n", (unsigned int) bv.bv_len);
>
> return 0;
> }
>
>
> Output:
> res: 0
> len: 4294967295
>
>
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
Full_Name: Marc Schmitzer
Version: 2.4.28
OS: Linux
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (217.6.229.211)
The ldap_dn2bv_x function misbehaves for the LDAPV2 and LDAPV3 formats when it
is passed an "empty" DN in the form of an LDAPRDN-array whose first element is
NULL. The "len" variable remains zero throughout the function, as no RDNS are
processed. Finally, the bv_len member of the output struct berval is set to
len-1. The result is a berval with bv_len = UINT_MAX.
Tested with 2.4.28, but the problem appears to present in the current git master
as well.
The following code snippet demonstrates the problem:
#include <stdio.h>
#include <ldap.h>
int main(int argc, char** argv)
{
LDAPRDN dn[1] = { NULL };
struct berval bv = { 0, NULL };
int res = ldap_dn2bv(dn, &bv, LDAP_DN_FORMAT_LDAPV3);
printf("res: %d\n", res);
printf("len: %u\n", (unsigned int) bv.bv_len);
return 0;
}
Output:
res: 0
len: 4294967295