It might not be an issue with auth_ldap.py

On Tue, Mar 13, 2018 at 12:29 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> It works fine...
>
> On Tue, Mar 13, 2018 at 12:28 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> I try with a module of mine using ldap and had issues with ldapS
>> connection...
>>
>> I had to follow this :
>>
>> https://github.com/python-ldap/python-ldap/issues/55
>>
>> l = ldap.initialize("ldaps://{s}:{p}".format(s=server, p=636))
>> l.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
>> # l.set_option(ldap.OPT_X_TLS_CACERTFILE, 'path/to/ca.pem')  # Wasn't
>> required...
>> l.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap. OPT_X_TLS_NEVER)
>> l.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
>>
>> Then it connected properly under python3 only...
>>
>> Will make some test in python2 if the back port of the above cause any
>> issue...
>>
>> Richard
>>
>>
>> On Tue, Mar 13, 2018 at 11:58 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Please try this :
>>>
>>> sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
>>> # setuptools should be there... I was miss leading...
>>> sudo pip3 install python-ldap
>>>
>>> Please provide progress as if auth_ldap.py works properly with python3
>>> once you install python-ldap properly under python3.
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>>
>>> On Tue, Mar 13, 2018 at 11:39 AM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
>>>> I open this issue :
>>>>
>>>> https://github.com/python-ldap/python-ldap/issues/181
>>>>
>>>> On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina <
>>>> ml.richard.vez...@gmail.com> wrote:
>>>>
>>>>> python3-ldap -> ldap3 (https://pypi.python.org/pypi/
>>>>> python3-ldap/0.9.8.4/) is not the same thing as python-ldap...
>>>>>
>>>>> It seems that python-ldap support python 3 :
>>>>>
>>>>> https://github.com/python-ldap/python-ldap
>>>>>
>>>>> Saddly enough, I hadn't successfully install python-ldap under python3
>>>>> with pip3... It fails over importing setuptools issue... Setuptools is
>>>>> installed, so I wonder what going on...
>>>>>
>>>>> It seems to be working with python 3.4+ : https://www.python-ldap.org/
>>>>> en/latest/installing.html#build-prerequisites
>>>>>
>>>>> If you have ubuntu you can try on your side :
>>>>>
>>>>> sudo pip3 install -U setuptools
>>>>> sudo pip3 install python-ldap
>>>>>
>>>>>
>>>>> It would be nice if python-ldap just works under python3 as we
>>>>> wouldn't have to touch ldap_auth.py as python-ldap should have keep the
>>>>> same API under python3...
>>>>>
>>>>> Though ldap3 seems to offer interresting progres, but I didn't try it.
>>>>>
>>>>> Please keep posting here your progress.
>>>>>
>>>>> Thanks
>>>>>
>>>>> Richard
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies <johann.sp...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Version 2.16.1
>>>>>>
>>>>>> In python (2.7) I can do:
>>>>>>
>>>>>> python web2py.py -S welcome
>>>>>> ..
>>>>>>
>>>>>> In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth
>>>>>>
>>>>>> In [2]:
>>>>>>
>>>>>> But not when I use python3 (and I have python3-ldap installed).
>>>>>>
>>>>>>
>>>>>> ```
>>>>>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>>>>>> globals, locals, fromlist, level)
>>>>>>     109                 import_tb = None
>>>>>>     110
>>>>>> --> 111     return NATIVE_IMPORTER(name, globals, locals, fromlist,
>>>>>> level)
>>>>>>     112
>>>>>>     113
>>>>>>
>>>>>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in
>>>>>> <module>()
>>>>>>      12 except Exception as e:
>>>>>>      13     logging.error('missing ldap, try "easy_install
>>>>>> python-ldap"')
>>>>>> ---> 14     raise e
>>>>>>      15
>>>>>>      16
>>>>>>
>>>>>> /home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in
>>>>>> <module>()
>>>>>>       7 import logging
>>>>>>       8 try:
>>>>>> ----> 9     import ldap
>>>>>>      10     import ldap.filter
>>>>>>      11     ldap.set_option(ldap.OPT_REFERRALS, 0)
>>>>>>
>>>>>> /home/js/web2py/gluon/custom_import.py in custom_importer(name,
>>>>>> globals, locals, fromlist, level)
>>>>>>     102                 return NATIVE_IMPORTER(name, globals, locals,
>>>>>> fromlist, level)
>>>>>>     103             except (ImportError, KeyError) as e3:
>>>>>> --> 104                 raise ImportError(e1, import_tb)  # there an
>>>>>> import error in the module
>>>>>>     105         except Exception as e2:
>>>>>>     106             raise  # there is an error in the module
>>>>>>
>>>>>> ImportError: (ImportError("Cannot import module
>>>>>> 'applications.welcome.modules.ldap'",), <traceback object at
>>>>>> 0x7fe54161fd88>)
>>>>>>
>>>>>> ```
>>>>>>
>>>>>> It seems to me like a bug?
>>>>>>
>>>>>> Regards
>>>>>> Johann
>>>>>>
>>>>>> --
>>>>>> Because experiencing your loyal love is better than life itself,
>>>>>> my lips will praise you.  (Psalm 63:3)
>>>>>>
>>>>>> --
>>>>>> Resources:
>>>>>> - http://web2py.com
>>>>>> - http://web2py.com/book (Documentation)
>>>>>> - http://github.com/web2py/web2py (Source code)
>>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>>>> ---
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "web2py-users" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to web2py+unsubscr...@googlegroups.com.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to