-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in bind_user method #44
Comments
I can't just do that, because it will break for someone else. The current code actually works for me on Python 3.6.3 as well. I am trying to figure out why it doesn't work for some people. Tell me, are you using OpenLDAP as your LDAP server? |
Running an Active Directory server. |
Can we add this?
|
Or if you're just dealing with py3 compatibility: if sys.version_info < (3,):
conn.simple_bind_s(user_dn, password)
else:
conn.simple_bind_s(user_dn.decode('utf-8'), password) @rfaoro-gpsw how about you create a fork and request @AdmiralObvious for a pull? |
@pschwede I can't do that because python 3 doesn't support string decoding. What about this:
(Yes, I can create a fork and request @AdmiralObvious for a pr) |
I confirm that this is MAY not a py 3 problem, it seems to be an openldap as you said @AdmiralObvious here's a simple test with a basic openldap container.
Then in a python script
the result is
to make this work with openldap you need https://github.com/admiralobvious/flask-simpleldap/blob/master/flask_simpleldap/__init__.py#L190 you return [0][0] which is a string and not a bytes. so to "keep it the same for everyone else" you could That being said here's a disclaimer:
|
i crafted a little monkey patch, works for me:
Have a nice day :) |
@ltpitt not much to explain doc says do
just use my method on the first line
|
Thanks for answering, @lindycoder . Here's my attempt:
With correct credentials I get:
Really thanks for your time and patience |
I've also added a |
@ltpitt this does not look like the same problem. The problem in this thread is string vs bytes and my monkey patch fixes this by introducing these lines:
(Which must be line 33-34 in your file) in your stack trace i see this:
which happens on line 28 So it happens before my fix in my monkey patch so i guess you have another issue completely |
Merge this commit please: jm66@e537f26 |
Same issue, solved applying @lindycoder code. |
Fixes #44 - Error in bind_user method
I'm on Python 3.6.3 and I get this exception when I hit
line 153
in__init__.py
(https://github.com/admiralobvious/flask-simpleldap/blob/master/flask_simpleldap/__init__.py#L153):AttributeError: 'str' object has no attribute 'decode'
I changed it back to a recent commit you had in v1.1.2, which fixed the issue:
conn.simple_bind_s(user_dn, password)
(instead of
conn.simple_bind_s(user_dn.decode('utf-8'), password)
)Can we get that fix back?
The text was updated successfully, but these errors were encountered: