From c42f3a37729ed771308fd6e2cdc384376d2966fd Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 18 Jul 2023 10:38:15 +0200 Subject: ircsink: wait for SASL to finish via numerics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because per [sasl-3.1] The final “text” parameter is not to be machine-parsed. Additionally, only continue on RPL_SASLSUCCESS and abort otherwise. [sasl-3.1]: https://ircv3.net/specs/extensions/sasl-3.1 --- bin/ircsink | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'bin/ircsink') diff --git a/bin/ircsink b/bin/ircsink index dcbe294..c81f1a2 100755 --- a/bin/ircsink +++ b/bin/ircsink @@ -222,7 +222,15 @@ main() {( echo "AUTHENTICATE $message" echo "AUTHENTICATE ***REDACTED***" >&2 - sed -nru '/^(.*?):SASL authentication successful/q' + # wait for SASL to finish + # RPL_SASLSUCCESS (903) + # ERR_SASLFAIL (904) + # ERR_SASLTOOLONG (905) + sasl_result=$(sed -nru 's/^:[^ ]* (90[345]) .*/\1/p;T;q') + if test $sasl_result -ne 903; then + echo "$0: error: SASL authentication failed" >&2 + exit 1 + fi ;; esac -- cgit v1.2.3