[Commits] [SCM] claws branch, gtk2, updated. 3.19.0-75-g1b7981ef7

miras at claws-mail.org miras at claws-mail.org
Sun Oct 16 01:22:51 UTC 2022


The branch, gtk2 has been updated
       via  1b7981ef7d2cf8f832ed97d4c1aacb23f26bb976 (commit)
      from  c11ab9aeb1cbe6fbd1ed56ab1d0847e2e5679f03 (commit)

Summary of changes:
 src/oauth2.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)


- Log -----------------------------------------------------------------
commit 1b7981ef7d2cf8f832ed97d4c1aacb23f26bb976
Author: Michael Rasmussen <mir at datanom.net>
Date:   Sun Oct 16 03:22:45 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 b9d177a7f..8731d1ed5 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"));
@@ -506,7 +511,8 @@ static gint oauth2_contact_server (SockInfo *sock, gchar *request, gchar *respon
 	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