-
Notifications
You must be signed in to change notification settings - Fork 2
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
Unencrypted support connections plus proxy support #32
base: master
Are you sure you want to change the base?
Conversation
Thaodan
commented
Sep 25, 2022
•
edited
Loading
edited
- Contributes to Purple-Rocket Chat behind SSL-ClientAuthentication #30.
2810565
to
f3798c1
Compare
Everything works now except that in Bitlbee the select encryption option somehow doesn't work, have to check. |
1010377
to
e67378f
Compare
Works now in Bitlbee too, Bitlbee didn't like the reverse option list. |
Might also want to check that all the tabs didn't turn into spaces before you mark it as ready to merge :) |
e67378f
to
1dfbaf3
Compare
Fixing that right now. Are you open to adding editorconfig to the repo to avoid such issues in the future? |
Sounds good :) |
b240888
to
463b195
Compare
|
||
|
||
if (ya->websocket_server != ya->server) { | ||
host = g_strdup(ya->websocket_server); |
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.
Does this leak the memory of the old host
? Need g_free(host)
before assign?
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.
Do I need to do so? host is just a plain char array without malloc created in the purple function.
if (ya->websocket != NULL) | ||
purple_ssl_close(ya->websocket); | ||
else if (ya->fd > 0) { | ||
if (ya->pc->inpa) |
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.
is pc->inpa
exposed through a function rather than direct struct access? If so can we use that func for forwards compatibility?
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.
Purples Jabber plugin also uses the same way to access pc. The pc is part of the account structure, I'm not sure how that would change with Purple 3.x but I don't see any of that so far.
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.
Purple 3 makes all the eg PurpleConnection
and PurpleAccount
structs private
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.
Oh it seams I should have used ya->inpa
instead.
Purple 3.x would do g_source_remove(ya->inpa).
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 kept that part as Purple 2.x does it the same for Jabber.
The Purple 3.x section would look differently anyway..
The plugin "uses" purple_ssl_connect
for Purple 3.x however this has been removed and replaced by Gio.
E.g. see here:
https://keep.imfreedom.org/pidgin/pidgin/file/tip/libpurple/protocols/jabber/jabber.c#l686
I would favor to merge this section as is and the Purple 3.x support should be fixed in another PR (#33).
"connection_security", encryption_values); | ||
account_options = g_list_append(account_options, option); | ||
|
||
option = purple_account_option_string_new(N_("Proxy"), "proxy", ""); |
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.
There's proxy options available in the libpurple api that can be used instead from the proxy tab using the PurpleProxyInfo
stuff in purple_proxy_get_setup()
https://docs.imfreedom.org/pidgin2/proxy_8h.html#a6995e6f63718dcd8644b9d4ef471392a if that makes things easier?
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.
The thing is that isn't really a "proxy", it's more like using another host instead of the real host.
It works by using either stunnel or socat as an ssl proxy - both work fine from my tests.
I'm not sure, does using purple_proxy_get_setup()
set anything else?
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.
Oh right! This is so you can add in the client cert? Just putting 2 and 2 together now. With a label like "proxy" I wouldn't want anyone to get tripped up with the other Proxy tab.
Naming stuff is hard.
What about "intermediate server"?
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.
What about "intermediate server"?
Isn't that also a proxy? I think proxy is accurate.
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.
Oh right! This is so you can add in the client cert? Just putting 2 and 2 together now. With a label like "proxy" I wouldn't want anyone to get tripped up with the other Proxy tab.
Yes this and the unencrypted connection so there's no SSL twice.
Awesome stuff! |
- Always initialize variables, ping_frame_len was uninitialized in some cases. - Remove redundant else after if websocket closed switch to goto try_reconnect section. - Handle also errno EINPROGRESS and ENOENT - Indent Signed-off-by: Björn Bidar <[email protected]>
- Abstract all operations that affect sockets into small wrappers - Initialize either TLS or proxy connection depending on the setting Signed-off-by: Björn Bidar <[email protected]>
The option allows the use of a proxy server that is used instead of the real server. Since the real server is still needed inside `rc_socket_upgrade()` we still have to keep it for that. Signed-off-by: Björn Bidar <[email protected]>
Read below for more: https://editorconfig.org/ Signed-off-by: Björn Bidar <[email protected]>
g_memdump is deprecated in glib 2.68.0. Signed-off-by: Björn Bidar <[email protected]>
Signed-off-by: Björn Bidar <[email protected]>
df283d9
to
b889eb7
Compare