feat: Add username/password SOCKS5 auth#1683
Conversation
|
@nurupo Does this still need testing? I'm willing to test it. |
|
Yep, so far no one has tested it as far as I'm aware. |
1f15b48 to
b5f2735
Compare
abbf3db to
bbb3a45
Compare
|
Fixed a couple of issues I have noticed after reviewing with a fresh set of eyes. |
|
I managed to verify that SOCKS5 authenticated connections work. Currently I've only tested with |
|
Update: I managed to verify that SOCKS5 authenticated connections work in qTox too. When using correct credentials, the client connects to a TCP relay and all traffic goes through it. In the case of incorrect credentials or lack of credentials, qTox fails to connect. In all cases, I noticed this in the log: EDIT (comment from IRC): |
|
Cool, thanks for testing.
This is a qTox-specific thing, it says nothing about toxcore or this PR working or non-working. Would be great if someone else could test this too, I'm not too sure if @cryptogospod tested it correctly. The way it should have been tested, that Since @cryptogospod has asked this on IRC, I want to point it out here too: for this to be merged, there are a few more steps that need to be done:
|
|
@nurupo I walked through testing with qTox with @cryptogospod at the time, the diff was adding the calls to the new API here: https://github.com/qTox/qTox/blob/da5c165f4116dce736def63b1b917523b848db09/src/core/toxoptions.cpp#L133. The Agreed that the error doesn't say anything about toxcore, but I do think that @cryptogospod's testing showing that toxcore either connects or doesn't connect when using the proxy with the correct or incorrect password shows password support's working. |
|
Ok, makes sense and also explains why That's a valid way to test it too, so it sounds like it was tested correctly. |
|
@nurupo what's the state of this? Can it be merged? Mentioned in: |
3a40adf to
e4203a3
Compare
|
@Green-Sky done |
| * @brief Owned pointer to the SOCKS5 proxy username. | ||
| * @private | ||
| */ | ||
| uint8_t *owned_proxy_socks5_username; |
There was a problem hiding this comment.
We're introducing new data members here. Do we need them to not be owned by default as well?
There was a problem hiding this comment.
That would make the API inconsistent - some things are not owned and require a flag to be set, but others are owned.
There was a problem hiding this comment.
Does it functionally matter? If clients think it's not owned, they will save their pointers. If they enable the flag or happen to know that it is owned, they don't. It's making things more complicated, and 0.3.0 will get rid of this un-owned mode entirely.
There was a problem hiding this comment.
I believe I got this addressed now.
Per the IRC discussion:
<iphy> Maybe name the fields internal_do_not_set_directly_proxy_socks5_username etc
<iphy> No new code should be setting those fields, and we shouldn't build complexity to cover for that case
169bd2f to
bd81c1f
Compare
c3f5aa8 to
083bfd4
Compare
|
This PR is currently blocked waiting on @iphydf to make cimple accept a pointer-to-pointer so that the CI on here passes. I could bypass the need to use a pointer to pointer by rewriting the helper function as a macro instead, but the less we use macros - the better, or at least so I think, as they are harder to grok. |
083bfd4 to
acc173e
Compare
I wasn't aware that we had decided that pointer to pointer is the way to go. I'll have another look at the code. |
Fixes #1682
Not tested. Can someone with a SOCKS5 proxy with username/password test this?
I'm not sure how to prevent APIDSL from generating
tox_options_set_proxy_socks5_username_length()andtox_options_set_proxy_socks5_password_length()function declarations. Those seem pointless as the user already sets the length intox_options_set_proxy_socks5_username()andtox_options_set_proxy_socks5_password(). Savedata has the same issue with a pointlesstox_options_set_savedata_length().This change is