From: amk@amk.ie
To: "Tassilo Horn" <tsdh@gnu.org>, emacs-devel@gnu.org
Cc: "Philip Kaludercic" <philipk@posteo.net>
Subject: Re: About SASL authentication in rcirc
Date: Mon, 28 Jun 2021 12:46:01 +0000 [thread overview]
Message-ID: <d1b306561fcd5cc9a6a4b09c23c3f971@amk.ie> (raw)
In-Reply-To: <87h7hijlmz.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1891 bytes --]
June 28, 2021 11:36 AM, "Tassilo Horn" <tsdh@gnu.org> wrote:
> Hi Alex,
>
> thanks for bringing SASL authentication to rcirc. I'm using the
> rcirc-update branch of Philip for my IRC needs where Philip has
> cherry-picked your commit implementing SASL authentication for rcirc.
> So obviously I wanted to try that out and changed my
>
> --8<---------------cut here---------------start------------->8---
> (setq rcirc-authinfo
> `(("libera" nickserv "tsdh" ,th/nickserv-password-liberachat)))
> --8<---------------cut here---------------end--------------->8---
>
> to
>
> --8<---------------cut here---------------start------------->8---
> (setq rcirc-authinfo
> `(("libera" sasl "tsdh" ,th/nickserv-password-liberachat)))
> --8<---------------cut here---------------end--------------->8---
>
> and restarted my rcirc session after rebuilding emacs.
>
> After that, the *irc.libera.chat* buffer contained a message that tsdh
> is a registered nick but not the message afterwards that I'm
> successfully registered now (as it is the case with nickserv
> authentication). And when querying NickServ, it told me that I'm not
> logged it.
>
> If I understand SASL/IRC correctly, it should have logged in immediately
> on connecting, right?
>
> So apparently, it seems that it didn't work when I've tried. I'd be
> happy to debug where it fails if you give me some pointers what to look
> for.
>
> Bye,
> Tassilo
Hey,
Correct, It should authenticate automatically
I think the issue is that some of the original sasl commit got lost in
cherry picking. I've attached a patch that fixes it, I'm not sure if
there is a better place to send a patch to a branch.
With this patch rcirc now checks that sasl authentication has completed
before running CAP END as specified here
https://ircv3.net/specs/extensions/sasl-3.1
Thanks,
Alex
[-- Attachment #2: 0001-Fix-SASL-on-rcirc-update.patch --]
[-- Type: application/octet-stream, Size: 2971 bytes --]
From b86f9f022acf630dbeb4cd3cbeaf22212e1d8eed Mon Sep 17 00:00:00 2001
From: Alex McGrath <alexmcgraak@arista.com>
Date: Mon, 28 Jun 2021 13:41:31 +0100
Subject: [PATCH] Fix SASL on rcirc-update
---
lisp/net/rcirc.el | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 37c31be58f..4c197aea54 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -610,6 +610,8 @@ See `rcirc-connect' for more details on these variables.")
"A list of capabilities that client has requested.")
(defvar-local rcirc-acked-capabilities nil
"A list of capabilities that the server supports.")
+(defvar-local rcirc-finished-sasl t
+ "Check whether SASL authentication has completed")
(defun rcirc-get-server-method (server)
"Return authentication method for SERVER."
@@ -650,10 +652,13 @@ that are joined after authentication."
(user-name (or user-name rcirc-default-user-name))
(full-name (or full-name rcirc-default-full-name))
(startup-channels startup-channels)
+ (use-sasl (eq (rcirc-get-server-method server) 'sasl))
(process (open-network-stream
(or server-alias server) nil server port-number
:type (or encryption 'plain))))
;; set up process
+ (when use-sasl
+ (setq-local rcirc-finished-sasl nil))
(set-process-coding-system process 'raw-text 'raw-text)
(switch-to-buffer (rcirc-generate-new-buffer-name process nil))
(set-process-buffer process (current-buffer))
@@ -685,6 +690,10 @@ that are joined after authentication."
(rcirc-send-string process "PASS" password))
(rcirc-send-string process "NICK" nick)
(rcirc-send-string process "USER" user-name "0" "*" : full-name)
+ ;; Setup sasl, and initiate authentication.
+ (when (and rcirc-auto -authenticate-flag
+ use-sasl)
+ (rcirc-send-string process "AUTHENTICATE" "PLAIN"))
;; setup ping timer if necessary
(unless rcirc-keepalive-timer
@@ -3435,7 +3444,7 @@ is the process object for the current connection."
((string= subcmd "NAK")
(setq rcirc-requested-capabilities
(delete cap rcirc-requested-capabilities))))))
- (when (null rcirc-requested-capabilities)
+ (when (and (null rcirc-requested-capabilities) rcirc-finished-sasl)
;; All requested capabilities have been responded to
(rcirc-send-string process "CAP" "END"))))
@@ -3500,7 +3509,9 @@ PROCESS is the process object for the current connection."
(base64-encode-string
;; use connection user-name
(concat "\0" (nth 3 rcirc-connection-info)
- "\0" (rcirc-get-server-password rcirc-server)))))
+ "\0" (rcirc-get-server-password rcirc-server))))
+ (setq-local rcirc-finished-sasl t)
+ (rcirc-send-string process "CAP" "END"))
\f
(defgroup rcirc-faces nil
--
2.25.1
next prev parent reply other threads:[~2021-06-28 12:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-28 10:36 About SASL authentication in rcirc Tassilo Horn
2021-06-28 12:46 ` amk [this message]
2021-06-28 19:35 ` Tassilo Horn
2021-06-28 19:58 ` Tassilo Horn
2021-06-28 20:12 ` Alex McGrath
2021-06-29 4:58 ` Tassilo Horn
2021-06-29 8:04 ` Philip Kaludercic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d1b306561fcd5cc9a6a4b09c23c3f971@amk.ie \
--to=amk@amk.ie \
--cc=emacs-devel@gnu.org \
--cc=philipk@posteo.net \
--cc=tsdh@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).