Skip to content
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

Fix TLS timeouts with recent versions of GnuTLS #330

Merged
merged 1 commit into from Apr 22, 2019
Merged

Fix TLS timeouts with recent versions of GnuTLS #330

merged 1 commit into from Apr 22, 2019

Conversation

lupine
Copy link
Contributor

@lupine lupine commented Apr 21, 2019

gnutls_handshake_set_timeout takes a timeout value in ms, but we were providing a value in seconds.

This means that on new-enough platforms that use GnuTLS (e.g., Debian Buster), we would accidentally configure a timeout 1,000 times shorter than requested.

In particular, I was seeing this when trying to use Delta Chat (https://github.com/deltachat/deltachat-core) in Debian. Compiled on Stretch, I could connect fine. Compiled on Buster, the connection always failed:

Trying: test@ur.gs test@ur.gs:***:ur.gs:143 test@ur.gs:***:ur.gs:587 AUTH_NORMAL IMAP_STARTTLS SMTP_STARTTLS
GnuTLS error: The operation timed out
IMAP stream lost; we'll reconnect soon.
[DC_EVENT_ERROR_NETWORK] first=1, msg=Could not connect to IMAP-server ur.gs:143 using STARTTLS. (Error #4)
IMAP disconnected.

Compiled on Stretch, the connection always succeeded. Delta sets a timeout of 10 seconds on its connections; 10ms is not long enough to negotiate SSL, but perhaps the mailimap default (30 seconds -> 30ms) is?

I tried running delta against a libetpan with this one-line patch, and it solved the problem for me.

This is preventing delta from getting into pureos for the librem5 linux mobile device: https://source.puri.sm/Librem5/chatty/issues/96

gnutls_handshake_set_timeout takes a timeout value in ms, but we were
providing a value in seconds. This means that on new-enough platforms
that use GnuTLS (e.g., Debian Buster), we would accidentally configure
a timeout 1,000 times shorter than requested.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants