From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daiki Ueno Newsgroups: gmane.emacs.devel Subject: Re: secure plist store Date: Fri, 01 Jul 2011 08:10:21 +0900 Message-ID: <87sjqqx6ea.fsf-ueno@unixuser.org> References: <87sjrttwh8.fsf@lifelogs.com> <87wrh4b9h9.fsf@lifelogs.com> <87aae05l8p.fsf-ueno@unixuser.org> <87k4d4b66p.fsf@lifelogs.com> <87wrh0fh4g.fsf_-_@lifelogs.com> <87y60ncma8.fsf_-_@lifelogs.com> <87vcvrne02.fsf-ueno@unixuser.org> <87r56ep3sm.fsf@lifelogs.com> <874o39n171.fsf-ueno@unixuser.org> <87mxh0sy9o.fsf@lifelogs.com> <87pqlwkfw1.fsf-ueno@unixuser.org> <87fwmsr9iu.fsf@lifelogs.com> <8739isjxqw.fsf-ueno@unixuser.org> <87oc1fy0c0.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1309475458 18038 80.91.229.12 (30 Jun 2011 23:10:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 30 Jun 2011 23:10:58 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 01 01:10:55 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QcQNq-0002Di-E2 for ged-emacs-devel@m.gmane.org; Fri, 01 Jul 2011 01:10:54 +0200 Original-Received: from localhost ([::1]:58137 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcQNp-0001m5-Cf for ged-emacs-devel@m.gmane.org; Thu, 30 Jun 2011 19:10:53 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:57784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcQNW-0001lr-Ky for emacs-devel@gnu.org; Thu, 30 Jun 2011 19:10:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QcQNU-0007oU-Jr for emacs-devel@gnu.org; Thu, 30 Jun 2011 19:10:34 -0400 Original-Received: from ivory4.scn-net.ne.jp ([219.117.176.192]:50664) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QcQNT-0007nT-Oi for emacs-devel@gnu.org; Thu, 30 Jun 2011 19:10:32 -0400 Original-Received: from ([192.168.0.187]) (envelope sender: ) by ivory4.scn-net.ne.jp with Active!Hunter esmtp server; Fri, 1 Jul 2011 08:10:23 +0900 Original-Received: Received: from well-done.deisui.org (g187018.scn-net.ne.jp [202.83.187.18]) (authenticated) by blue17.scn-net.ne.jp (unknown) with ESMTP id p5UNAMCn016069 for ; Fri, 1 Jul 2011 08:10:23 +0900 In-Reply-To: <87oc1fy0c0.fsf@lifelogs.com> (Ted Zlatanov's message of "Thu, 30 Jun 2011 07:23:43 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 219.117.176.192 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:141294 Archived-At: --=-=-= Ted Zlatanov writes: > DU> Also, if you use only symmetric encryption, you can remove the > DU> condition Y: (if (eq key-id 'SYM) X Y) > > Thanks, I'll do that. You could simplify more; patch attached: $ bzr diff --diff-options=-w | diffstat auth-source.el | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) BTW, I think you should adjust indentation of the whole file. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=auth-source.el.diff === modified file 'lisp/gnus/auth-source.el' --- lisp/gnus/auth-source.el 2011-06-30 14:25:27 +0000 +++ lisp/gnus/auth-source.el 2011-06-30 23:02:41 +0000 @@ -43,7 +43,6 @@ (require 'mm-util) (require 'gnus-util) (require 'assoc) -(require 'epa) (require 'epg) (eval-when-compile (require 'cl)) @@ -984,25 +983,7 @@ (defvar auth-source-passphrase-alist nil) -(defun auth-source-passphrase-callback-function (context key-id handback - &optional sym-detail) - "Exactly like `epa-passphrase-callback-function' but takes an -extra SYM-DETAIL parameter which will be printed at the end of -the symmetric passphrase prompt, and assumes symmetric -encryption." - (read-passwd - (format "Passphrase for symmetric encryption%s%s: " - ;; Add the file name to the prompt, if any. - (if (stringp handback) - (format " for %s" handback) - "") - (if (stringp sym-detail) - sym-detail - "")) - (eq (epg-context-operation context) 'encrypt))) - (defun auth-source-token-passphrase-callback-function (context key-id file) - (if (eq key-id 'SYM) (let* ((file (file-truename file)) (entry (assoc file auth-source-passphrase-alist)) passphrase) @@ -1014,14 +995,13 @@ (unless entry (setq entry (list file)) (push entry auth-source-passphrase-alist)) - (setq passphrase (auth-source-passphrase-callback-function context - key-id - file - " tokens")) + (setq passphrase + (read-passwd + (format "Passphrase for for %s token: " file) + t)) (setcdr entry (lexical-let ((p (copy-sequence passphrase))) (lambda () p))) - passphrase))) - (epa-passphrase-callback-function context key-id file))) + passphrase)))) ;; (auth-source-epa-extract-gpg-token "gpg:LS0tLS1CRUdJTiBQR1AgTUVTU0FHRS0tLS0tClZlcnNpb246IEdudVBHIHYxLjQuMTEgKEdOVS9MaW51eCkKCmpBMEVBd01DT25qMjB1ak9rZnRneVI3K21iNm9aZWhuLzRad3cySkdlbnVaKzRpeEswWDY5di9icDI1U1dsQT0KPS9yc2wKLS0tLS1FTkQgUEdQIE1FU1NBR0UtLS0tLQo=" "~/.netrc") (defun auth-source-epa-extract-gpg-token (secret file) --=-=-= Regards, -- Daiki Ueno --=-=-=--