emacs-circe / circe

Circe, a Client for IRC in Emacs
GNU General Public License v3.0
390 stars 51 forks source link

Improve the implementation of SASL authentication #390

Closed AitorATuin closed 3 years ago

AitorATuin commented 3 years ago

This PR adds support for all the possible events sent during SASL authentication:

It also improves the registration logic in this way:

  1. When using SASL on successful authentication the server will send 900 and

  2. Right now on 900 the sasl.login event is always emitted even if we are doing SASL authentication. This PR waits for the 903 when SASL negotiation is ongoing. If SASL is not active the sasl.login will be emitted when 900 is sent.

  3. Right now the CAP END command is sent right after the AUTHENTICATION has been sent without waiting for a response from the server. This PR also delays the CAP END until we know the status of the SASL authentication (success, failed or aborted).

  4. It also adds a new flag :sasl-strict that makes the connection with the server to be closed in the SASL authentication failed.

AitorATuin commented 3 years ago

NOTE that it adds the irc server buffer to the connection to be able to disconnect the connection with the server without triggering a reconnect. It uses the variable circe-server-inhibit-auto-reconnect-p from that buffer to avoid the reconnections.