Salut should wait before denying a connection from an untrusted source
Submitted by Alban Crequy
Assigned to Sjoerd Simons @sjoerd
Description
When Salut goes online and starts a connection as soon as it is aware of the presence of a contact, this contact may not yet be aware of the initiator's presence. With the current code, the recipient will close the connection:
src/salut-xmpp-connection-manager.c new_connection_cb():
contacts = salut_contact_manager_find_contacts_by_address ( priv->contact_manager, addr); if (contacts == NULL) { DEBUG ("Couldn't find a contact for the incoming connection"); gibber_transport_disconnect (connection->transport); return; }
Salut should wait a slack time in order to see whether the incoming connection from the untrusted source suddenly becomes a trusted source after some messages from Avahi.
This race usually does not happen with a regular UI because a human user is too slow to connect and start to chat immediately. But it can happen with bots, or scripts like telepathy-python/examples/tube-stream-private.py
This race exists because the incoming connection and the presence from the initiator to the recipient takes 2 different paths: a tcp connection and a DNS record in Avahi.
Note that this race is not a bug in the Telepathy client. It is a different problem than the "Telepathy client not waiting the contact to be ready to create a channel" bug.