summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2001-02-15 09:55:47 +0000
committerGerd Moellmann <gerd@gnu.org>2001-02-15 09:55:47 +0000
commitfe10cef0d2f11198b916034d539a5b42d5e983a0 (patch)
tree6d9f1b34f5bce96dc080a0a216fe6a374ef8e035
parent126f5d4d57d4dca1b2100268b9c95b07efa1c37f (diff)
downloademacs-fe10cef0d2f11198b916034d539a5b42d5e983a0.tar.gz
(read-passwd): Clear Lisp memory holding password.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/subr.el24
2 files changed, 23 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 084022ba6a1..a176015c8db 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2001-02-15 Gerd Moellmann <gerd@gnu.org>
+
+ * subr.el (read-passwd): Clear Lisp memory holding password.
+
2001-02-15 Miles Bader <miles@gnu.org>
* info.el (Info-copy-current-node-name): New function.
diff --git a/lisp/subr.el b/lisp/subr.el
index 2d6a72a6ac5..269ff1f2b1f 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1,6 +1,7 @@
;;; subr.el --- basic lisp subroutines for Emacs
-;; Copyright (C) 1985, 86, 92, 94, 95, 99, 2000 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 86, 92, 94, 95, 99, 2000, 2001
+;; Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
@@ -905,7 +906,11 @@ Optional DEFAULT is a default password to use instead of empty input."
(let ((first (read-passwd prompt nil default))
(second (read-passwd "Confirm password: " nil default)))
(if (equal first second)
- (setq success first)
+ (progn
+ (and (arrayp second) (fillarray second ?\0))
+ (setq success first))
+ (and (arrayp first) (fillarray first ?\0))
+ (and (arrayp second) (fillarray second ?\0))
(message "Password not repeated accurately; please start over")
(sit-for 1))))
success)
@@ -919,11 +924,20 @@ Optional DEFAULT is a default password to use instead of empty input."
(setq c (read-char-exclusive nil t))
(and (/= c ?\r) (/= c ?\n) (/= c ?\e)))
(if (= c ?\C-u)
- (setq pass "")
+ (progn
+ (and (arrayp pass) (fillarray pass ?\0))
+ (setq pass ""))
(if (and (/= c ?\b) (/= c ?\177))
- (setq pass (concat pass (char-to-string c)))
+ (let* ((new-char (char-to-string c))
+ (new-pass (concat pass new-char)))
+ (and (arrayp pass) (fillarray pass ?\0))
+ (fillarray new-char ?\0)
+ (setq c ?\0)
+ (setq pass new-pass))
(if (> (length pass) 0)
- (setq pass (substring pass 0 -1))))))
+ (let ((new-pass (substring pass 0 -1)))
+ (and (arrayp pass) (fillarray pass ?\0))
+ (setq pass new-pass))))))
(clear-this-command-keys)
(message nil)
(or pass default ""))))