From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/58194 Path: main.gmane.org!not-for-mail From: Simon Josefsson Newsgroups: gmane.emacs.gnus.general Subject: Re: authinfo encryption through netrc.el works now Date: Wed, 04 Aug 2004 19:55:56 +0200 Sender: ding-owner@lists.math.uh.edu Message-ID: References: <4nwu0u8zht.fsf@lifelogs.com> <4noem1tmmp.fsf@lifelogs.com> <4nk6wlzbc2.fsf@koz.bwh.harvard.edu> <4n4qnl8mnw.fsf@lifelogs.com> <4noelsxi20.fsf@lifelogs.com> <4nacxaaloy.fsf_-_@lifelogs.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1091642254 18755 80.91.224.253 (4 Aug 2004 17:57:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 4 Aug 2004 17:57:34 +0000 (UTC) Original-X-From: ding-owner+M6735@lists.math.uh.edu Wed Aug 04 19:57:21 2004 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BsQ0u-000132-00 for ; Wed, 04 Aug 2004 19:57:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1BsPzl-000210-00; Wed, 04 Aug 2004 12:56:09 -0500 Original-Received: from util2.math.uh.edu ([129.7.128.23]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1BsPzh-00020v-00 for ding@lists.math.uh.edu; Wed, 04 Aug 2004 12:56:05 -0500 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by util2.math.uh.edu with esmtp (Exim 4.30) id 1BsPzg-0000hA-FR for ding@lists.math.uh.edu; Wed, 04 Aug 2004 12:56:04 -0500 Original-Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by justine.libertine.org (Postfix) with ESMTP id 59DFC3A0041 for ; Wed, 4 Aug 2004 12:56:02 -0500 (CDT) Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1BsPzc-0000cb-00 for ; Wed, 04 Aug 2004 19:56:00 +0200 Original-Received: from c494102a.s-bi.bostream.se ([217.215.27.65]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 04 Aug 2004 19:56:00 +0200 Original-Received: from jas by c494102a.s-bi.bostream.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 04 Aug 2004 19:56:00 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: ding@gnus.org Original-Lines: 31 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: c494102a.s-bi.bostream.se User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:LN9ewtEO4aYGenb88DcrooD0Rjw= Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:58194 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:58194 > +(defun password-read-and-add (prompt &optional key) > + "Read password, for use with KEY, from user, or from cache if wanted. > +Then store the password in the cache. Uses `password-read' and > +`password-cache-add'." > + (let ((password (password-read prompt key))) > + (when (and password key) > + (password-cache-add key password)) > + password)) FWIW: The point of separating reading the password and caching it, was that code using password.el would typically look like: 1. Read password. 2. Try to authenticate against server, invoke GPG using the password, etc. 3. If authentication failed, goto 1. 4. Cache the password. If the password is cached directly, and if the user type the wrong password, that logic wouldn't work, and it would infloop steps 1, 2, and 3. I realize that perhaps a better logic would be: 1. Read and cache password. 2. Try to authenticate against server, invoke GPG using the password, etc. 3. If authentication failed, clear password, and goto 1. And if the gnus-encrypt/netrc stuff use this logic, then fine, and ignore this message.