summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2023-07-18 10:38:15 +0200
committertv <tv@krebsco.de>2023-07-18 10:38:15 +0200
commitc42f3a37729ed771308fd6e2cdc384376d2966fd (patch)
tree0d5531ae31d67da7c4a7562285bf1e341cda7d70
parent058ef3084679f5e0c58df0a3daca82efc4f86afa (diff)
ircsink: wait for SASL to finish via numericsHEAD1.4.1master
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
-rwxr-xr-xbin/ircsink10
1 files changed, 9 insertions, 1 deletions
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