mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Don't crash when using /plugins install
disconnected
When we are not connected and run `/plugins install` we crash because we get the account struct to check for the (xmpp) tls setting. To apply that to the http (etc) connection to download the plugin from a server. This got introduced in 3a86b8c29 to fix #1624. There are several ways to handle this (some described in 1880) in this patch I took the route that it will use secure connection when we are nto connected and will only check the tls.trust account setting if we are connected. Fix https://github.com/profanity-im/profanity/issues/1880
This commit is contained in:
parent
65d62dbf49
commit
b88174709f
@ -134,7 +134,10 @@ http_file_get(void* userdata)
|
||||
gchar* cert_path = prefs_get_string(PREF_TLS_CERTPATH);
|
||||
gchar* cafile = cafile_get_name();
|
||||
ProfAccount* account = accounts_get_account(session_get_account_name());
|
||||
gboolean insecure = account->tls_policy && strcmp(account->tls_policy, "trust") == 0;
|
||||
gboolean insecure = FALSE;
|
||||
if (account) {
|
||||
insecure = account->tls_policy && strcmp(account->tls_policy, "trust") == 0;
|
||||
}
|
||||
account_free(account);
|
||||
pthread_mutex_unlock(&lock);
|
||||
|
||||
|
@ -186,8 +186,11 @@ http_file_put(void* userdata)
|
||||
|
||||
auto_gchar gchar* cert_path = prefs_get_string(PREF_TLS_CERTPATH);
|
||||
gchar* cafile = cafile_get_name();
|
||||
gboolean insecure = FALSE;
|
||||
ProfAccount* account = accounts_get_account(session_get_account_name());
|
||||
gboolean insecure = account->tls_policy && strcmp(account->tls_policy, "trust") == 0;
|
||||
if (account) {
|
||||
insecure = account->tls_policy && strcmp(account->tls_policy, "trust") == 0;
|
||||
}
|
||||
account_free(account);
|
||||
pthread_mutex_unlock(&lock);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user