-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Factor base64 conversions out of authentication procedures #6654
Conversation
Congratulations 🎉. DeepCode analyzed your code in 2.831 seconds and we found no issues. Enjoy a moment of no bugs ☀️. 👉 View analysis in DeepCode’s Dashboard | Configure the bot |
18f4d1a
to
8d53645
Compare
Suggestions:
To ponder: In the dynbuf systems we enforce a maximum buffer size at all times to avoid the risk that ridiculously sized values can get set, that then will lead to badness in places (like integer overflows). An extra internal layer of defense. Would it be sensible to make the *set() function refuse to set strings larger than |
I restricted this to
Much less than for |
Yeah, at least I want to have the ability to do so, and if/when that time comes it will be odd to have this name! I'm not sure the exact name is terribly important as we'll learn it and associate it with the use we assign to it. It primarily keeps a reference to a (generic) buffer and size. Maybe just call it |
a2cf45d
to
d8d4045
Compare
Now split in 2 commits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a big fan!
@bagder : thanks for your review. Fixups applied according to your remarks. |
4342db5
to
405e73f
Compare
@bagder : do you intend to apply this? are you waiting for the next feature window?
Do I wait for this PR to be pulled or do I include the above in this PR ? |
Why do you need bufref, can't you use dynbuf? I know you said earlier realloc isn't needed but dynbuf would work well anyway wouldn't it? If separate handling is in fact needed it should have documentation. See docs/DYNBUF.md for example.
Those extra things you listed sound great but not related to this. You could always branch off this PR. I'm for next feature window for this one. |
No, you can't. bufref's goal is to hold pointers to (preallocated) data and their associated destructor, if some. This allows using static data or data allocated with possibly something else than
As it was originally a tiny sasl-private API, I did not document it. If it should be used more widely, so yes, I could write such a document. |
docs/BUFREF.md added |
b5a2dca
to
34ea28f
Compare
d475196
to
d893f3c
Compare
A struct bufref holds a buffer pointer, a data size and a destructor. When freed or its contents are changed, the previous buffer is implicitly released by the associated destructor. The data size, although not used internally, allows binary data support. A unit test checks its handling methods.
Input challenges and returned messages are now in binary. Conversions from/to base64 are performed by callers (currently curl_sasl.c and http_ntlm.c).
Thanks! |
Input challenges and returned messages are now in binary. Conversions from/to base64 are performed by callers (currently curl_sasl.c and http_ntlm.c). Closes #6654
Thanks for pulling. |
Input challenges and returned messages are now in binary.
Conversions from/to base64 are performed by callers (currently curl_sasl.c
and http_ntlm.c).
Binary data control structure authbuffer is introduced with associated
handling primitives. This supports any kind of memory storage, whatever
is the allocation scheme.
This is a first step towards the implementation of binary sasl that will allow full authentication features in openldap.