[gnutls-devel] GnuTLS | gnutls-cli starttls connection to XMPP fails with 'error receiving <proceed' (#697)

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Tue Feb 5 21:53:29 CET 2019


Reproducible here with Debian's 3.6.6-2.

In the timeout case, we receive 1 byte less than in the success case. That makes gnutls-cli calling another select() which times out. The error message is wrong in this case. It should be 'timeout...'.

strace Failure:
```
socket(AF_INET6, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET6, sin6_port=htons(5222), inet_pton(AF_INET6, "2a02:1b8:10:31::229", &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28) = -1 ENETUNREACH (Das Netzwerk ist nicht erreichbar)
close(3)                                = 0
socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
write(1, "Connecting to '146.255.57.229:52"..., 39Connecting to '146.255.57.229:5222'...
) = 39
connect(3, {sa_family=AF_INET, sin_port=htons(5222), sin_addr=inet_addr("146.255.57.229")}, 16) = 0
sendto(3, "<stream:stream xmlns:stream='htt"..., 119, 0, NULL, 0) = 119
select(4, [3], NULL, NULL, {tv_sec=10, tv_usec=0}) = 1 (in [3], left {tv_sec=9, tv_usec=977090})
recvfrom(3, "<?xml version='1.0'?><stream:str"..., 1023, 0, NULL, NULL) = 180
sendto(3, "<starttls xmlns='urn:ietf:params"..., 51, 0, NULL, 0) = 51
select(4, [3], NULL, NULL, {tv_sec=10, tv_usec=0}) = 1 (in [3], left {tv_sec=9, tv_usec=999997})
recvfrom(3, "<stream:features><starttls xmlns"..., 1023, 0, NULL, NULL) = 107
select(4, [3], NULL, NULL, {tv_sec=10, tv_usec=0}) = 1 (in [3], left {tv_sec=9, tv_usec=977607})
recvfrom(3, "<proceed xmlns='urn:ietf:params:"..., 916, 0, NULL, NULL) = 50
select(4, [3], NULL, NULL, {tv_sec=10, tv_usec=0}) = 0 (Timeout)
write(2, "error receiving <proceed: Networ"..., 49error receiving <proceed: Network is unreachable) = 49
```

strace Success:
```
socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
write(1, "Connecting to '146.255.57.229:52"..., 39Connecting to '146.255.57.229:5222'...
) = 39
connect(3, {sa_family=AF_INET, sin_port=htons(5222), sin_addr=inet_addr("146.255.57.229")}, 16) = 0
sendto(3, "<stream:stream xmlns:stream='htt"..., 119, 0, NULL, 0) = 119
select(4, [3], NULL, NULL, {tv_sec=10, tv_usec=0}) = 1 (in [3], left {tv_sec=9, tv_usec=977095})
recvfrom(3, "<?xml version='1.0'?><stream:str"..., 1023, 0, NULL, NULL) = 288
sendto(3, "<starttls xmlns='urn:ietf:params"..., 51, 0, NULL, 0) = 51
select(4, [3], NULL, NULL, {tv_sec=10, tv_usec=0}) = 1 (in [3], left {tv_sec=9, tv_usec=977916})
recvfrom(3, "<proceed xmlns='urn:ietf:params:"..., 1023, 0, NULL, NULL) = 50
getrandom("\x5b\x9a\xfe\x4b\x89\xeb\x18\x88\xb0\x36\xed\x43\xf3\xe1\x62\xf1\xfd\x0c\xec\xa5\x4a\x4d\x85\x43\x5e\xea\x52\xf4\x69\xe9\xf4\xd3"..., 64, 0) = 64
sendto(3, "\26\3\1\1b\1\0\1^\3\39\263/\r\204\7\350E\241>\246\356\232\322\214\220\235\315\210\253\222"..., 359, 0, NULL, 0) = 359
...
```

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/issues/697#note_138561854
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20190205/010f3101/attachment-0001.html>


More information about the Gnutls-devel mailing list