Subject: bug#41951: 28.0.50; Automatically detect AUTH=ANONYMOUS in Gnus nnimap?

From: Eric Abrahamsen <[email-masked]>
Date: Sat, 18 Jul 2020 20:20:35 -0700

On 07/19/20 05:17 AM, Lars Ingebrigtsen wrote:
> Eric Abrahamsen <[email-masked]> writes:
>
>> I think if we did it this way:
>>
>> (if (or (eq nnimap-authenticator 'anonymous)
>> 	(and (null nnimap-authenticator)
>> 	     (nnimap-capability "AUTH=ANONYMOUS")))
>>     (list "anonymous"
>> 	  (message-make-address))
>>   ;; normal log in process
>>   )
>>
>> Then we only fall back on anonymous if the user hasn't specified
>> anything explicitly. I haven't yet verified that (null
>> nnimap-authenticator) does the right thing in this case, though.
>
> The code now is:
>
> 	      (if (not (setq credentials
> 			     (if (eq nnimap-authenticator 'anonymous)
> 				 (list "anonymous"
> 				       (message-make-address))
>                                ;; Look for the credentials based on
>                                ;; the virtual server name and the address
>                                (nnimap-credentials
> 				(gnus-delete-duplicates
> 				 (list server nnimap-address))
>                                 ports
>                                 nnimap-user))))
>
> That call to nnimap-credentials looks into the .authinfo file, and if
> the password is present there, it uses it.
>
> So at the very least, the auto-anonymous thing would have to be reversed
> in priority -- after the call to nnimap-credentials.

So only honor AUTH=ANONYMOUS if the user has set no
nnimap-authenticator, and also we don't find this server in our
auth-source-search, right?