[Commits] [SCM] claws branch, master, updated. 4.1.0-72-g729413f1d
miras at claws-mail.org
miras at claws-mail.org
Sat Oct 15 22:31:00 UTC 2022
The branch, master has been updated
via 729413f1d3f92db4d1c41ab4e187db5d016a7bb5 (commit)
from aad93a035a30ed97bdae2a535c66ab4212eefbde (commit)
Summary of changes:
src/oauth2.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit 729413f1d3f92db4d1c41ab4e187db5d016a7bb5
Author: Michael Rasmussen <mir at datanom.net>
Date: Sun Oct 16 00:30:53 2022 +0200
Do not use a hard coded value for socket timeout. Use the user configured timeout (socket I/O timeout)
Signed-off-by: Michael Rasmussen <mir at datanom.net>
diff --git a/src/oauth2.c b/src/oauth2.c
index eee796d10..34a180771 100644
--- a/src/oauth2.c
+++ b/src/oauth2.c
@@ -41,6 +41,7 @@
#include "log.h"
#include "time.h"
#include "common/passcrypt.h"
+#include "prefs_common.h"
//Yahoo requires token requests to send POST header Authorization: Basic
//where the password is Base64 encoding of client_id:client_secret
@@ -251,7 +252,9 @@ int oauth2_obtain_tokens (Oauth2Service provider, OAUTH2Data *OAUTH2Data, const
sock->ssl_cert_auto_accept = TRUE;
sock->use_tls_sni = TRUE;
sock_set_nonblocking_mode(sock, FALSE);
- sock_set_io_timeout(10);
+ gint timeout_secs = prefs_common_get_prefs()->io_timeout_secs;
+ debug_print("Socket timeout: %i sec(s)\n", timeout_secs);
+ sock_set_io_timeout(timeout_secs);
sock->gnutls_priority = "NORMAL:!VERS-SSL3.0:!VERS-TLS1.0:!VERS-TLS1.1";
if (ssl_init_socket(sock) == FALSE) {
log_message(LOG_PROTOCOL, _("OAuth2 TLS connection error\n"));
@@ -391,7 +394,9 @@ gint oauth2_use_refresh_token (Oauth2Service provider, OAUTH2Data *OAUTH2Data)
sock->ssl_cert_auto_accept = TRUE;
sock->use_tls_sni = TRUE;
sock_set_nonblocking_mode(sock, FALSE);
- sock_set_io_timeout(10);
+ gint timeout_secs = prefs_common_get_prefs()->io_timeout_secs;
+ debug_print("Socket timeout: %i sec(s)\n", timeout_secs);
+ sock_set_io_timeout(timeout_secs);
sock->gnutls_priority = "NORMAL:!VERS-SSL3.0:!VERS-TLS1.0:!VERS-TLS1.1";
if (ssl_init_socket(sock) == FALSE) {
log_message(LOG_PROTOCOL, _("OAuth2 TLS connection error\n"));
@@ -505,8 +510,9 @@ static gint oauth2_contact_server (SockInfo *sock, gchar *request, gchar *respon
time_t startplus = time(NULL);
gchar *tmp;
len = strlen(request);
-
- startplus += 10;
+
+ gint timeout_secs = prefs_common_get_prefs()->io_timeout_secs;
+ startplus += timeout_secs;
if (sock_write (sock, request, len+1) < 0) {
log_message(LOG_PROTOCOL, _("OAuth2 socket write error\n"));
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list