From 58b63de6f1dd84a4923c623dafd548512ecdf054 Mon Sep 17 00:00:00 2001 From: dequis Date: Fri, 11 Sep 2015 19:07:10 -0300 Subject: IRCv3 SASL capability + PLAIN method Only plain, no other methods. We don't have built-in SSL to implement EXTERNAL (certfp) and nothing else is worth implementing. The actual authentication is pretty much like sending a server password (when the server's authmode isn't closed), which means it happens in cmd_identify, but this code also calls storage_check_pass() to send the required success/failure replies. SASL doesn't give us much benefit other than standards compliance, but some clients might appreciate it. And having a fifth way to do the same thing doesn't hurt! Now we have: - identify in &bitlbee - identify to nickserv (alias for root) - 'nickserv' and 'ns' irc commands - server password - sasl plain --- irc_cap.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'irc_cap.c') diff --git a/irc_cap.c b/irc_cap.c index 79732409..4cfc158b 100644 --- a/irc_cap.c +++ b/irc_cap.c @@ -37,6 +37,7 @@ typedef struct { } cap_info_t; static const cap_info_t supported_caps[] = { + {"sasl", CAP_SASL}, {"multi-prefix", CAP_MULTI_PREFIX}, {NULL}, }; @@ -169,6 +170,12 @@ void irc_cmd_cap(irc_t *irc, char **cmd) } else if (g_strcasecmp(cmd[1], "END") == 0) { irc->status &= ~USTATUS_CAP_PENDING; + + if (irc->status & USTATUS_SASL_PLAIN_PENDING) { + irc_send_num(irc, 906, ":SASL authentication aborted"); + irc->status &= ~USTATUS_SASL_PLAIN_PENDING; + } + irc_check_login(irc); } else { -- cgit v1.2.3