Gnus development mailing list
 help / color / mirror / Atom feed
From: Daiki Ueno <ueno@unixuser.org>
To: ding@gnus.org
Subject: Re: auth-source (.authinfo.gpg) stopped working?
Date: Wed, 05 Jan 2011 11:51:49 +0900	[thread overview]
Message-ID: <m3oc7w12ti.fsf-ueno-ueno@unixuser.org> (raw)
In-Reply-To: <m3y671v4a6.fsf-ueno@unixuser.org> (Daiki Ueno's message of "Tue, 04 Jan 2011 10:36:17 +0900")

[-- Attachment #1: Type: text/plain, Size: 1217 bytes --]

Daiki Ueno <ueno@unixuser.org> writes:

> Presumably this might be the culprit.  It copies the function
> `netrc-store-data' from netrc.el and most likely the format is different
> from the one used by netrc.el included in XEmacs packages.

Sorry I was missing the point.  Please ignore my guess the above.

After debugging with XEmacs (I could reproduce the problem), now I
suspect that the cause is elsewhere.  Even with or without the above
change, (netrc-parse "~/.authinfo.gpg") always returns nil except the
first time, because the netrc-cache handling is buggy.  netrc saves the
content of the file in a form mangled with base64 and rot13.  However,
XEmacs does not have rot13-string and dgnushack.el defines rot13-string
as a macro:

(defmacro rot13-string (string)
  "Return ROT13 encryption of STRING."
  `(with-temp-buffer
    (insert ,string)
    (translate-region (point-min) (point-max) ,rot13-display-table)
    (buffer-string)))

netrc-parse uses it as to save the contents:

(setq netrc-cache ... (rot13-string (base64-encode-string (buffer-string))))

Guess what will happen.  Since buffer-string is called from the buffer
created by rot13-string, it will always return "".

I'm attaching a patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-argument-passing-when-rot13-string-is-defined-as.patch --]
[-- Type: text/x-patch, Size: 1423 bytes --]

From 0e33d1b9c124bdc1f6fe4a186078318da887e386 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Wed, 5 Jan 2011 11:47:59 +0900
Subject: [PATCH] Fix argument passing when rot13-string is defined as macro.

---
 lisp/ChangeLog |    5 +++++
 lisp/netrc.el  |    8 +++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 586e706..a6a9d96 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-05  Daiki Ueno  <ueno@unixuser.org>
+
+	* netrc.el (netrc-parse): Take care of the arg of rot13-string in case
+	that it is defined as a macro.
+
 2011-01-03  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 	* flow-fill.el (fill-flowed-encode): Do encoding citation-aware.
diff --git a/lisp/netrc.el b/lisp/netrc.el
index 989470b..ab4c0d8 100644
--- a/lisp/netrc.el
+++ b/lisp/netrc.el
@@ -69,9 +69,11 @@
 	    (insert-file-contents file)
 	    (when (string-match "\\.gpg\\'" file)
 	      (setq netrc-cache (cons (nth 5 (file-attributes file))
-				      (rot13-string
-				       (base64-encode-string
-					(buffer-string)))))))
+				      (buffer-string)))
+	      ;; Store the contents of the file heavily encrypted in memory.
+	      (setcdr netrc-cache (rot13-string
+				   (base64-encode-string
+				    (cdr netrc-cache))))))
 	  (goto-char (point-min))
 	  ;; Go through the file, line by line.
 	  (while (not (eobp))
-- 
1.7.3.4


[-- Attachment #3: Type: text/plain, Size: 25 bytes --]


Regards,
-- 
Daiki Ueno

  reply	other threads:[~2011-01-05  2:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-24  4:45 Dave Goldberg
2010-12-27 13:18 ` Ted Zlatanov
2010-12-27 15:48   ` Dave Goldberg
2010-12-28 14:48     ` Dave Goldberg
2011-01-02  5:55       ` Lars Magne Ingebrigtsen
2011-01-03 13:35         ` Dave Goldberg
2011-01-03 14:02           ` Dave Goldberg
2011-01-03 23:59             ` Lars Magne Ingebrigtsen
2011-01-04  1:24               ` Dave Goldberg
2011-01-04  1:36               ` Daiki Ueno
2011-01-05  2:51                 ` Daiki Ueno [this message]
2011-01-05 14:08                   ` Dave Goldberg
2011-01-05 14:14                   ` Katsumi Yamaoka
2011-01-05 18:43                     ` Daiki Ueno
2011-01-06 13:12                     ` Dave Goldberg

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=m3oc7w12ti.fsf-ueno-ueno@unixuser.org \
    --to=ueno@unixuser.org \
    --cc=ding@gnus.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).