From: Michael S. <mi...@st...> - 2010-01-31 14:58:24
|
Zhang Huangbin wrote: > How can i add a booleanMatch type attribute with py-ldap? Simply like any other attribute provided your attribute value is TRUE or FALSE. > Refer to python-ldap-2.3.10/Demo/ldapcontrols.py, i use below code to add new attribute: > > ---- > l = ldap.initialize('ldap://localhost:389',trace_level=2) > l.add_ext_s(dn, modlist, serverctrls=[ BooleanControl('1.3.6.1.4.1.4203.1.10.1',1,1) ],) ??? Here you are using the Subentries control with an LDAP AddRequest. AFAIK this control (which is not an attribute) is only applicable to SearchRequests (see RFC 3672). What made you write this code? > ---- > > But i got this error message: > ---- > => result: 2 > *** ldap://127.0.0.1:389/ - SimpleLDAPObject.result3 ((2, 1, -1),{}) > => LDAPError - UNAVAILABLE_CRITICAL_EXTENSION: {'info': 'critical extension is not recognized', 'desc': 'Critical extension is unavailable'} > ---- The server does not support this control for processing this request. Well, that looks correct to me. > I use amavisd-new attribute: > ---- > attributetype ( 1.3.6.1.4.1.15312.2.2.1.19 > NAME 'amavisLocal' > DESC 'Is user considered local' > EQUALITY booleanMatch > SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 > SINGLE-VALUE ) > ---- I don't see any need to use a LDAPv3 extended control to simply populate this attribute (once it's added to the schema). Ciao, Michael. |