-
Notifications
You must be signed in to change notification settings - Fork 21
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
Only escape login and password for ldap query, not for connection #29
base: master
Are you sure you want to change the base?
Only escape login and password for ldap query, not for connection #29
Conversation
I don't see any functional changes here other than some renaming of variables. What am I missing? Edit: Another read through the code and I understand what this is doing now, but why do we not need to escape the password before we pass it to a connection? |
I removed:
And only escape them in call to Because it create an issue when escaping password before I can remove the parameters renaming if you think it is more compatible with current master. |
@bertjwregeer I see no functional changes in this PR. What does this PR actually change? @arnaud-morvan can you give an example of the issue? We will need a test case that we can reproduce. Thank you! |
@stevepiercy expand out the code in that function so you can see even the non-changed parts. Instead of always escaping the username/password it now only escapes them in one single part of the code. I don't know enough about the ldap code to know if that is correct or not, as I don't use this module. But it does make a functional change. Not sure I would have changed the variable names as I think that is adding to the confusion. |
Yes, for that one part of the code. So since that escaping only happens in one place, now the rest of the function (hidden by the "see more" (which also confused me at first)) still has a use of the value that is unescaped. |
@bertjwregeer I was not using GitHub's UI because it hides context and bit me, too. I am using PyCharm and checked out the branch for the PR to run tests on both branches and use a debugger. I did that because you said there is a functional change, but unless I misinterpret the debugger results, there is no functional difference. Are you talking about the code only within the The only other place I see Finally I noticed this in the docstring, so maybe this whole PR is moot.
|
This line: Is no longer using the filtered/escaped username/password instead it is using the original provided values that were passed to the function. So the change is that there is filtering going on here: Which means that this is a functional change. |
@bertjwregeer OK, now I see. Thank you! Here's the debug for master and this PR in that try/except. master
this PR
Back to your original question...
I have the same question. I would think that we want to pass in a safe, escaped password. Passing in an unsafe, unescaped password sounds bad. @arnaud-morvan would you please respond? Thank you! |
If I correctly remember, escaping is for characters like parenthesys which have special meaning in filters. But it result in a failed authentication in I can remove the parameters renaming if needed. |
For the record, here is the function in python-ldap that escapes characters. Escaping depends on mode, with the default of
Can you verify in an actual LDAP deployment that this is true, perhaps using the example username
I think that reverting the variable renaming would make the code much clearer. |
No description provided.