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

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 19 Jul 2020 04:13:03 +0000

Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
41951: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=41951
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#41951: 28.0.50; Automatically detect AUTH=ANONYMOUS in Gnus nnimap?
From: Eric Abrahamsen <[email-masked]>
To: Lars Ingebrigtsen <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Sat, 18 Jul 2020 21:12:49 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Lars Ingebrigtsen <[email-masked]> writes:

> Eric Abrahamsen <[email-masked]> writes:
>
>> Hmm, but `nnimap-credentials->auth-source-search' will prompt for auth
>> details and save them if none are found, which is the behavior I was
>> trying to avoid to begin with.
>
> We could change that to not prompt if AUTH=ANONYMOUS is available?
>
>> Meh, this probably isn't the right thing to do. The manual specifically
>> says (about `nnimap-authenticator'):
>>
>> "Some IMAP servers allow anonymous logins. In that case, this should be
>>  set to ‘anonymous’. If this variable isn’t set, the normal login
>>  methods will be used."
>>
>> So implicitly short-circuiting the normal login procedure is actually
>> contrary to the documentation, which says do it explicitly. I'm inclined
>> to drop this...
>
> Yeah, it's pretty obscure anyway, isn't it?

Yup. Sorry for the noise.

Subject: 28.0.50; Automatically detect AUTH=ANONYMOUS in Gnus nnimap?
From: Eric Abrahamsen <[email-masked]>
To: [email-masked]
Date: Fri, 19 Jun 2020 10:41:53 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

IMAP servers that allow anonymous authentication advertise that fact in
their capabilities as AUTH=ANONYMOUS.

nnimap currently lets you take advantage of this explicitly, by setting
(nnimap-authenticator anonymous) in the server definition. But this
requires you to know in advance that the server allows anonymous
authentication, and decide to use it.

Gnus could figure this out itself and anonymously log in, using the
attached patch. It seems to work fine, but there might be further
consequences I haven't thought of. And possibly we'd simply prefer that
settings like this be a little more explicit for the user?

Does anyone have any opinions on this?

diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el
index f306889a7f..ebb1236674 100644
--- a/lisp/gnus/gnus-registry.el
+++ b/lisp/gnus/gnus-registry.el
@@ -837,6 +837,7 @@ gnus-registry-find-keywords
                 (completing-read "Keyword: " (gnus-registry-keywords) nil t)))
   (registry-lookup-secondary-value gnus-registry-db 'keyword keyword))
 
+
 (defun gnus-registry-register-message-ids ()
   "Register the Message-ID of every article in the group."
   (unless (gnus-parameter-registry-ignore gnus-newsgroup-name)
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 3c4e75ede8..18d3cba173 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -509,7 +509,8 @@ nnimap-open-connection-1
 			  (split-string capabilities)))
 	    (unless (string-match-p "[*.] PREAUTH" greeting)
 	      (if (not (setq credentials
-			     (if (eq nnimap-authenticator 'anonymous)
+			     (if (or (eq nnimap-authenticator 'anonymous)
+				     (nnimap-capability "AUTH=ANONYMOUS"))
 				 (list "anonymous"
 				       (message-make-address))
                                ;; Look for the credentials based on