[python-ldap] ValueError: option error on trying to set OPT_X_TLS_CACERTFILE

Michael Ströder michael at stroeder.com
Tue Feb 9 04:03:06 EST 2016


Peter Bengtsson wrote:
> The error happens before initialize, but I played with setting _trace_level
> 
>>>> import ldap
>>>> ldap._trace_level = 7
>>>>
> CACERTFILE='/Users/peterbe/dev/MOZILLA/MEDLEM/ldap-bind/medlem/ldapproxy-medlem.crt'
>>>> ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, CACERTFILE)
> *** _ldap.set_option ((24578,
> 
> '/Users/peterbe/dev/MOZILLA/MEDLEM/ldap-bind/medlem/ldapproxy-medlem.crt'),
>  {})
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File
> "/Users/peterbe/virtualenvs/medlem/lib/python2.7/site-packages/python_ldap-2.4.25-py2.7-macosx-10.11-x86_64.egg/ldap/functions.py",
> line 133, in set_option
>     return _ldap_function_call(None,_ldap.set_option,option,invalue)
>   File
> "/Users/peterbe/virtualenvs/medlem/lib/python2.7/site-packages/python_ldap-2.4.25-py2.7-macosx-10.11-x86_64.egg/ldap/functions.py",
> line 64, in _ldap_function_call
>     result = func(*args,**kwargs)
> ValueError: option error

Note that python-ldap's tracing only logs the Python API calls.

In this particular case it'd be more helpful to enable libldap's own logging
like this:

ldap.set_option(ldap.OPT_DEBUG_LEVEL,255)
ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, CACERTFILE)

Ciao, Michael.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4245 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20160209/fa124dc4/attachment-0001.bin>


More information about the python-ldap mailing list