[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 102a3e3b44 7/7: Don't send erc-sasl-user as USER command argume
From: |
F. Jason Park |
Subject: |
emacs-29 102a3e3b44 7/7: Don't send erc-sasl-user as USER command argument |
Date: |
Wed, 14 Dec 2022 09:44:40 -0500 (EST) |
branch: emacs-29
commit 102a3e3b445d96e5a74a3ec32b2a2b701b80819e
Author: F. Jason Park <jp@neverwas.me>
Commit: F. Jason Park <jp@neverwas.me>
Don't send erc-sasl-user as USER command argument
* lisp/erc/erc-sasl.el (erc-sasl--send-cap-ls): Add internal switch
for sending an opening "CAP LS". The rationale for not enabling this
by default is twofold: one, it more strongly implies that ERC supports
IRCv3 client capability negotiation, which is somewhat disingenuous;
and, two, We'd still be "faking it" by firing and forgetting, and more
balls in the air makes things less predictable.
(erc--register-connection): Possibly send a "CAP LS" before anything
depending on the value of `erc-sasl--send-cap-ls'. Also, don't
attempt to send `erc-session-username' when it holds an SASL username
because the latter may contain protocol-defying characters.
* test/lisp/erc/resources/base/local-modules/fourth.eld: change user
parameter of "USER" command to reflect nick when `erc-sasl-user' is
set to `:user'. (Bug#59976.)
---
lisp/erc/erc-sasl.el | 25 ++++++++++++++++------
.../erc/resources/base/local-modules/fourth.eld | 2 +-
2 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/lisp/erc/erc-sasl.el b/lisp/erc/erc-sasl.el
index 280910111d..78d02a4638 100644
--- a/lisp/erc/erc-sasl.el
+++ b/lisp/erc/erc-sasl.el
@@ -414,17 +414,30 @@ This doesn't solicit or validate a suite of supported
mechanisms."
" "))
(erc-sasl--destroy proc))
+(defvar erc-sasl--send-cap-ls nil
+ "Whether to send an opening \"CAP LS\" command.
+This is an escape hatch for picky servers. If you need it turned
+into a user option, please let ERC know via \\[erc-bug].
+Otherwise, expect it to disappear in subsequent versions.")
+
(cl-defmethod erc--register-connection (&context (erc-sasl-mode (eql t)))
- "Send speculative/pipelined CAP and AUTHENTICATE and hope for the best."
+ "Send speculative CAP and pipelined AUTHENTICATE and hope for the best."
(if-let* ((c (erc-sasl--state-client erc-sasl--state))
(m (sasl-mechanism-name (sasl-client-mechanism c))))
(progn
- (erc-server-send "CAP REQ :sasl")
- (if (and erc-session-password
- (eq :password (alist-get 'password erc-sasl--options)))
- (let (erc-session-password)
- (erc-login))
+ (erc-server-send (if erc-sasl--send-cap-ls "CAP LS" "CAP REQ :sasl"))
+ (let ((erc-session-password
+ (and erc-session-password
+ (not (eq :password (alist-get 'password
erc-sasl--options)))
+ erc-session-password))
+ (erc-session-username
+ ;; The username may contain a colon or a space
+ (if (eq :user (alist-get 'user erc-sasl--options))
+ (erc-current-nick)
+ erc-session-username)))
(erc-login))
+ (when erc-sasl--send-cap-ls
+ (erc-server-send "CAP REQ :sasl"))
(erc-server-send (format "AUTHENTICATE %s" m)))
(erc-sasl--destroy erc-server-process)))
diff --git a/test/lisp/erc/resources/base/local-modules/fourth.eld
b/test/lisp/erc/resources/base/local-modules/fourth.eld
index fd6d62b6cc..4ac5dcbd38 100644
--- a/test/lisp/erc/resources/base/local-modules/fourth.eld
+++ b/test/lisp/erc/resources/base/local-modules/fourth.eld
@@ -1,7 +1,7 @@
;; -*- mode: lisp-data; -*-
((cap 10 "CAP REQ :sasl"))
((nick 10 "NICK tester`"))
-((user 10 "USER tester 0 * :tester"))
+((user 10 "USER tester` 0 * :tester"))
((authenticate 10 "AUTHENTICATE PLAIN")
(0.0 ":irc.foonet.org CAP * ACK sasl")
- emacs-29 updated (2d96a18cd0 -> 102a3e3b44), F. Jason Park, 2022/12/14
- emacs-29 f0c9088878 6/7: Set erc-network to a "given" ID instead of failing, F. Jason Park, 2022/12/14
- emacs-29 0155fc67be 2/7: Respect a nil erc-session-password when reconnecting, F. Jason Park, 2022/12/14
- emacs-29 9ac80e8a6e 1/7: Add dedicated auth-source section in ERC manual, F. Jason Park, 2022/12/14
- emacs-29 44b04c0ac1 4/7: Actually accept non-symbols as IDs in erc-open, F. Jason Park, 2022/12/14
- emacs-29 75f26646d4 3/7: ; Be nicer when updating browse-url var in erc-compat, F. Jason Park, 2022/12/14
- emacs-29 102a3e3b44 7/7: Don't send erc-sasl-user as USER command argument,
F. Jason Park <=
- emacs-29 09c0c6b2ba 5/7: Limit casemapping to appropriate ranges in ERC, F. Jason Park, 2022/12/14