[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: file storage in IMAP (eventually for Tramp) working and needs testin
From: |
Daiki Ueno |
Subject: |
Re: file storage in IMAP (eventually for Tramp) working and needs testing |
Date: |
Thu, 23 Apr 2009 23:28:08 +0900 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) |
>>>>> In <address@hidden>
>>>>> Daiki Ueno <address@hidden> wrote:
> >>>>> In <address@hidden>
> >>>>> Ted Zlatanov <address@hidden> wrote:
> > If you trust your 3 servers, that's great. The vast majority of IMAP
> > users, as I said, have no expectation of privacy on their IMAP server
> > (consider GMail, for instance). This is not a filesystem on a remote
> > server where you can trust user permissions to be managed correctly.
> I agree with the facts. But in that case, you cannot even trust your
> ISP which delivers original e-mails, can you?
Ah, I see my confusion about e-mail systems and IMAP as a file system.
That makes sense. I apologize to you for that.
But still, I'm against the use of PGG (which is on the way to
obsolescence) in the new package. Here is a patch to use EPG instead.
--- tramp-imap.el~ 2009-04-23 23:13:51.000000000 +0900
+++ tramp-imap.el 2009-04-23 23:25:46.000000000 +0900
@@ -247,7 +247,7 @@
(require 'tramp-cache)
(require 'tramp-compat)
(require 'imap)
-(require 'pgg)
+(require 'epa)
(autoload 'auth-source-user-or-password "auth-source")
;; Define Tramp IMAP method ...
@@ -627,8 +627,7 @@
(goto-char (point-min))
(while (re-search-forward "
" nil t)
(replace-match "" nil nil))
- ;; TODO: catch errors from PGG here
- (tramp-imap-pgg-decode-buffer))))
+ (tramp-imap-decode-buffer))))
;;; (tramp-imap-collapse-name "a b c / where ; strange ! characters $ abound")
;;; => "abcwherestrangecharactersabound"
@@ -655,29 +654,40 @@
(with-current-buffer filename-or-buffer
(buffer-string)))
(insert-file-contents filename-or-buffer))
- (tramp-imap-pgg-encode-buffer))))
+ (tramp-imap-encode-buffer))))
(current-buffer)))
-(defun tramp-imap-pgg-encode-buffer ()
- (tramp-imap-pgg-process-buffer t))
-
-(defun tramp-imap-pgg-decode-buffer ()
- (tramp-imap-pgg-process-buffer))
-
-(defun tramp-imap-pgg-process-buffer (&optional encode)
- "Use PGG to encode or decode the current buffer."
- (let ((pfft (if encode 'pgg-encrypt-symmetric 'pgg-decrypt))
- (default-enable-multibyte-characters nil)
- (input (buffer-substring-no-properties (point-min) (point-max)))
- exit-data)
- (with-temp-buffer
- (insert input)
- ;; note that we call pfft before pgg-display-output-buffer
- (pgg-display-output-buffer (point-min) (point-max) (funcall pfft
(point-min) (point-max) tramp-imap-passphrase))
- (setq exit-data
- (buffer-substring-no-properties (point-min) (point-max))))
-; (debug exit-data)
- exit-data))
+(defun tramp-imap-encode-buffer ()
+ (let ((context (epg-make-context 'OpenPGP))
+ cipher)
+ (epg-context-set-armor context t)
+ (epg-context-set-passphrase-callback context
+ #'epa-passphrase-callback-function)
+ (epg-context-set-progress-callback context
+ (cons #'epa-progress-callback-function
+ "Encrypting..."))
+ (message "Encrypting...")
+ (setq cipher (epg-encrypt-string
+ context
+ (encode-coding-string (buffer-string) 'utf-8)
+ nil))
+ (message "Encrypting...done")
+ cipher))
+
+(defun tramp-imap-decode-buffer ()
+ (let ((context (epg-make-context 'OpenPGP))
+ plain)
+ (epg-context-set-passphrase-callback context
+ #'epa-passphrase-callback-function)
+ (epg-context-set-progress-callback context
+ (cons #'epa-progress-callback-function
+ "Decrypting..."))
+ (message "Decrypting...")
+ (setq plain (decode-coding-string
+ (epg-decrypt-string context (buffer-string))
+ 'utf-8))
+ (message "Decrypting...done")
+ plain))
(provide 'tramp-imap)
;;; tramp-imap.el ends here
Regards,
--
Daiki Ueno
- Re: file storage in IMAP (eventually for Tramp) working and needs testing, (continued)
- Re: file storage in IMAP (eventually for Tramp) working and needs testing, Ted Zlatanov, 2009/04/14
- Re: file storage in IMAP (eventually for Tramp) working and needs testing, Michael Albinus, 2009/04/14
- Re: file storage in IMAP (eventually for Tramp) working and needs testing, Ted Zlatanov, 2009/04/14
- Re: file storage in IMAP (eventually for Tramp) working and needs testing, Michael Albinus, 2009/04/15
- Re: file storage in IMAP (eventually for Tramp) working and needs testing, Ted Zlatanov, 2009/04/23
- Re: file storage in IMAP (eventually for Tramp) working and needs testing, Daiki Ueno, 2009/04/23
- Re: file storage in IMAP (eventually for Tramp) working and needs testing, Ted Zlatanov, 2009/04/23
- Re: file storage in IMAP (eventually for Tramp) working and needs testing, Daiki Ueno, 2009/04/23
- Re: file storage in IMAP (eventually for Tramp) working and needs testing, Ted Zlatanov, 2009/04/23
- Re: file storage in IMAP (eventually for Tramp) working and needs testing, Daiki Ueno, 2009/04/23
- Re: file storage in IMAP (eventually for Tramp) working and needs testing,
Daiki Ueno <=
- Re: file storage in IMAP (eventually for Tramp) working and needs testing, Ted Zlatanov, 2009/04/23
- Re: file storage in IMAP (eventually for Tramp) working and needs testing, Daiki Ueno, 2009/04/24
- Re: file storage in IMAP (eventually for Tramp) working and needs testing, Ted Zlatanov, 2009/04/23
- Re: file storage in IMAP (eventually for Tramp) working and needs testing, Ted Zlatanov, 2009/04/24
- Re: file storage in IMAP (eventually for Tramp) working and needs testing, Michael Albinus, 2009/04/25