server sort

Anil anilj at
Mon Jul 6 05:28:49 CEST 2009

I am having a bit of a problem trying to setup the controlValue in 
LDAPControl for doing server sorting. My LDAP server supports this 
control, but I keep getting back Not supported error. Clearly this is a 
problem on my end with how I am passing in controlValue.

I am not that familiar with BER encoding.

So, from what I've found, I tried doing something like this:

from pyasn1.type import univ, namedtype
from pyasn1.codec.ber import encoder

seq = univ.Sequence(

control = [ldap.controls.LDAPControl('1.2.840.113556.1.4.473',True,seq)]

I then pass control to LDAPObject.search_ext().

That doesn't work, and I am sure I massacred my intepretation of using 
the pyasn1 module. Unfortunately, the documentation for it is not clear 
to me.

Any tips?


More information about the python-ldap mailing list