From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ivan Shmakov Newsgroups: gmane.emacs.bugs Subject: bug#24274: 24.5; Use auth-source library for remote passwords in Rmail Date: Sat, 20 Aug 2016 19:45:50 +0000 Message-ID: <87pop3rzpt.fsf@violet.siamics.net> References: <87vayvqphr.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1471722444 8638 195.159.176.226 (20 Aug 2016 19:47:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 20 Aug 2016 19:47:24 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cc: Viktor Slavkovikj To: 24274@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 20 21:47:20 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbCEh-0001wE-Jx for geb-bug-gnu-emacs@m.gmane.org; Sat, 20 Aug 2016 21:47:19 +0200 Original-Received: from localhost ([::1]:34184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbCEe-00037w-U1 for geb-bug-gnu-emacs@m.gmane.org; Sat, 20 Aug 2016 15:47:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44303) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbCEV-000355-3m for bug-gnu-emacs@gnu.org; Sat, 20 Aug 2016 15:47:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bbCEQ-0004yF-R3 for bug-gnu-emacs@gnu.org; Sat, 20 Aug 2016 15:47:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37634) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbCEQ-0004yB-Fe for bug-gnu-emacs@gnu.org; Sat, 20 Aug 2016 15:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bbCEQ-0006a2-5Q for bug-gnu-emacs@gnu.org; Sat, 20 Aug 2016 15:47:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Aug 2016 19:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24274-submit@debbugs.gnu.org id=B24274.147172236325190 (code B ref 24274); Sat, 20 Aug 2016 19:47:02 +0000 Original-Received: (at 24274) by debbugs.gnu.org; 20 Aug 2016 19:46:03 +0000 Original-Received: from localhost ([127.0.0.1]:35346 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbCDT-0006YA-23 for submit@debbugs.gnu.org; Sat, 20 Aug 2016 15:46:03 -0400 Original-Received: from fely.am-1.org ([78.47.74.50]:39742) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbCDN-0006Xa-OX for 24274@debbugs.gnu.org; Sat, 20 Aug 2016 15:46:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:Cc:To:From; bh=YxgdyyeP78oA0mavjp4kxxhYEe6JUguC5fUZaetVjjI=; b=rkuu/z7OXPwhYyQICU/lANt1TzpS8CdI+Z6i9ZjjKkbSEbePp9jQXO34mWftCRl+8CBwodIXmVUuvJZvCNZl38AccOTXr9nF/JM3Bzx4xpRco66rsgD9FZ465fYb6xWFnfhxxpJvRvlI12mOsZsxfyzbTiOu661gRLMwkkSUKRc=; Original-Received: from violet.siamics.net ([2001:470:1f13:1eb::1:1d]) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.84_2) (envelope-from ) id 1bbCDM-00077r-V3; Sat, 20 Aug 2016 19:45:57 +0000 Original-Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1bbCDG-0005C2-I7; Sun, 21 Aug 2016 02:45:50 +0700 In-Reply-To: <87vayvqphr.fsf@gmail.com> (Viktor Slavkovikj's message of "Sat, 20 Aug 2016 20:12:00 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:122439 Archived-At: >>>>> Viktor Slavkovikj 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=E2=80=99t readily think of any. (Not that I=E2=80=99m 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=E2=80=99d 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=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 > ! :host host > ! :require '(:secr= et))))) > ! (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 =E2=80=98:create t=E2=80=99 among its parameters, m= aking 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))) --=20 FSF associate member #7257 http://am-1.org/~ivan/ =E2=80=A6 3013 B6A0= 230E 334A