ldap.ENCODING_ERROR when trying to use SimplePageResultsControl

Zhang Huangbin zhbmaillistonly at gmail.com
Tue Mar 17 04:23:42 CET 2009


Michael Ströder wrote:
> This patch seems to work (already installed at your site ;-).
>
> Ciao, Michael.
>
> Index: Modules/ldapcontrol.c
> ===================================================================
> RCS file: /cvsroot/python-ldap/python-ldap/Modules/ldapcontrol.c,v
> retrieving revision 1.10
> diff -u -r1.10 ldapcontrol.c
> --- Modules/ldapcontrol.c	16 Mar 2009 14:54:55 -0000	1.10
> +++ Modules/ldapcontrol.c	16 Mar 2009 17:29:04 -0000
> @@ -300,11 +300,13 @@
>      ber_tag_t tag;
>      struct berval *cookiep;
>      unsigned long count;
> +    Py_ssize_t ldctl_value_len;
>
>      if (!PyArg_ParseTuple(args, "s#:decode_page_control",
>                            &ldctl_value.bv_val, &ldctl_value.bv_len)) {
>          goto endlbl;
>      }
> +    ldctl_value.bv_len = (ber_len_t) ldctl_value_len;
>
>      if (!(ber = ber_init(&ldctl_value))) {
>          LDAPerr(LDAP_NO_MEMORY);
>
>   
Hi, Michael.

Something strange.

The server your tested is CentOS 5.2 x86_64, and it works with your 
patched version.

But on RHEL 5.3 x86_64, it raises ldap.NO_MEMORY error:
----
# python 1.py
Getting page 1
Traceback (most recent call last):
  File "1.py", line 30, in ?
    rtype, rdata, rmsgid, serverctrls = l.result3(msgid)
  File "/usr/lib64/python2.4/site-packages/ldap/ldapobject.py", line 
443, in result3
    decoded_serverctrls = DecodeControlTuples(serverctrls)
  File "/usr/lib64/python2.4/site-packages/ldap/controls.py", line 122, 
in DecodeControlTuples
    return [
  File "/usr/lib64/python2.4/site-packages/ldap/controls.py", line 74, 
in __init__
    
LDAPControl.__init__(self,ldap.LDAP_CONTROL_PAGE_OID,criticality,controlValue,encodedControlValue)
  File "/usr/lib64/python2.4/site-packages/ldap/controls.py", line 33, 
in __init__
    self.controlValue = controlValue or 
self.decodeControlValue(encodedControlValue)
  File "/usr/lib64/python2.4/site-packages/ldap/controls.py", line 81, 
in decodeControlValue
    size,cookie = _ldap.decode_page_control(encodedValue)
ldap.NO_MEMORY
----

But i don't have a public RHEL 5.3 x86_64 server. :(


-- 
Best regards.

Zhang Huangbin

- Open Source Mail Server Solution for RHEL/CentOS 5.x:
  http://code.google.com/p/iredmail/




More information about the python-ldap mailing list