summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2018-06-25 19:11:41 -0400
committerNoam Postavsky <npostavs@gmail.com>2018-08-23 22:50:15 -0400
commit161139a42c02cce051c51fb80c6ae00c9e6beaa6 (patch)
tree26a0d05e290d25ccfcd4e6fb74b2d313fb23d5e6
parent74277b0e88197c169acfc16025e0e116230c021e (diff)
downloademacs-161139a42c02cce051c51fb80c6ae00c9e6beaa6.tar.gz
Detect Chinese sudo password prompts (Bug#31075)
* lisp/comint.el (comint-password-prompt-regexp): Allow text between the prompt prefix and password equivalent. * lisp/eshell/esh-mode.el (eshell-password-prompt-regexp): Accept some unicode alternatives to ":". * test/lisp/comint-tests.el (comint-testsuite-password-strings): Add test case.
-rw-r--r--lisp/comint.el3
-rw-r--r--lisp/eshell/esh-mode.el3
-rw-r--r--test/lisp/comint-tests.el1
3 files changed, 5 insertions, 2 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index 51c7e81e09a..5928804fe73 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -360,7 +360,8 @@ This variable is buffer-local."
"Kerberos" "CVS" "UNIX" " SMB" "LDAP" "PEM" "SUDO"
"[sudo]" "Repeat" "Bad" "Retype")
t)
- " +\\)"
+ ;; Allow for user name to precede password equivalent (Bug#31075).
+ " +.*\\)"
"\\(?:" (regexp-opt password-word-equivalents) "\\|Response\\)"
"\\(?:\\(?:, try\\)? *again\\| (empty for no passphrase)\\| (again)\\)?"
;; "[[:alpha:]]" used to be "for", which fails to match non-English.
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index 9f854c7d907..0c25f412c2a 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -182,10 +182,11 @@ inserted. They return the string as it should be inserted."
:group 'eshell-mode)
(defcustom eshell-password-prompt-regexp
- (format "\\(%s\\).*:\\s *\\'" (regexp-opt password-word-equivalents))
+ (format "\\(%s\\)[^::៖]*[::៖]\\s *\\'" (regexp-opt password-word-equivalents))
"Regexp matching prompts for passwords in the inferior process.
This is used by `eshell-watch-for-password-prompt'."
:type 'regexp
+ :version "27.1"
:group 'eshell-mode)
(defcustom eshell-skip-prompt-function nil
diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el
index 366fcc9ad89..eab2709cea9 100644
--- a/test/lisp/comint-tests.el
+++ b/test/lisp/comint-tests.el
@@ -36,6 +36,7 @@
"Enter same passphrase again: " ; ssh-keygen
"Passphrase for key root@GNU.ORG: " ; plink
"[sudo] password for user:" ; Ubuntu sudo
+ "[sudo] user 的密码:" ; localized
"Password (again):"
"Enter password:"
"Mot de Passe :" ; localized (Bug#29729)