mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Support checking auth-source for NickServ password for rcirc
* doc/misc/rcirc.texi: Mention new feature. * etc/NEWS: Mention new feature. * lisp/net/rcirc.el (rcirc-authinfo): Update type and documentation. (rcirc-authenticate): Handle a special type to indicate that the password is stored via auth-source.
This commit is contained in:
parent
2438aaf764
commit
1009e3d1fd
3 changed files with 57 additions and 35 deletions
|
|
@ -595,6 +595,10 @@ Before you can use this method, you will have to register your nick and
|
|||
pick a password for it. Contact @code{nickserv} and check out the
|
||||
details. (Using @code{/msg nickserv help}, for example.)
|
||||
|
||||
You can set the password to the symbol @code{:auth-source}, to fetch the
|
||||
password from auth-source (@pxref{auth-source}), if you to not hard-code
|
||||
your password in your configuration.
|
||||
|
||||
@item chanserv
|
||||
@cindex chanserv authentication
|
||||
Use this symbol if you need to identify yourself as follows if you want
|
||||
|
|
|
|||
7
etc/NEWS
7
etc/NEWS
|
|
@ -1891,6 +1891,13 @@ the command will only copy those files.
|
|||
+++
|
||||
*** package-x.el is now obsolete.
|
||||
|
||||
|
||||
** RCIRC
|
||||
|
||||
+++
|
||||
*** Authentication via NickServ can access password from 'auth-source'
|
||||
For details, consult 'rcirc-authinfo'.
|
||||
|
||||
** Xref
|
||||
|
||||
---
|
||||
|
|
|
|||
|
|
@ -270,8 +270,13 @@ The ARGUMENTS for each METHOD symbol are:
|
|||
`sasl': NICK PASSWORD
|
||||
`certfp': KEY CERT
|
||||
|
||||
For `nickserv', PASSWORD may be the symbol `:auth-source', in which case
|
||||
the host, nick and port will be used to query a password from an
|
||||
available `auth-source' backend.
|
||||
|
||||
Examples:
|
||||
((\"Libera.Chat\" nickserv \"bob\" \"p455w0rd\")
|
||||
(\"Libera.Chat\" nickserv \"bob\" :auth-source)
|
||||
(\"Libera.Chat\" chanserv \"bob\" \"#bobland\" \"passwd99\")
|
||||
(\"Libera.Chat\" certfp \"/path/to/key\" \"/path/to/cert\")
|
||||
(\"bitlbee\" bitlbee \"robert\" \"sekrit\")
|
||||
|
|
@ -282,7 +287,9 @@ Examples:
|
|||
:value-type (choice (list :tag "NickServ"
|
||||
(const nickserv)
|
||||
(string :tag "Nick")
|
||||
(string :tag "Password"))
|
||||
(choice
|
||||
(string :tag "Password")
|
||||
(const :tag "Use Auth-Source" :auth-source)))
|
||||
(list :tag "ChanServ"
|
||||
(const chanserv)
|
||||
(string :tag "Nick")
|
||||
|
|
@ -3666,40 +3673,44 @@ specified in RFC2812, where 005 stood for RPL_BOUNCE."
|
|||
Passwords are stored in `rcirc-authinfo' (which see)."
|
||||
(interactive)
|
||||
(with-rcirc-server-buffer
|
||||
(dolist (i rcirc-authinfo)
|
||||
(let ((process (rcirc-buffer-process))
|
||||
(server (car i))
|
||||
(nick (nth 2 i))
|
||||
(method (cadr i))
|
||||
(args (cdddr i)))
|
||||
(when (and (string-match server rcirc-server))
|
||||
(if (and (memq method '(nickserv chanserv bitlbee))
|
||||
(string-match nick rcirc-nick))
|
||||
;; the following methods rely on the user's nickname.
|
||||
(cl-case method
|
||||
(nickserv
|
||||
(pcase-dolist (`(,(rx (regexp rcirc-server)) . ,ai) rcirc-authinfo)
|
||||
(pcase ai
|
||||
(`(nickserv ,(rx (regexp rcirc-nick)) :auth-source . ,(or `(,nickserv) '()))
|
||||
(if-let* ((auth (auth-source-search
|
||||
:host rcirc-server
|
||||
:port (nth 1 rcirc-connection-info)
|
||||
:user (nth 2 rcirc-connection-info)))
|
||||
(password (auth-info-password (car auth))))
|
||||
(rcirc-send-privmsg
|
||||
process
|
||||
(or (cadr args) "NickServ")
|
||||
(concat "IDENTIFY " (car args))))
|
||||
(chanserv
|
||||
(rcirc-buffer-process)
|
||||
(or nickserv "NickServ")
|
||||
(concat "IDENTIFY " password))
|
||||
(rcirc-print
|
||||
(rcirc-buffer-process) rcirc-nick "ERROR" nil
|
||||
"No auth-source entry found for `nickserv' authentication")))
|
||||
(`(nickserv ,(rx (regexp rcirc-nick)) ,password . ,(or `(,nickserv) '()))
|
||||
(rcirc-send-privmsg
|
||||
process
|
||||
(rcirc-buffer-process)
|
||||
(or nickserv "NickServ")
|
||||
(concat "IDENTIFY " password)))
|
||||
(`(chanserv ,(rx (regexp rcirc-nick)) ,channel ,password)
|
||||
(rcirc-send-privmsg
|
||||
(rcirc-buffer-process)
|
||||
"ChanServ"
|
||||
(format "IDENTIFY %s %s" (car args) (cadr args))))
|
||||
(bitlbee
|
||||
(format "IDENTIFY %s %s" channel password)))
|
||||
(`(bitlbee ,(rx (regexp rcirc-nick)) ,password)
|
||||
(rcirc-send-privmsg
|
||||
process
|
||||
(rcirc-buffer-process)
|
||||
"&bitlbee"
|
||||
(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)
|
||||
(concat "IDENTIFY " password)))
|
||||
(`(quakenet ,account ,password)
|
||||
;; quakenet authentication doesn't rely on the user's
|
||||
;; nickname. the variable `account' here represents the Q
|
||||
;; account name.
|
||||
(rcirc-send-privmsg
|
||||
process
|
||||
(rcirc-buffer-process)
|
||||
"Q@CServe.quakenet.org"
|
||||
(format "AUTH %s %s" nick (car args))))))))))
|
||||
(format "AUTH %s %s" account password)))))))
|
||||
|
||||
(defun rcirc-handler-INVITE (process sender args _text)
|
||||
"Notify user of an invitation from SENDER.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue