machine irc.example.net login mynick password sEcReT
@end example
+@anchor{auth-source Server Password}
@subsubheading Server Passwords
When retrieving passwords to accompany the IRC @samp{PASS} command
(@pxref{password parameter}), ERC asks auth-source to match the
@subsubheading Default query behavior
When preparing entries for your backend, it may help to get a feel for
how ERC and its modules conduct searches, especially when exploring a
-new context, such as channel keys. (Hint: in such situations, try
-temporarily setting the variable @code{auth-source-debug} to @code{t}
-and checking @file{*Messages*} periodically for insights into how
-auth-source is operating.) Overall, though, ERC tries to be
+new context, such as channel keys. Overall, though, ERC tries to be
consistent in performing queries across various authentication
contexts. Here's what to expect with respect to the @samp{host}
field, which, by default, most heavily influences the fate of a query:
@samp{user} field (for example, @samp{login "#fsf"}, in netrc's case).
The actual key goes in the @samp{password} (or @samp{secret}) field.
+@anchor{auth-source Troubleshooting}
+@subheading Troubleshooting
+By default, ERC queries @code{auth-source} for channel keys and server
+passwords (@pxref{auth-source Server Password}), as well as other,
+module-specific credentials. In general, if you're having trouble
+calling @code{auth-source-search} in a custom query function, like
+@code{erc-auth-source-server-function}, try temporarily setting the
+variable @code{auth-source-debug} to @code{t} and checking
+@file{*Messages*} periodically for insights into how
+@code{auth-source} is operating.
+
+If you're using a @acronym{GPG}-encrypted file and find that
+customizing one of the function-valued query options doesn't solve
+your problem, explore options @code{epg-pinentry-mode} and
+@code{epg-debug} in the @code{epg} Custom group (@pxref{GnuPG
+Pinentry,,, epa, EasyPG Assistant}). Additionally, keep an eye out
+for an @file{*Error*} buffer, which may contain more specific clues
+about your situation. If you use the libsecrets integration
+(@pxref{Secret Service API,,, auth, Emacs auth-source}) with something
+like GNOME Keyring, you may need to check the ``remember'' box in the
+passphrase popup dialog to avoid being prompted for confirmation every
+time you run ERC. If it doesn't work at first, try logging out. And
+when in doubt, try using the Emacs command @code{secrets-show-secrets}
+to browse the @samp{Login} keyring. There should be a
+@samp{GnuPG/stored-by} entry with a value of @samp{GnuPG Pinentry} or
+similar.
+
@node display-buffer
@subsection display-buffer
@cindex display-buffer
(when erc-log-p
(get-buffer-create (concat "*ERC-DEBUG: " server "*"))))
- (erc-determine-parameters server port nick full-name user passwd)
(erc--initialize-markers old-point continued-session)
+ (erc-determine-parameters server port nick full-name user passwd)
(save-excursion (run-mode-hooks)
(dolist (mod (car delayed-modules)) (funcall mod +1))
(dolist (var (cdr delayed-modules)) (set var nil)))
(plist-get (car sorted) :secret))))
(defun erc-auth-source-search (&rest plist)
- "Call `auth-source-search', possibly with keyword params in PLIST."
+ "Call `auth-source-search', possibly with keyword params in PLIST.
+If the search signals an error before returning, `warn' the user
+and ask whether to continue connecting anyway."
;; These exist as separate helpers in case folks should find them
;; useful. If that's you, please request that they be exported.
- (apply #'erc--auth-source-search
- (apply #'erc--auth-source-determine-params-merge plist)))
+ (condition-case err
+ (apply #'erc--auth-source-search
+ (apply #'erc--auth-source-determine-params-merge plist))
+ (error
+ (erc--lwarn '(erc auth-source) :error
+ "Problem querying `auth-source': %S. See %S for more."
+ (error-message-string err)
+ '(info "(erc) auth-source Troubleshooting"))
+ (when (or noninteractive
+ (not (y-or-n-p "Ignore auth-source error and continue? ")))
+ (signal (car err) (cdr err))))))
(defun erc-server-join-channel (server channel &optional secret)
"Join CHANNEL, optionally with SECRET.