GNU bug report logs -
#74516
31.0.50; ERC 5.6.1-git: [PATCH] allow port as string in auth-source params
Previous Next
Reported by: Trevor Arjeski <tmarjeski <at> gmail.com>
Date: Sun, 24 Nov 2024 21:30:02 UTC
Severity: normal
Tags: patch
Found in version 31.0.50
Done: "J.P." <jp <at> neverwas.me>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 74516 in the body.
You can then email your comments to 74516 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74516
; Package
emacs
.
(Sun, 24 Nov 2024 21:30:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Trevor Arjeski <tmarjeski <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 24 Nov 2024 21:30:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[0001-erc-allow-port-as-string-in-auth-source-params.patch (text/x-patch, attachment)]
[Message part 2 (text/plain, inline)]
Reproduction steps:
1. Have an entry in .authinfo, such as
machine yourbouncer login nick password hunter2 port 7777
2. Using the following code in init.el, open emacs
3. M-x erc-connect
4. Notice ERC tries connecting without password
5. Change erc-port to be an integer (commented out below)
6. Retry steps 2 - 4
#+BEGIN_SRC emacs-lisp
(use-package erc
:ensure nil
:preface
(defun erc-connect ()
(interactive)
(erc :server erc-server
:port erc-port
:user erc-nick))
:custom
(erc-server "yourbouncer")
(erc-port "7777") ;; (erc-port 7777) is working
(erc-nick "nick"))
#+END_SRC
In GNU Emacs 31.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version
3.24.43, cairo version 1.18.2) of 2024-11-14 built on trevarch
Repository revision: b83a45eab53b8e6d8f3be45c0acb9a42a5262cb0
Repository branch: makepkg
Windowing system distributor 'The X.Org Foundation', version 11.0.12101014
System Description: Arch Linux
Configured using:
'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
--localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
--with-modules --without-m17n-flt --without-gconf
--with-native-compilation=yes --with-xinput2 --with-x-toolkit=gtk3
--without-xaw3d --with-sound=no --with-tree-sitter --without-gpm
--without-compress-install
'--program-transform-name=s/\([ec]tags\)/\1.emacs/'
'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
-Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security
-fstack-clash-protection -fcf-protection -fno-omit-frame-pointer
-mno-omit-leaf-frame-pointer -Wno-implicit-function-declaration -g
-ffile-prefix-map=/home/trev/Workspace/emacs-git/src=/usr/src/debug/emacs-git
-flto=auto' 'LDFLAGS=-Wl,-O1 -Wl,--sort-common -Wl,--as-needed
-Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto''
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PNG RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB
Important settings:
value of $LC_ALL: en_US.UTF-8
value of $LC_CTYPE: en_US.UTF-8
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: ERC
Minor modes in effect:
erc-track-mode: t
erc-track-minor-mode: t
erc-spelling-mode: t
flyspell-mode: t
erc-ring-mode: t
erc-nicks-mode: t
erc-netsplit-mode: t
erc-menu-mode: t
erc-match-mode: t
erc-list-mode: t
erc-irccontrols-mode: t
erc-move-to-prompt-mode: t
erc-readonly-mode: t
erc-scrolltobottom-mode: t
erc-imenu-mode: t
erc-pcomplete-mode: t
erc-button--phantom-users-mode: t
erc-button-mode: t
erc-fill-mode: t
erc-stamp-mode: t
erc-autojoin-mode: t
erc-networks-mode: t
global-treesit-auto-mode: t
corfu-popupinfo-mode: t
global-corfu-mode: t
corfu-mode: t
marginalia-mode: t
savehist-mode: t
vertico-mode: t
undo-fu-session-global-mode: t
undo-fu-session-mode: t
which-key-mode: t
electric-pair-mode: t
global-auto-revert-mode: t
desktop-save-mode: t
recentf-mode: t
save-place-mode: t
override-global-mode: t
global-eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
window-divider-mode: t
minibuffer-regexp-mode: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
Load-path shadows:
~/.emacs.d//lisp/aoc hides /home/trev/.emacs.d/elpa/aoc-1.0.0/aoc
~/.emacs.d//lisp/launch-program hides /home/trev/.emacs.d/elpa/launch-program-1.0.0/launch-program
~/.emacs.d//lisp/my-secrets hides /home/trev/.emacs.d/elpa/my-secrets-1.0.0/my-secrets
/home/trev/.emacs.d/elpa/transient-20241115.2034/transient hides /usr/share/emacs/31.0.50/lisp/transient
Features:
(shadow sort comp-run comp-common mail-extr emacsbug message yank-media
dired dired-loaddefs rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums ace-window avy cape-char cape mule-util orderless
network-stream puny nsm erc-track erc-spelling flyspell ispell erc-ring
erc-nicks color erc-netsplit erc-menu erc-match erc-list erc-goodies
erc-imenu imenu erc-pcomplete pcomplete erc-button erc-fill erc-stamp
erc-join my-secrets cus-start epa-file epa derived epg rfc6068
epg-config erc format-spec erc-backend erc-networks erc-common
erc-compat erc-loaddefs paredit display-line-numbers rx ligature
rainbow-delimiters format-all language-id inheritenv init gnus nnheader
gnus-util time-date mail-utils range mm-util mail-prsvr cus-edit pp
treesit-auto treesit corfu-popupinfo corfu marginalia savehist vertico
compat grep compile text-property-search comint ansi-osc ansi-color ring
cus-load finder-inf undo-fu-session which-key diminish
doom-themes-ext-org doom-nord-theme pcase doom-themes doom-themes-base
edmacro kmacro elec-pair autorevert filenotify desktop frameset recentf
tree-widget wid-edit saveplace use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode package browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie generate-lisp-file url-domsuf
url-util mailcap url-handlers url-parse auth-source eieio eieio-core
icons password-cache json subr-x map byte-opt url-vars cl-macs gv
cl-extra help-mode cl-seq use-package-core cl-loaddefs cl-lib bytecomp
byte-compile info ace-window-autoloads aoc-autoloads avy-autoloads
cape-autoloads consult-autoloads corfu-autoloads debbugs-autoloads
diff-hl-autoloads diminish-autoloads doom-themes-autoloads eat-autoloads
elfeed-autoloads envrc-autoloads format-all-autoloads
geiser-guile-autoloads geiser-autoloads git-modes-autoloads
helpful-autoloads elisp-refs-autoloads f-autoloads inheritenv-autoloads
language-id-autoloads launch-program-autoloads leetcode-autoloads
aio-autoloads ligature-autoloads log4e-autoloads magit-autoloads
magit-section-autoloads dash-autoloads marginalia-autoloads
markdown-mode-autoloads my-secrets-autoloads nerd-icons-dired-autoloads
nerd-icons-autoloads orderless-autoloads paredit-autoloads
rainbow-delimiters-autoloads rainbow-mode-autoloads request-autoloads
rust-mode-autoloads s-autoloads sly-autoloads transient-autoloads
treesit-auto-autoloads undo-fu-autoloads undo-fu-session-autoloads
vertico-autoloads with-editor-autoloads ws-butler-autoloads early-init
rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)
Memory information:
((conses 16 532575 259144) (symbols 48 21073 0) (strings 32 81801 33581)
(string-bytes 1 2864363) (vectors 16 34038) (vector-slots 8 428812 185464)
(floats 8 504 8884) (intervals 56 17700 11521) (buffers 992 19))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74516
; Package
emacs
.
(Tue, 26 Nov 2024 03:37:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 74516 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Trevor Arjeski <tmarjeski <at> gmail.com> writes:
> Reproduction steps:
>
> 1. Have an entry in .authinfo, such as
> machine yourbouncer login nick password hunter2 port 7777
>
> 2. Using the following code in init.el, open emacs
> 3. M-x erc-connect
> 4. Notice ERC tries connecting without password
> 5. Change erc-port to be an integer (commented out below)
> 6. Retry steps 2 - 4
>
> [3. text/x-org]
> #+BEGIN_SRC emacs-lisp
> (use-package erc
> :ensure nil
> :preface
> (defun erc-connect ()
> (interactive)
> (erc :server erc-server
> :port erc-port
> :user erc-nick))
> :custom
> (erc-server "yourbouncer")
> (erc-port "7777") ;; (erc-port 7777) is working
> (erc-nick "nick"))
> #+END_SRC
Thanks. I can reproduce this.
> From 9468a786fb8c0ef950117e78395592f2e11613c2 Mon Sep 17 00:00:00 2001
> From: Trevor Arjeski <tmarjeski <at> gmail.com>
> Date: Sun, 24 Nov 2024 23:35:41 +0300
> Subject: [PATCH] erc: allow port as string in auth-source params
>
> Checking the equality of the given `erc-session-port' with "irc" is
> unnecessary since:
>
> 1. "irc" is already added to the list of ports
> 2. /etc/services may contain "ircs-u" (or other) as the desired port
I think it makes sense to allow entries to specify well known service
names. And I suppose it couldn't hurt to also at least implicitly
support numeric strings, although that sounds like bad UX if anyone
should need to resort to that just to differentiate between entries.
> If the correct port/service is missing then the auth-source query will
> fail for a seemingly unknown reason.
IIRC, all params appearing in an auth-source entry are basically
required, and a successful query must therefore supply all of them.
However, such a query may specify additional, unmatched or partially
matched parameters.
> This also allows a user to `(setopt erc-port "1234")', intentionally or
> accidentally, and still be able to use .authinfo for password
> management.
> ---
> lisp/erc/erc.el | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
> index 7028d0a68cc..81818a7227e 100644
> --- a/lisp/erc/erc.el
> +++ b/lisp/erc/erc.el
> @@ -4675,8 +4675,7 @@ erc--auth-source-determine-params-defaults
> (list net erc-server-announced-name erc-session-server)))
> (ports (list (cl-typecase erc-session-port
> (integer (number-to-string erc-session-port))
> - (string (and (string= erc-session-port "irc")
> - erc-session-port)) ; or nil
> + (string erc-session-port) ; or nil
I've changed this slightly to become nil if `erc-session-port' is the
empty string or "irc".
> (t erc-session-port))
> "irc")))
> (list (cons :host (delq nil hosts))
I've also added a companion patch that changes some foundational
behavior so that `erc-session-port' can more easily be set to a string
to accommodate service names. With your example of
machine mybouncer port ircs-u login mynick password hunter2
if someone tries to connect with
(setopt auth-source-do-cache nil
auth-source-debug t)
(erc-tls :server "mybouncer" :nick "mynick")
they should still be denied. But adding
:port "ircs-u"
to the invocation or doing something like
(setopt erc-port "ircs-u")
beforehand should see them succeed, assuming ircs-u appears in their
/etc/services as a port listened on by their bouncer.
Please try these out when you get a chance and give feedback if
possible. Thanks.
[0001-5.6.1-Allow-querying-auth-source-with-port-as-string.patch (text/x-patch, attachment)]
[0002-5.6.1-Only-normalize-ports-for-equality-comparisons-.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#74516
; Package
emacs
.
(Tue, 26 Nov 2024 05:35:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 74516 <at> debbugs.gnu.org (full text, mbox):
"J.P." <jp <at> neverwas.me> writes:
Great! LGTM. Thanks for taking the time and adding tests!
Trevor
Reply sent
to
"J.P." <jp <at> neverwas.me>
:
You have taken responsibility.
(Mon, 02 Dec 2024 03:52:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Trevor Arjeski <tmarjeski <at> gmail.com>
:
bug acknowledged by developer.
(Mon, 02 Dec 2024 03:52:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 74516-done <at> debbugs.gnu.org (full text, mbox):
Trevor Arjeski <tmarjeski <at> gmail.com> writes:
> "J.P." <jp <at> neverwas.me> writes:
>
> Great! LGTM. Thanks for taking the time and adding tests!
>
> Trevor
Installed as
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=d8995192
Thanks and closing.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 30 Dec 2024 12:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 208 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.