diff options
| -rw-r--r-- | lispref/ChangeLog | 4 | ||||
| -rw-r--r-- | lispref/minibuf.texi | 61 |
2 files changed, 65 insertions, 0 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 322a2e90eff..21b748229a5 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2004-10-25 Simon Josefsson <jas@extundo.com> | ||
| 2 | |||
| 3 | * minibuf.texi (Reading a Password): Add. | ||
| 4 | |||
| 1 | 2004-10-24 Jason Rumney <jasonr@gnu.org> | 5 | 2004-10-24 Jason Rumney <jasonr@gnu.org> |
| 2 | 6 | ||
| 3 | * commands.texi (Misc Events): Remove mouse-wheel. Add wheel-up | 7 | * commands.texi (Misc Events): Remove mouse-wheel. Add wheel-up |
diff --git a/lispref/minibuf.texi b/lispref/minibuf.texi index 1b076c5837d..08e156b327e 100644 --- a/lispref/minibuf.texi +++ b/lispref/minibuf.texi | |||
| @@ -1660,6 +1660,32 @@ The return value of @code{map-y-or-n-p} is the number of objects acted on. | |||
| 1660 | To read a password to pass to another program, you can use the | 1660 | To read a password to pass to another program, you can use the |
| 1661 | function @code{read-passwd}. | 1661 | function @code{read-passwd}. |
| 1662 | 1662 | ||
| 1663 | @cindex password cache | ||
| 1664 | Passwords are sometimes needed several times throughout an Emacs | ||
| 1665 | session. Then it can be useful to avoid having to ask for a password | ||
| 1666 | more than once. Passwords are entered into the password cache using | ||
| 1667 | the function @code{password-cache-add}. To read a password, possibly | ||
| 1668 | retrieving the password from the cache without querying the user, you | ||
| 1669 | can use the function @code{password-read}. The two calls can be | ||
| 1670 | combined into the function @code{password-read-and-add} that read a | ||
| 1671 | password and store it in the cache. | ||
| 1672 | |||
| 1673 | Typically users do not use the same password for all services. The | ||
| 1674 | password cache mechanism use a @samp{key} string to differentiate | ||
| 1675 | among the passwords. The @samp{key} string is typically a fixed | ||
| 1676 | string chosen to be related to what the password is used for. For | ||
| 1677 | example, a password used when connecting to a @acronym{IMAP} mail | ||
| 1678 | server called @samp{mail.example.org}, could use a @samp{key} string | ||
| 1679 | of @samp{imap:mail.example.org}. You can use any string, as long as | ||
| 1680 | it is reasonably unique. | ||
| 1681 | |||
| 1682 | @cindex password expiry | ||
| 1683 | Passwords in the cache typically expire after a while (controlled by | ||
| 1684 | the variable @code{password-cache-expiry}), but you can force removal | ||
| 1685 | of a password using the function @code{password-cache-remove}. This | ||
| 1686 | is useful when there is a problem with the password, to avoid using | ||
| 1687 | the same incorrect password from the cache in the future. | ||
| 1688 | |||
| 1663 | @defun read-passwd prompt &optional confirm default | 1689 | @defun read-passwd prompt &optional confirm default |
| 1664 | This function reads a password, prompting with @var{prompt}. It does | 1690 | This function reads a password, prompting with @var{prompt}. It does |
| 1665 | not echo the password as the user types it; instead, it echoes @samp{.} | 1691 | not echo the password as the user types it; instead, it echoes @samp{.} |
| @@ -1675,6 +1701,41 @@ return if the user enters empty input. If @var{default} is @code{nil}, | |||
| 1675 | then @code{read-passwd} returns the null string in that case. | 1701 | then @code{read-passwd} returns the null string in that case. |
| 1676 | @end defun | 1702 | @end defun |
| 1677 | 1703 | ||
| 1704 | @defun password-read prompt key | ||
| 1705 | Read a password from the user, using @code{read-passwd}, prompting | ||
| 1706 | with @var{prompt}. If a password has been stored in the password | ||
| 1707 | cache, using @code{password-cache-add} on the same @var{key}, it is | ||
| 1708 | returned directly, without querying the user. | ||
| 1709 | @end defun | ||
| 1710 | |||
| 1711 | @defun password-cache-add key password | ||
| 1712 | Add a password to the password cache, indexed under the given | ||
| 1713 | @var{key}. The password is later retrieved using @code{password-read} | ||
| 1714 | called with the same @var{key}. | ||
| 1715 | @end defun | ||
| 1716 | |||
| 1717 | @defun password-cache-remove key | ||
| 1718 | Remove a password from the cache, indexed under the given @var{key}. | ||
| 1719 | @end defun | ||
| 1720 | |||
| 1721 | @defun password-read-and-add prompt &optional key | ||
| 1722 | Read a password, prompting with @var{prompt}, and possibly add it to | ||
| 1723 | the cache, indexed using the @var{key} string. This is one-call | ||
| 1724 | interface to @code{password-read} and @code{password-cache-add}. | ||
| 1725 | @end defun | ||
| 1726 | |||
| 1727 | @defvar password-cache-expiry | ||
| 1728 | This variable specify for how many seconds passwords are retained in | ||
| 1729 | the password cache before they are expired. For high security, use a | ||
| 1730 | low value (below a minute). For more lax security, use a setting of | ||
| 1731 | @samp{14400} corresponding to half a work day (4 hours). | ||
| 1732 | @end defvar | ||
| 1733 | |||
| 1734 | @defvar password-cache | ||
| 1735 | This variable toggle whether or not the password cache is used at all. | ||
| 1736 | The default is non-@code{nil}, i.e., to use the cache. | ||
| 1737 | @end defvar | ||
| 1738 | |||
| 1678 | @node Minibuffer Misc | 1739 | @node Minibuffer Misc |
| 1679 | @section Minibuffer Miscellany | 1740 | @section Minibuffer Miscellany |
| 1680 | 1741 | ||