aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorDario Gjorgjevski2019-11-21 13:51:55 +0100
committerLars Ingebrigtsen2019-11-21 13:51:55 +0100
commitf13a4afde747756c4c02fadf49ea6c617cfd42c6 (patch)
tree63b2644c39742091864ce7647f9d0e02276bebf7 /lisp
parent70b88adbe7ef9148d6308fcbb53789acd56a5dfc (diff)
downloademacs-f13a4afde747756c4c02fadf49ea6c617cfd42c6.tar.gz
emacs-f13a4afde747756c4c02fadf49ea6c617cfd42c6.zip
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')
-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."
1000 (forward-line 1) 1000 (forward-line 1)
1001 (skip-chars-forward "\t "))) 1001 (skip-chars-forward "\t ")))
1002 1002
1003(defun auth-source-netrc-looking-at-token ()
1004 "Say whether the next think in the buffer is a token (password, etc).
1005Match data is altered to reflect the token."
1006 (or (looking-at "'\\([^']*\\)'")
1007 (looking-at "\"\\([^\"]*\\)\"")
1008 (looking-at "\\([^ \t\n]+\\)")))
1009
1003(defun auth-source-netrc-parse-one () 1010(defun auth-source-netrc-parse-one ()
1004 "Read one thing from the current buffer." 1011 "Read one thing from the current buffer."
1005 (auth-source-netrc-parse-next-interesting) 1012 (auth-source-netrc-parse-next-interesting)
1006 1013
1007 (when (or (looking-at "'\\([^']*\\)'") 1014 (when (auth-source-netrc-looking-at-token)
1008 (looking-at "\"\\([^\"]*\\)\"")
1009 (looking-at "\\([^ \t\n]+\\)"))
1010 (forward-char (length (match-string 0))) 1015 (forward-char (length (match-string 0)))
1011 (prog1 1016 (prog1
1012 (match-string-no-properties 1) 1017 (match-string-no-properties 1)
@@ -2427,7 +2432,7 @@ passwords are revealed when point moved into the password.
2427 (while (re-search-forward (format "\\(\\s-\\|^\\)\\(%s\\)\\s-+" 2432 (while (re-search-forward (format "\\(\\s-\\|^\\)\\(%s\\)\\s-+"
2428 authinfo-hidden) 2433 authinfo-hidden)
2429 nil t) 2434 nil t)
2430 (when (looking-at "[^\n\t ]+") 2435 (when (auth-source-netrc-looking-at-token)
2431 (let ((overlay (make-overlay (match-beginning 0) (match-end 0)))) 2436 (let ((overlay (make-overlay (match-beginning 0) (match-end 0))))
2432 (overlay-put overlay 'display (propertize "****" 2437 (overlay-put overlay 'display (propertize "****"
2433 'face 'warning)) 2438 'face 'warning))