GNU bug report logs - #48601
[PATCH] Add support for plain SASL authentication to rcirc

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Alex McGrath <amk@HIDDEN>; Keywords: patch moreinfo; dated Sun, 23 May 2021 12:17:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 48601 <at> debbugs.gnu.org:


Received: (at 48601) by debbugs.gnu.org; 25 May 2021 04:01:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 25 00:01:52 2021
Received: from localhost ([127.0.0.1]:44318 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1llOGO-0008L4-JU
	for submit <at> debbugs.gnu.org; Tue, 25 May 2021 00:01:52 -0400
Received: from quimby.gnus.org ([95.216.78.240]:39762)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1llOGL-0008Kl-2J
 for 48601 <at> debbugs.gnu.org; Tue, 25 May 2021 00:01:50 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=uxrtJDXF4S5OQi3tfHhAWRSR6X+usv3T62AL6Uk2B4o=; b=VbIun3m/cjyspbrJwlFC0nj264
 9z+gsfkoAn8Bj+W+71I5bl2Iy4N0/08pth16UpqhGdWz6XT6cl1/4BG+BwFdQXWFmEjp8dxNk2lQT
 vIoujNksB7+c0JL0IjF7lAgZUFeHKWAC6FdT+4nludswA1aBEWpkyurPZbdjCMxXgb00=;
Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1llOGC-00032S-9k; Tue, 25 May 2021 06:01:42 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Alex McGrath <amk@HIDDEN>
Subject: Re: bug#48601: [PATCH] Add support for plain SASL authentication to
 rcirc
References: <87im39ir1o.fsf@HIDDEN> <87mtsk5xll.fsf@HIDDEN>
X-Now-Playing: Severed Heads's _Haul Ass_: "Lufthansa + Sevs In Space"
Date: Tue, 25 May 2021 06:01:39 +0200
In-Reply-To: <87mtsk5xll.fsf@HIDDEN> (Alex McGrath's message of "Mon, 24
 May 2021 09:45:26 +0100")
Message-ID: <87fsyb8nrw.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Alex McGrath <amk@HIDDEN> writes: > Sorry about the spam,
 should hopefully be a final version. Freenode > wasnt negotiating sasl the
 same way as the server I was testing with but > I think it is correct now
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 48601
Cc: 48601 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Alex McGrath <amk@HIDDEN> writes:

> Sorry about the spam, should hopefully be a final version.  Freenode
> wasnt negotiating sasl the same way as the server I was testing with but
> I think it is correct now

Thanks; this looks useful, but it isn't a "small change", so we'd need
to get the copyright assigned to the FSF before applying.  Would you be
willing to sign such paperwork?

If so, the form below should get you started:


Please email the following information to assign@HIDDEN, and we
will send you the assignment form for your past and future changes.

Please use your full legal name (in ASCII characters) as the subject
line of the message.
----------------------------------------------------------------------
REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES

[What is the name of the program or package you're contributing to?]
Emacs

[Did you copy any files or text written by someone else in these changes?
Even if that material is free software, we need to know about it.]

[Do you have an employer who might have a basis to claim to own
your changes?  Do you attend a school which might make such a claim?]

[For the copyright registration, what country are you a citizen of?]

[What year were you born?]

[Please write your email address here.]

[Please write your postal address here.]

[Which files have you changed so far, and which new files have you written
so far?]




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#48601; Package emacs. Full text available.

Message received at 48601 <at> debbugs.gnu.org:


Received: (at 48601) by debbugs.gnu.org; 24 May 2021 08:45:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 24 04:45:35 2021
Received: from localhost ([127.0.0.1]:42375 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ll6DO-0001qD-T0
	for submit <at> debbugs.gnu.org; Mon, 24 May 2021 04:45:35 -0400
Received: from out1.migadu.com ([91.121.223.63]:49580)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <amk@HIDDEN>) id 1ll6DJ-0001py-Kj
 for 48601 <at> debbugs.gnu.org; Mon, 24 May 2021 04:45:33 -0400
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amk.ie; s=key1;
 t=1621845927;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type;
 bh=fD7bdsA31L3Po0cyc77kCtEqAMGJdUQweVBKW6YOFIo=;
 b=qiTD8SPMTY1Q+hYG75GS64Wl3ZB2lGunseP5AqaHTHFRD2+OXXoq8k8UMbNzXeuDdEUnXk
 uOHDHsk0No5qdJ70LDiFz3d3iXerwk+xN+eayn4RIH05YuAxmjhEPYw27Aa2zwStRZi6LL
 VjXyZlR9acDS7RDlg6LXBtgXCqqpUJo3xKoHx0mdFm86BuXW6qe2RCNXk1XmFLvBvfQq+l
 hvUkVkBuIv+Mnv+aq5aYK9AePXiX3/0lBYAGu7kSlt6O+KUP074fZ+aYmORmqbJzkc3kvw
 FLceGBBUxodKKVcGubjJa9zKXGOTQZZJVqEcVDy6q2aaQsNNsSGDeiydBoSQOA==
From: Alex McGrath <amk@HIDDEN>
To: 48601 <at> debbugs.gnu.org
Subject: [PATCH v3] Add support for plain SASL authentication to rcirc
Date: Mon, 24 May 2021 09:45:26 +0100
Message-ID: <87mtsk5xll.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
X-Migadu-Auth-User: amk@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 48601
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain

Sorry about the spam, should hopefully be a final version.  Freenode
wasnt negotiating sasl the same way as the server I was testing with but
I think it is correct now

Thanks again,
Alex


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Add-support-for-SASL-authentication-to-rcirc.patch
Content-Description: V3 of sasl patch

From a7e10aa65086fa09e48d58c15aa6619b7927ef18 Mon Sep 17 00:00:00 2001
From: Alex McGrath <amk@HIDDEN>
Date: Sun, 23 May 2021 12:47:17 +0100
Subject: [PATCH] Add support for SASL authentication to rcirc

---
 lisp/net/rcirc.el | 42 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 7251640bf2..9d66d0cd51 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -245,13 +245,15 @@ The ARGUMENTS for each METHOD symbol are:
   `chanserv': NICK CHANNEL PASSWORD
   `bitlbee': NICK PASSWORD
   `quakenet': ACCOUNT PASSWORD
+  `sasl': NICK PASSWORD
 
 Examples:
  ((\"freenode\" nickserv \"bob\" \"p455w0rd\")
   (\"freenode\" chanserv \"bob\" \"#bobland\" \"passwd99\")
   (\"bitlbee\" bitlbee \"robert\" \"sekrit\")
   (\"dal.net\" nickserv \"bob\" \"sekrit\" \"NickServ@HIDDEN\")
-  (\"quakenet.org\" quakenet \"bobby\" \"sekrit\"))"
+  (\"quakenet.org\" quakenet \"bobby\" \"sekrit\")
+  (\"oftc\" sasl \"bob\" \"hunter2\"))"
   :type '(alist :key-type (regexp :tag "Server")
 		:value-type (choice (list :tag "NickServ"
 					  (const nickserv)
@@ -269,6 +271,10 @@ Examples:
                                     (list :tag "QuakeNet"
                                           (const quakenet)
                                           (string :tag "Account")
+                                          (string :tag "Password"))
+                                    (list :tag "SASL"
+                                          (const sasl)
+                                          (string :tag "Nick")
                                           (string :tag "Password")))))
 
 (defcustom rcirc-auto-authenticate-flag t
@@ -543,6 +549,22 @@ If ARG is non-nil, instead prompt for connection parameters."
 (defvar rcirc-connection-info nil)
 (defvar rcirc-process nil)
 
+(defun rcirc-get-server-method (server)
+  (catch 'method
+    (dolist (i rcirc-authinfo)
+      (let ((server-i (car i))
+	    (method (cadr i)))
+	(when (and (string-match server-i server))
+          (throw 'method method))))))
+
+(defun rcirc-get-server-password (server)
+  (catch 'pass
+    (dolist (i rcirc-authinfo)
+      (let ((server-i (car i))
+	    (args (cl-cdddr i)))
+	(when (and (string-match server-i server))
+          (throw 'pass (car args)))))))
+
 ;;;###autoload
 (defun rcirc-connect (server &optional port nick user-name
                              full-name startup-channels password encryption
@@ -559,6 +581,7 @@ If ARG is non-nil, instead prompt for connection parameters."
 	   (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))))
@@ -591,6 +614,8 @@ If ARG is non-nil, instead prompt for connection parameters."
       (setq-local rcirc-server-parameters nil)
 
       (add-hook 'auto-save-hook 'rcirc-log-write)
+      (when use-sasl
+          (rcirc-send-string process "CAP REQ sasl"))
 
       ;; identify
       (unless (zerop (length password))
@@ -598,6 +623,10 @@ If ARG is non-nil, instead prompt for connection parameters."
       (rcirc-send-string process (concat "NICK " nick))
       (rcirc-send-string process (concat "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
@@ -2922,7 +2951,8 @@ Passwords are stored in `rcirc-authinfo' (which see)."
                  (rcirc-send-privmsg
                   process
                   "&bitlbee"
-                  (concat "IDENTIFY " (car args)))))
+                  (concat "IDENTIFY " (car args))))
+                (sasl nil))
             ;; quakenet authentication doesn't rely on the user's nickname.
             ;; the variable `nick' here represents the Q account name.
             (when (eq method 'quakenet)
@@ -2968,6 +2998,14 @@ Passwords are stored in `rcirc-authinfo' (which see)."
 
 (defun rcirc-handler-CTCP-response (process _target sender message)
   (rcirc-print process sender "CTCP" nil message t))
+
+(defun rcirc-handler-AUTHENTICATE (process _cmd _args _text)
+  (rcirc-send-string process (format "AUTHENTICATE %s"
+                                     (base64-encode-string
+                                      ;; use connection user-name
+                                      (concat "\0" (nth 3 rcirc-connection-info)
+                                              "\0" (rcirc-get-server-password rcirc-server))))))
+
 
 (defgroup rcirc-faces nil
   "Faces for rcirc."
-- 
2.30.2


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#48601; Package emacs. Full text available.

Message received at 48601 <at> debbugs.gnu.org:


Received: (at 48601) by debbugs.gnu.org; 23 May 2021 16:30:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 23 12:30:00 2021
Received: from localhost ([127.0.0.1]:41691 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lkqzI-0005AF-2O
	for submit <at> debbugs.gnu.org; Sun, 23 May 2021 12:30:00 -0400
Received: from out2.migadu.com ([188.165.223.204]:62855)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <amk@HIDDEN>) id 1lkqzC-0005A2-Is
 for 48601 <at> debbugs.gnu.org; Sun, 23 May 2021 12:29:59 -0400
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amk.ie; s=key1;
 t=1621787054;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type;
 bh=YfbwHyHYtbFBxcN7KSH7YJnA41dWn8kTYP5cZbwN4o4=;
 b=BFn72W7yek/LC+1CkYrM43ifAfro7gP8pZEfiYZOsMyt9lnOrdb2n/t+0Twa8ZgCZMPBBk
 CpUqBsfB6pa8ugZoTRbzSJn7k35bHPq8BVEQj08Yvc5+2xVLHrVQgd+8DKCA7iTfcIRvCT
 E706h1sJUKklWV1cHSMEXWLol0HsE3tgzexf8GjKWq1ZBK+cTtt0pbKQt2uK/7dCn7ac/z
 hjIe0W4kxMifkTWoZpZb6cAfQ3WhcETEvgo0TY0SEoE1Ytf+AI2zw/4JOypr2gNRWlx4XJ
 sPU6jqq8WOOdMhStQ5e2VcHkWVx/esfeDEoBw/bHaXdhyOCzxGz13HMa3L1+zQ==
From: Alex McGrath <amk@HIDDEN>
To: 48601 <at> debbugs.gnu.org.
Subject: [PATCH v2] Add support for plain SASL authentication to rcirc
Date: Sun, 23 May 2021 17:24:13 +0100
Message-ID: <87fsydifki.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
X-Migadu-Auth-User: amk@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 48601
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

This fixes a couple of problems with the previous patch.
Mainly it uses user-name instead of nick for the SASL auth

Thanks,
Alex


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Add-support-for-SASL-authentication-to-rcirc.patch
Content-Description: SASL patch

From ff31781532f2da9da44e2c35961718719e962b39 Mon Sep 17 00:00:00 2001
From: Alex McGrath <amk@HIDDEN>
Date: Sun, 23 May 2021 12:47:17 +0100
Subject: [PATCH] Add support for SASL authentication to rcirc

---
 lisp/net/rcirc.el | 40 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)

diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 7251640bf2..d28fe708d2 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -245,13 +245,15 @@ The ARGUMENTS for each METHOD symbol are:
   `chanserv': NICK CHANNEL PASSWORD
   `bitlbee': NICK PASSWORD
   `quakenet': ACCOUNT PASSWORD
+  `sasl': NICK PASSWORD
 
 Examples:
  ((\"freenode\" nickserv \"bob\" \"p455w0rd\")
   (\"freenode\" chanserv \"bob\" \"#bobland\" \"passwd99\")
   (\"bitlbee\" bitlbee \"robert\" \"sekrit\")
   (\"dal.net\" nickserv \"bob\" \"sekrit\" \"NickServ@HIDDEN\")
-  (\"quakenet.org\" quakenet \"bobby\" \"sekrit\"))"
+  (\"quakenet.org\" quakenet \"bobby\" \"sekrit\")
+  (\"oftc\" sasl \"bob\" \"hunter2\"))"
   :type '(alist :key-type (regexp :tag "Server")
 		:value-type (choice (list :tag "NickServ"
 					  (const nickserv)
@@ -269,6 +271,10 @@ Examples:
                                     (list :tag "QuakeNet"
                                           (const quakenet)
                                           (string :tag "Account")
+                                          (string :tag "Password"))
+                                    (list :tag "SASL"
+                                          (const sasl)
+                                          (string :tag "Nick")
                                           (string :tag "Password")))))
 
 (defcustom rcirc-auto-authenticate-flag t
@@ -543,6 +549,22 @@ If ARG is non-nil, instead prompt for connection parameters."
 (defvar rcirc-connection-info nil)
 (defvar rcirc-process nil)
 
+(defun rcirc-get-server-method (server)
+  (catch 'method
+    (dolist (i rcirc-authinfo)
+      (let ((server-i (car i))
+	    (method (cadr i)))
+	(when (and (string-match server-i server))
+          (throw 'method method))))))
+
+(defun rcirc-get-server-password (server)
+  (catch 'pass
+    (dolist (i rcirc-authinfo)
+      (let ((server-i (car i))
+	    (args (cl-cdddr i)))
+	(when (and (string-match server-i server))
+          (throw 'pass (car args)))))))
+
 ;;;###autoload
 (defun rcirc-connect (server &optional port nick user-name
                              full-name startup-channels password encryption
@@ -598,6 +620,11 @@ If ARG is non-nil, instead prompt for connection parameters."
       (rcirc-send-string process (concat "NICK " nick))
       (rcirc-send-string process (concat "USER " user-name
                                          " 0 * :" full-name))
+      ;; setup sasl, and initiate authentication
+      (when (and rcirc-auto-authenticate-flag
+                 (eq (rcirc-get-server-method server) 'sasl))
+        (rcirc-send-string process "CAP REQ sasl")
+        (rcirc-send-string process "AUTHENTICATE PLAIN"))
 
       ;; setup ping timer if necessary
       (unless rcirc-keepalive-timer
@@ -2922,7 +2949,8 @@ Passwords are stored in `rcirc-authinfo' (which see)."
                  (rcirc-send-privmsg
                   process
                   "&bitlbee"
-                  (concat "IDENTIFY " (car args)))))
+                  (concat "IDENTIFY " (car args))))
+                (sasl nil))
             ;; quakenet authentication doesn't rely on the user's nickname.
             ;; the variable `nick' here represents the Q account name.
             (when (eq method 'quakenet)
@@ -2968,6 +2996,14 @@ Passwords are stored in `rcirc-authinfo' (which see)."
 
 (defun rcirc-handler-CTCP-response (process _target sender message)
   (rcirc-print process sender "CTCP" nil message t))
+
+(defun rcirc-handler-AUTHENTICATE (process _cmd _args _text)
+  (rcirc-send-string process (format "AUTHENTICATE %s"
+                                     (base64-encode-string
+                                      ;; use connection user-name
+                                      (concat "\0" (nth 3 rcirc-connection-info)
+                                              "\0" (rcirc-get-server-password rcirc-server))))))
+
 
 (defgroup rcirc-faces nil
   "Faces for rcirc."
-- 
2.30.2


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#48601; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 May 2021 12:16:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 23 08:16:57 2021
Received: from localhost ([127.0.0.1]:40792 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lkn2O-0005Bw-Vp
	for submit <at> debbugs.gnu.org; Sun, 23 May 2021 08:16:57 -0400
Received: from lists.gnu.org ([209.51.188.17]:45888)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <amk@HIDDEN>) id 1lkn2M-0005Bl-0m
 for submit <at> debbugs.gnu.org; Sun, 23 May 2021 08:16:55 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:60566)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <amk@HIDDEN>) id 1lkn2L-0005Q9-OO
 for bug-gnu-emacs@HIDDEN; Sun, 23 May 2021 08:16:53 -0400
Received: from out1.migadu.com ([2001:41d0:2:863f::]:39911)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <amk@HIDDEN>) id 1lkn24-0007KP-W4
 for bug-gnu-emacs@HIDDEN; Sun, 23 May 2021 08:16:47 -0400
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amk.ie; s=key1;
 t=1621772189;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type;
 bh=/p/+C+C2SPPGnaojhlJjYdN/fO3U3KHK2LwqBP/LQjI=;
 b=BQdmU+wh4WulJ5GkC1cJnYEKr3ztYIVtkdWZjr8XzpIV4t1W49ofzf6IuM2jjHXOcLJE+n
 bIaPsmIMiOreyFf8FnqBslFOjB6kVkjjxzFKukFZt7pZqBEsBilBhXe1Csm8Aghg6fbZhG
 BiBhmiiWCCQcD8Xh/mxUBaHy3Bh2wA+P/sLtHSTIHuPdQihEkUf2BP+BACfngc60zhf2gm
 2nGpQl8qewoj9qaX4mr1xjDl4yycBDwY9BYSLXs7k1EjaicUmHw7zvgNUM76vjWXcSkHRq
 1JXyvblhxPzUBAigDCftY2v3trzHV5tYuu9jEpoo7CBdrzpL5rAOX/zVB0WRZg==
From: Alex McGrath <amk@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Add support for plain SASL authentication to rcirc
Date: Sun, 23 May 2021 13:16:19 +0100
Message-ID: <87im39ir1o.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Migadu-Flow: FLOW_OUT
X-Migadu-Auth-User: amk@HIDDEN
Received-SPF: pass client-ip=2001:41d0:2:863f::; envelope-from=amk@HIDDEN;
 helo=out1.migadu.com
X-Spam_score_int: -16
X-Spam_score: -1.7
X-Spam_bar: -
X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1,
 DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

--=-=-=
Content-Type: text/plain


This adds support for PLAIN SASL authentication to rcirc.
ietf rfc: https://datatracker.ietf.org/doc/html/rfc4616

Thanks,
Alex
    

--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Add-support-for-SASL-authentication-to-rcirc.patch
Content-Description: Patch File

From 9ec0e5711621f17c8086365a15d80cb75352972b Mon Sep 17 00:00:00 2001
From: Alex McGrath <amk@HIDDEN>
Date: Sun, 23 May 2021 12:47:17 +0100
Subject: [PATCH] Add support for SASL authentication to rcirc

---
 lisp/net/rcirc.el | 39 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 37 insertions(+), 2 deletions(-)

diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 7251640bf2..f22096fc6d 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -245,13 +245,15 @@ The ARGUMENTS for each METHOD symbol are:
   `chanserv': NICK CHANNEL PASSWORD
   `bitlbee': NICK PASSWORD
   `quakenet': ACCOUNT PASSWORD
+  `sasl': NICK PASSWORD
 
 Examples:
  ((\"freenode\" nickserv \"bob\" \"p455w0rd\")
   (\"freenode\" chanserv \"bob\" \"#bobland\" \"passwd99\")
   (\"bitlbee\" bitlbee \"robert\" \"sekrit\")
   (\"dal.net\" nickserv \"bob\" \"sekrit\" \"NickServ@HIDDEN\")
-  (\"quakenet.org\" quakenet \"bobby\" \"sekrit\"))"
+  (\"quakenet.org\" quakenet \"bobby\" \"sekrit\")
+  (\"oftc\" sasl \"bob\" \"hunter2\"))"
   :type '(alist :key-type (regexp :tag "Server")
 		:value-type (choice (list :tag "NickServ"
 					  (const nickserv)
@@ -269,6 +271,10 @@ Examples:
                                     (list :tag "QuakeNet"
                                           (const quakenet)
                                           (string :tag "Account")
+                                          (string :tag "Password"))
+                                    (list :tag "SASL"
+                                          (const sasl)
+                                          (string :tag "Nick")
                                           (string :tag "Password")))))
 
 (defcustom rcirc-auto-authenticate-flag t
@@ -543,6 +549,22 @@ If ARG is non-nil, instead prompt for connection parameters."
 (defvar rcirc-connection-info nil)
 (defvar rcirc-process nil)
 
+(defun rcirc-get-server-method (rcirc-server)
+  (catch 'method
+    (dolist (i rcirc-authinfo)
+      (let ((server (car i))
+	        (method (cadr i)))
+	    (when (and (string-match server rcirc-server))
+              (throw 'method method))))))
+
+(defun rcirc-get-server-password (rcirc-server)
+  (catch 'pass
+    (dolist (i rcirc-authinfo)
+      (let ((server (car i))
+	        (args (cl-cdddr i)))
+	    (when (and (string-match server rcirc-server))
+          (throw 'pass (car args)))))))
+
 ;;;###autoload
 (defun rcirc-connect (server &optional port nick user-name
                              full-name startup-channels password encryption
@@ -598,6 +620,11 @@ If ARG is non-nil, instead prompt for connection parameters."
       (rcirc-send-string process (concat "NICK " nick))
       (rcirc-send-string process (concat "USER " user-name
                                          " 0 * :" full-name))
+      ;; setup sasl, and initiate authentication
+      (when (and rcirc-auto-authenticate-flag
+                 (eq (rcirc-get-server-method server) 'sasl))
+        (rcirc-send-string process "CAP REQ sasl")
+        (rcirc-send-string process "AUTHENTICATE PLAIN"))
 
       ;; setup ping timer if necessary
       (unless rcirc-keepalive-timer
@@ -2922,7 +2949,8 @@ Passwords are stored in `rcirc-authinfo' (which see)."
                  (rcirc-send-privmsg
                   process
                   "&bitlbee"
-                  (concat "IDENTIFY " (car args)))))
+                  (concat "IDENTIFY " (car args))))
+                (sasl nil))
             ;; quakenet authentication doesn't rely on the user's nickname.
             ;; the variable `nick' here represents the Q account name.
             (when (eq method 'quakenet)
@@ -2968,6 +2996,13 @@ Passwords are stored in `rcirc-authinfo' (which see)."
 
 (defun rcirc-handler-CTCP-response (process _target sender message)
   (rcirc-print process sender "CTCP" nil message t))
+
+(defun rcirc-handler-AUTHENTICATE (process _cmd _args _text)
+  (rcirc-send-string process (format "AUTHENTICATE %s"
+                                     (base64-encode-string
+                                      (concat "\0" (rcirc-buffer-nick)
+                                              "\0" (rcirc-get-server-password rcirc-server))))))
+
 
 (defgroup rcirc-faces nil
   "Faces for rcirc."
-- 
2.30.2


--=-=-=
Content-Type: text/plain

Date: Sun, 23 May 2021 13:16:02 +0100
Message-ID: <87lf85ir25.fsf@HIDDEN>

--=-=-=--




Acknowledgement sent to Alex McGrath <amk@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#48601; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 25 May 2021 20:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.