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

Peter Bengtsson pbengtsson at mozilla.com
Tue Feb 9 07:19:39 EST 2016


On Tue, Feb 9, 2016 at 4:03 AM, Michael Ströder <michael at stroeder.com>
wrote:

> 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)
>
>
No luck :(

(medlem) :~/dev/MOZILLA/MEDLEM/ldap-bind/medlem$ cat test.py
import ldap
ldap.set_option(ldap.OPT_DEBUG_LEVEL,255)
CACERTFILE='/Users/peterbe/dev/MOZILLA/MEDLEM/ldap-bind/medlem/ldapproxy-medlem.crt'
ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, CACERTFILE)
(medlem) :~/dev/MOZILLA/MEDLEM/ldap-bind/medlem$ python test.py
Traceback (most recent call last):
  File "test.py", line 4, in <module>
    ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, CACERTFILE)
  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

Nothing comes out on stderr.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20160209/cd843792/attachment.html>


More information about the python-ldap mailing list