bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13124: 24.1; shell-mode does not hide sudo password prompts


From: Chong Yidong
Subject: bug#13124: 24.1; shell-mode does not hide sudo password prompts
Date: Sat, 29 Dec 2012 15:38:09 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.91 (gnu/linux)

Michael Albinus <michael.albinus@gmx.de> writes:

>> How is that different from having an ad-hoc list of "password" words,
>> other than being more difficult to implement?
>
> Other packages could profit from a predefined list of "password" words
> as well. Tramp comes to my mind ...

Anyone have objections to the following patch?  It introduces a new
option `password-word-equivalents' for this purpose.

=== modified file 'lisp/comint.el'
*** lisp/comint.el      2012-12-27 07:33:47 +0000
--- lisp/comint.el      2012-12-29 07:34:16 +0000
***************
*** 346,356 ****
        "Old" "old" "New" "new" "'s" "login"
        "Kerberos" "CVS" "UNIX" " SMB" "LDAP" "[sudo]" "Repeat" "Bad") t)
     " +\\)"
!    (regexp-opt
!     '("password" "Password" "passphrase" "Passphrase"
!       "pass phrase" "Pass phrase" "Response"))
     "\\(?:\\(?:, try\\)? *again\\| (empty for no passphrase)\\| (again)\\)?\
! \\(?: for [^:]+\\)?:\\s *\\'")
    "Regexp matching prompts for passwords in the inferior process.
  This is used by `comint-watch-for-password-prompt'."
    :version "24.1"
--- 346,354 ----
        "Old" "old" "New" "new" "'s" "login"
        "Kerberos" "CVS" "UNIX" " SMB" "LDAP" "[sudo]" "Repeat" "Bad") t)
     " +\\)"
!    "\\(?:" (regexp-opt password-word-equivalents) "\\|Response\\)"
     "\\(?:\\(?:, try\\)? *again\\| (empty for no passphrase)\\| (again)\\)?\
! \\(?: for [^:]+\\)?[::៖]\\s *\\'")
    "Regexp matching prompts for passwords in the inferior process.
  This is used by `comint-watch-for-password-prompt'."
    :version "24.1"
***************
*** 2315,2321 ****
  `comint-password-prompt-regexp'.
  
  This function could be in the list `comint-output-filter-functions'."
!   (when (string-match comint-password-prompt-regexp string)
      (when (string-match "^[ \n\r\t\v\f\b\a]+" string)
        (setq string (replace-match "" t t string)))
      (send-invisible string)))
--- 2313,2320 ----
  `comint-password-prompt-regexp'.
  
  This function could be in the list `comint-output-filter-functions'."
!   (when (let ((case-fold-search t))
!         (string-match comint-password-prompt-regexp string))
      (when (string-match "^[ \n\r\t\v\f\b\a]+" string)
        (setq string (replace-match "" t t string)))
      (send-invisible string)))

=== modified file 'lisp/simple.el'
*** lisp/simple.el      2012-12-21 08:10:26 +0000
--- lisp/simple.el      2012-12-29 07:34:03 +0000
***************
*** 2214,2219 ****
--- 2214,2277 ----
      (setq buffer-undo-list nil)
      t))

+ (defcustom password-word-equivalents
+   '("password" "passphrase" "pass phrase"
+     "كلمة السر"    ; ar
+     "গুপ্তশব্দ"        ; as
+     "পাসওয়ার্ড"       ; bn_IN
+     "contrasenya"  ; ca
+     "heslo"        ; cs
+     "adgangskode"  ; da
+     "passwort"     ; de
+     "pasvorto"     ; eo
+     "contraseña"   ; es
+     "pasahitza"    ; eu
+     "salasana"     ; fi
+     "mot de passe" ; fr
+     "પાસવર્ડ"       ; gu
+     "ססמה"         ; he
+     "शब्दकूट"        ; hi
+     "lozinka"      ; hr
+     "Jelszó: "     ; hu
+     "パスワード"     ; ja
+     "Пароль"       ; kk
+     "ಗುಪ್ತಪದ"      ; kn
+     "암호"         ; ko
+     "ពាក្យសម្ងាត់" ; km
+     "slaptažodis"  ; lt
+     "അടയാളവാക്ക്"   ; ml
+     "गुप्तशब्द"       ; mr
+     "passord"      ; nb
+     "wachtwoord"   ; nl
+     "ପ୍ରବେଶ ସଙ୍କେତ" ; or
+     "ਪਾਸਵਰਡ"       ; pa
+     "hasło"        ; pl
+     "senha"        ; pt
+     "Пароль"       ; ru
+     "රහස්පදය"      ; si
+     "Heslo"        ; sk
+     "geslo"        ; sl
+     "lozinka"      ; sr
+     "Лозинка"      ; sr
+     "lösenord"     ; sv
+     "கடவுச்சொல்"    ; ta
+     "సంకేతపదము"     ; te
+     "parola"       ; tr
+     "Пароль"       ; uk
+     "Mật khẩu"     ; vi
+     "密码"          ; zh_CN
+     "密碼"          ; zh_TW
+     "iphasiwedi"   ; zu
+     )
+   "List of words equivalent to \"password\".
+ This is used by Shell mode and other parts of Emacs to recognize
+ password prompts, including prompts in languages other than
+ English.  Different case choices should not be assumed to be
+ included; callers should bind `case-fold-search' to t."
+   :type '(repeat string)
+   :version "24.4"
+   :group 'processes)
+ 
  (defvar shell-command-history nil
    "History list for some commands that read shell commands.
  






reply via email to

[Prev in Thread] Current Thread [Next in Thread]