From 970c99961cbb388452946b952bdb2265ac17424d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 18 Apr 2020 00:08:11 +0200 Subject: [PATCH] relay: immediately close connection if the handshake failed (weechat protocol) --- doc/en/weechat_relay_protocol.en.adoc | 3 ++- doc/fr/weechat_relay_protocol.fr.adoc | 3 ++- doc/ja/weechat_relay_protocol.ja.adoc | 3 ++- src/plugins/relay/weechat/relay-weechat-protocol.c | 4 ++++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/en/weechat_relay_protocol.en.adoc b/doc/en/weechat_relay_protocol.en.adoc index bc787ef03..924179874 100644 --- a/doc/en/weechat_relay_protocol.en.adoc +++ b/doc/en/weechat_relay_protocol.en.adoc @@ -149,7 +149,8 @@ WeeChat replies with a hashtable containing the following keys and values: * _password_hash_algo_: the password authentication negotiated: supported by both the client and _relay_: -** (empty value): negotiation failed, password authentication is *NOT* possible +** (empty value): negotiation failed, password authentication is *NOT* possible; + in this case the connection with the client is immediately closed ** _plain_ ** _sha256_ ** _sha512_ diff --git a/doc/fr/weechat_relay_protocol.fr.adoc b/doc/fr/weechat_relay_protocol.fr.adoc index 37eed354c..4c102a5b9 100644 --- a/doc/fr/weechat_relay_protocol.fr.adoc +++ b/doc/fr/weechat_relay_protocol.fr.adoc @@ -158,7 +158,8 @@ suivantes : * _password_hash_algo_ : l'authentification mot de passe négociée : supportée par le client et _relay_ : ** (valeur vide) : la négociation a échoué, l'authentification par mot de passe - n'est *PAS* possible + n'est *PAS* possible ; dans ce cas la connexion avec le client est + immédiatement fermée ** _plain_ ** _sha256_ ** _sha512_ diff --git a/doc/ja/weechat_relay_protocol.ja.adoc b/doc/ja/weechat_relay_protocol.ja.adoc index 31a5f02d6..13245aff5 100644 --- a/doc/ja/weechat_relay_protocol.ja.adoc +++ b/doc/ja/weechat_relay_protocol.ja.adoc @@ -158,7 +158,8 @@ WeeChat replies with a hashtable containing the following keys and values: * _password_hash_algo_: the password authentication negotiated: supported by both the client and _relay_: -** (empty value): negotiation failed, password authentication is *NOT* possible +** (empty value): negotiation failed, password authentication is *NOT* possible; + in this case the connection with the client is immediately closed ** _plain_ ** _sha256_ ** _sha512_ diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.c b/src/plugins/relay/weechat/relay-weechat-protocol.c index 4c0da2940..b59eb29d9 100644 --- a/src/plugins/relay/weechat/relay-weechat-protocol.c +++ b/src/plugins/relay/weechat/relay-weechat-protocol.c @@ -304,6 +304,10 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(handshake) relay_weechat_protocol_handshake_reply (client, id); + /* if no algo was found, we close the connection immediately */ + if (client->password_hash_algo < 0) + relay_client_set_status (client, RELAY_STATUS_AUTH_FAILED); + return WEECHAT_RC_OK; }