Subject: bug#45340: erc-services.el: Auth-source support for passwords

From: Olivier Certner <[email-masked]>
Date: Fri, 15 Jan 2021 13:41:23 +0100

Hi Leon,

> I was not aware of this, but I have done some debugging and the NickServ
> authentication you use mostly likely does not go through erc-services,
> but the core erc functionality to connect, which sends a PASS command
> with a password from auth source. At least freenode accepts this as a way
> to do NickServ authentication and the patch does not effect this
> functionality at all. To check if that is indeed the case, maybe try
> connecting without having the erc-services module loaded.

Yes, seems to me that you are right, after activating IRC protocol debug 
(`erc-toggle-debug-irc-protocol'), reconnecting to Freenode and looking at the 
logs.

> This patch introduces a different functionality as described above, as
> erc-services, which only handles authentication with actual /nickserv
> identify commands (not handled by the core connect functionality), did
> not query auth source before this patch.

Fine, I thought this may have been already implemented somehow because of 
Freenode's special behavior.

Thanks for looking at this, and for this patch!

After reviewing the code more in details, I think it is great that `erc-
nickserv-get-password' first tries to find a password in `erc-nickserv-
passwords' before proceeding with auth source. `erc-nickserv-passwords' is the 
easiest to customize, and I suspect it is mostly used for interactive override 
or common presets in the init file.

I also have some further suggestion, beyond this enhancement. I think it would 
be even more useful that `erc-prompt-for-nickserv-password' is not required to 
be nil for auth source (or `erc-nickserv-passwords', for that purpose) to be 
used, but rather that, if search in `erc-nickserv-passwords' and auth source 
(if enabled) fails, then prompting should be used as a last resort (if 
enabled). I think this would cover all the use cases I can think of (with 
proper settings of `erc-prompt-for-nickserv-password' and `erc-use-auth-
source-for-nickserv-password'). If more customizations are required, or just 
for the sake of 'simplicity' (YMMV), than maybe replacing these booleans with 
a single list indicating the means to get the password and their order could 
be nice.

What do people think?

Regards.
 
-- 
Olivier Certner