Add SASL capability
Summary:
Libera requires SASL authentication to a NickServ account for IPv4 ranges
from dedicated hosting providers like OVH and Scaleway/Online.
This change implements SASL PLAIN to authenticate to nickserv at connection
time through SASL instead of doing so in perform.ini, and as such, gain access
to Libera servers.
Base64 code is from Jouni Malinen <j@w1.fi> under BSD-2-Clause license,
and has been extracted from FreeBSD source code at commit 0a6760a1de.
To avoid to leak password to the console or service log,
the settings aren't show anymore, excepted if debug mode
is enabled.
References:
- https://libera.chat/guides/sasl#sasl-access-only-ip-ranges
- Work done for eggdrop by https://github.com/grawity/eggdrop-sasl
- RFC 4616 - https://www.rfc-editor.org/rfc/rfc4616 (SASL PLAIN)
- RFC 1341 - https://www.rfc-editor.org/rfc/rfc1341 (Base64)
Ref T1739.
Test Plan:
- Connect to Libera, got 900 and 903 responses, successfully authenticated
- SASL code has been tested through valgrind to ensure memory correctness
Reviewers: dereckson
Reviewed By: dereckson
Maniphest Tasks: T1739
Differential Revision: https://devcentral.nasqueron.org/D3096