;ELC ;;; compiled by jwz@thalidomide on Thu Apr 14 03:48:09 1994 ;;; from file /th/jwz/emacs19/lisp/utils/passwd.el ;;; emacs version 19.10 Lucid (beta14). ;;; bytecomp version 2.23; 22-dec-93. ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19"))) (error "This file was compiled for Emacs 19.")) (defvar passwd-echo 46 "\ *The character which should be echoed when typing a password, or nil, meaning echo nothing.") (defvar read-passwd-map (byte-code "!  \" !! \"\"  W  I  # T f* # # # # # # # )" [nil map fboundp set-keymap-parent make-keymap minibuffer-local-map copy-keymap set-keymap-name read-passwd-map 0 make-string 1 s i 127 define-key self-insert-command "" delete-backward-char "" keyboard-quit " " exit-minibuffer "\n" "" passwd-erase-buffer "" quoted-insert ""] 5) "\ Keymap used for reading passwords in the minibuffer. The \"bindings\" in this map are not real commands; only a limited number of commands are understood. The important bindings are: \\ \\[passwd-erase-buffer] Erase all input. \\[quoted-insert] Insert the next character literally. \\[delete-backward-char] Delete the previous character. \\[exit-minibuffer] Accept what you have typed. \\[keyboard-quit] Abort the command. All other characters insert themselves (but do not echo.)") (fset 'read-passwd #[(prompt &optional confirm default) "!q\n! !Ǝ \n  $\nq ʉЎ\nq \n #\n\"Ӊc\" \n #L)*+" [get-buffer-create " *password*" input buffer-disable-undo use-local-map read-passwd-map ((byte-code " \n! \"!!LJ" [passwd-ungrab-keyboard passwd-kill-buffer input string-match "^19" emacs-version message nil ""] 3)) passwd-grab-keyboard read-passwd-1 prompt nil default confirm buffer-string passwd ok ((byte-code " \"‡" [passwd ok fillarray 0] 3)) "[Retype to confirm]" passwd-compare-string-to-buffer t fillarray 0 beep "[Mismatch. Start over]"] 6 "\ Prompts for a password in the minibuffer, and returns it as a string. If optional arg CONFIRM is true, then ask the user to type the password again to confirm that they typed it correctly. If optional arg DEFAULT is provided, then it is a string to insert as the default choice (it is not, of course, displayed.) If running under X, the keyboard will be grabbed (with XGrabKeyboard()) to reduce the possibility that evesdropping is occuring. When reading a password, all keys self-insert, except for: \\ \\[read-passwd-erase-line] Erase the entire line. \\[quoted-insert] Insert the next character literally. \\[delete-backward-char] Delete the previous character. \\[exit-minibuffer] Accept what you have typed. \\[keyboard-quit] Abort the command. The returned value is always a newly-created string. No additional copies of the password remain after this function has returned. NOTE: unless great care is taken, the typed password will exist in plaintext form in the running image for an arbitrarily long time. Privileged users may be able to extract it from memory. If emacs crashes, it may appear in the resultant core file. Some steps you can take to prevent the password from being copied around: - as soon as you are done with the returned string, destroy it with (fillarray string 0) - do not copy the string, as with `concat' or `substring' - if you do, be sure to keep track of and destroy all copies. - do not insert the password into a buffer - if you do, be sure to overwrite the buffer text before killing it, as with the functions `passwd-erase-buffer' or `passwd-kill-buffer'. Note that deleting the text from the buffer does NOT necessarily remove the text from memory. - be careful of the undo history - if you insert the password into a buffer which has undo recording turned on, the password will be copied onto the undo list, and thus recoverable. - do not pass it as an argument to a shell command - anyone will be able to see it if they run `ps' at the right time. Note that the password will be temporarily recoverable with the `view-lossage' command. This data will not be overwritten until another hundred or so characters are typed. There's not currently a way around this."]) (byte-code "MMMMMM!M" [read-passwd-1 #[(buffer prompt &optional prompt2 default) "q \n\ncč" [buffer passwd-erase-buffer default exit (byte-code "q \n \n\"Q!  ! q\" GSH! GSHُ-," [buffer nil minibuffer-completion-table t cursor-in-echo-area 0 echo-keystrokes read-key-sequence prompt prompt2 passwd-echo make-string buffer-size key key-binding binding string-match "Lucid" emacs-version last-command-event event-to-character last-command-char this-command c (byte-code "! !\"" [binding command-execute error "%s not defined" key-description key] 4) ((error (byte-code " ! \" N #Q!!" [beep fboundp display-error c t message error-message "???" ": " mapconcat #[(x) "\n\"" [format "%s" x] 3] ", " sit-for 2] 7)))] 6)] 2] passwd-erase-buffer #[nil "~ _ \nVc\nSs )" [buffer-size 3 s erase-buffer 0] 3 nil nil] passwd-kill-buffer #[(buffer) "q! !)!" [buffer buffer-disable-undo passwd-erase-buffer set-buffer-modified-p nil kill-buffer] 2] passwd-compare-string-to-buffer #[(string buffer) "qeb GdeZU??mg HUdbq Tui` e\\U+" [buffer string 0 i L nil] 4] passwd-grab-keyboard #[nil "! !=Ň Ƈ!! !Ƈ !!Ň" [fboundp x-grab-keyboard live-screen-p selected-screen x nil t message "Unable to grab keyboard - waiting a second..." sleep-for 1 "Keyboard grabbed on second try." beep "WARNING: keyboard is insecure (unable to grab!)" 3] 2] passwd-ungrab-keyboard #[nil "! != " [fboundp x-ungrab-keyboard live-screen-p selected-screen x] 2] fboundp buffer-disable-undo buffer-flush-undo] 2)