From: Chris Hanson Date: Tue, 23 May 2000 21:00:52 +0000 (+0000) Subject: Add mechanism to control the retention time of IMAIL passwords. X-Git-Tag: 20090517-FFI~3695 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=1486edc4501459e43e25697378a646ad8c99044d;p=mit-scheme.git Add mechanism to control the retention time of IMAIL passwords. --- diff --git a/v7/src/imail/imail-top.scm b/v7/src/imail/imail-top.scm index 52c15b37c..8ff46a583 100644 --- a/v7/src/imail/imail-top.scm +++ b/v7/src/imail/imail-top.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: imail-top.scm,v 1.102 2000/05/23 20:19:06 cph Exp $ +;;; $Id: imail-top.scm,v 1.103 2000/05/23 21:00:42 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -106,6 +106,22 @@ if none is otherwise specified. May be overridden by an explicit mailbox in imail-primary-folder." "inbox" string?) + +(define-variable imail-pass-phrase-retention-time + "The amount of time, in minutes, that IMAIL retains pass phrases. +The pass phrase is deleted if unused for this long. +Set this to zero if you don't want pass-phrase retention." + 30 + exact-nonnegative-integer?) + +(add-variable-assignment-daemon! + (ref-variable-object imail-pass-phrase-retention-time) + (lambda (buffer variable) + (clean-imail-memoized-pass-phrases + (get-universal-time) + (if buffer + (variable-local-value buffer variable) + (variable-default-value variable))))) (define-command imail "Read and edit incoming mail. @@ -253,17 +269,33 @@ regardless of the folder type." prompt-for-yes-or-no?) (define (imail-call-with-pass-phrase url receiver) - (let ((key (url-pass-phrase-key url))) - (let ((obscured (hash-table/get imail-memoized-pass-phrases key #f))) - (if obscured - (call-with-unobscured-pass-phrase obscured receiver) + (let ((key (url-pass-phrase-key url)) + (now (get-universal-time)) + (retention-time (ref-variable imail-pass-phrase-retention-time))) + (clean-imail-memoized-pass-phrases now retention-time) + (let ((entry (hash-table/get imail-memoized-pass-phrases key #f))) + (if entry + (begin + (set-car! entry now) + (call-with-unobscured-pass-phrase (cdr entry) receiver)) (call-with-pass-phrase (string-append "Pass phrase for " key) (lambda (pass-phrase) - (hash-table/put! imail-memoized-pass-phrases key - (obscure-pass-phrase pass-phrase)) + (if (> retention-time 0) + (hash-table/put! imail-memoized-pass-phrases key + (cons now + (obscure-pass-phrase pass-phrase)))) (receiver pass-phrase))))))) +(define (clean-imail-memoized-pass-phrases now retention-time) + (if (> retention-time 0) + (hash-table/for-each imail-memoized-pass-phrases + (let ((cutoff (- now retention-time))) + (lambda (key datum) + (if (<= (car datum) cutoff) + (hash-table/remove! imail-memoized-pass-phrases key))))) + (hash-table/clear! imail-memoized-pass-phrases))) + (define imail-memoized-pass-phrases (make-string-hash-table)) @@ -327,11 +359,11 @@ Instead, these commands are available: \\[imail-forward] Forward this message to another user. \\[imail-continue] Continue composing outgoing message started before. -\\[imail-output] Output this message to a specified folder (append it). \\[imail-input] Append messages from a specified folder. +\\[imail-output] Output this message to a specified folder (append it). \\[imail-copy-messages] Copy all messages in selected folder to another folder. \\[imail-create-folder] Create a new folder. (Normally not needed - as output commands auto-create folders.) + as output commands create folders automatically.) \\[imail-delete-folder] Delete an existing folder. \\[imail-add-flag] Add flag to message. It will be displayed in the mode line. @@ -364,6 +396,7 @@ variable's documentation (using \\[describe-variable]) for details: imail-kept-headers imail-message-filter imail-mode-hook + imail-pass-phrase-retention-time imail-primary-folder imail-reply-with-re @@ -415,8 +448,9 @@ variable's documentation (using \\[describe-variable]) for details: (define-key 'imail #\t 'imail-toggle-header) (define-key 'imail #\m-s 'imail-search) -(define-key 'imail #\o 'imail-output) (define-key 'imail #\i 'imail-input) +(define-key 'imail #\o 'imail-output) +(define-key 'imail #\m-o 'imail-copy-messages) (define-key 'imail #\+ 'imail-create-folder) (define-key 'imail #\- 'imail-delete-folder) (define-key 'imail #\q 'imail-quit) diff --git a/v7/src/imail/todo.txt b/v7/src/imail/todo.txt index 81c79230c..08e9eb26c 100644 --- a/v7/src/imail/todo.txt +++ b/v7/src/imail/todo.txt @@ -1,5 +1,5 @@ IMAIL To-Do List -$Id: todo.txt,v 1.46 2000/05/23 20:19:09 cph Exp $ +$Id: todo.txt,v 1.47 2000/05/23 21:00:52 cph Exp $ Bug fixes --------- @@ -64,8 +64,6 @@ New features message ID can be used. (Or perhaps no cache is required for non-IMAP folders.) -* Password memoization should be controllable from the editor. - * Implement file backup when writing file folders. * Write folder browser for IMAP servers. Implement