From: Ivan Shmakov <ivan@siamics.net>
To: 24274@debbugs.gnu.org
Cc: Viktor Slavkovikj <zhtvk@gmx.com>
Subject: bug#24274: 24.5; Use auth-source library for remote passwords in Rmail
Date: Sat, 20 Aug 2016 19:45:50 +0000 [thread overview]
Message-ID: <87pop3rzpt.fsf@violet.siamics.net> (raw)
In-Reply-To: <87vayvqphr.fsf@gmail.com> (Viktor Slavkovikj's message of "Sat, 20 Aug 2016 20:12:00 +0200")
>>>>> Viktor Slavkovikj <zhtvk@gmx.com> writes:
> Hi, I thought that it would be convenient to obtain remote passwords
> in Rmail from an authinfo file. Therefore, I modified rmail.el to
> make use of the auth-source library. I include a patch for this
> small feature in attachment. Do you think that there could be any
> drawbacks to using this approach?
Personally, I can’t readily think of any. (Not that I’m
particularly familiar with either.)
One issue I see with your patch is that it expands TABs into
spaces outside of the actual code changes. If deliberate, I’d
rather see such whitespace changes in a separate patch.
> ! (defun rmail-get-remote-password (imap user host)
> ! "Get the password for retrieving mail from a POP or IMAP server.
> ! If none has been set, check authinfo for one. If authinfo search
> ! yields no result, prompt the user for the password."
The auth-source library allows access to other backends beside
plain ~/.authinfo, which is why I think it makes sense to
mention the library by name here. See the docstring for the
erc-autojoin-channels-alist variable for an example.
> (when (not rmail-encoded-remote-password)
> (if (not rmail-remote-password)
> ! (setq rmail-remote-password
> ! (let ((found (nth 0 (auth-source-search :max 1
> ! :user user
> ! :host host
> ! :require '(:secret)))))
> ! (if found
> ! (funcall (plist-get found :secret))
> ! (read-passwd (if imap
> ! "IMAP password: "
> ! "POP password: "))))))
The auth-source-search function will prompt for password
automatically if given ‘:create t’ among its parameters, making
explicit read-passwd unnecessary. (But check also the
auth-source-creation-prompts variable.)
> (rmail-set-remote-password rmail-remote-password)
> (setq rmail-remote-password nil))
> (rmail-encode-string rmail-encoded-remote-password (emacs-pid)))
--
FSF associate member #7257 http://am-1.org/~ivan/ … 3013 B6A0 230E 334A
next prev parent reply other threads:[~2016-08-20 19:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-20 18:12 bug#24274: 24.5; Use auth-source library for remote passwords in Rmail Viktor Slavkovikj
2016-08-20 19:45 ` Ivan Shmakov [this message]
2016-08-21 14:26 ` Viktor Slavkovik
2016-08-21 19:30 ` Ivan Shmakov
2016-08-22 13:00 ` Ted Zlatanov
2019-06-25 11:54 ` Lars Ingebrigtsen
2020-08-11 14:12 ` Lars Ingebrigtsen
2020-09-07 15:29 ` Antoine Kalmbach
2020-09-07 15:58 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pop3rzpt.fsf@violet.siamics.net \
--to=ivan@siamics.net \
--cc=24274@debbugs.gnu.org \
--cc=zhtvk@gmx.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.