summaryrefslogtreecommitdiff
path: root/lisp/auth-source.el
diff options
context:
space:
mode:
authorDario Gjorgjevski <dario.gjorgjevski+git@gmail.com>2019-11-21 13:51:55 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2019-11-21 13:51:55 +0100
commitf13a4afde747756c4c02fadf49ea6c617cfd42c6 (patch)
tree63b2644c39742091864ce7647f9d0e02276bebf7 /lisp/auth-source.el
parent70b88adbe7ef9148d6308fcbb53789acd56a5dfc (diff)
downloademacs-f13a4afde747756c4c02fadf49ea6c617cfd42c6.tar.gz
Hide quoted passwords with spaces in Authinfo
* lisp/auth-source.el (auth-source-netrc-looking-at-one): New function, extracted from auth-source-netrc-parse-one. (auth-source-netrc-parse-one, authinfo--hide-passwords): Use auth-source-netrc-looking-at-one (bug#38311).
Diffstat (limited to 'lisp/auth-source.el')
-rw-r--r--lisp/auth-source.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index 4926f67f0a1..89a468570ac 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -1000,13 +1000,18 @@ Note that the MAX parameter is used so we can exit the parse early."
(forward-line 1)
(skip-chars-forward "\t ")))
+(defun auth-source-netrc-looking-at-token ()
+ "Say whether the next think in the buffer is a token (password, etc).
+Match data is altered to reflect the token."
+ (or (looking-at "'\\([^']*\\)'")
+ (looking-at "\"\\([^\"]*\\)\"")
+ (looking-at "\\([^ \t\n]+\\)")))
+
(defun auth-source-netrc-parse-one ()
"Read one thing from the current buffer."
(auth-source-netrc-parse-next-interesting)
- (when (or (looking-at "'\\([^']*\\)'")
- (looking-at "\"\\([^\"]*\\)\"")
- (looking-at "\\([^ \t\n]+\\)"))
+ (when (auth-source-netrc-looking-at-token)
(forward-char (length (match-string 0)))
(prog1
(match-string-no-properties 1)
@@ -2427,7 +2432,7 @@ passwords are revealed when point moved into the password.
(while (re-search-forward (format "\\(\\s-\\|^\\)\\(%s\\)\\s-+"
authinfo-hidden)
nil t)
- (when (looking-at "[^\n\t ]+")
+ (when (auth-source-netrc-looking-at-token)
(let ((overlay (make-overlay (match-beginning 0) (match-end 0))))
(overlay-put overlay 'display (propertize "****"
'face 'warning))