From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jari Aalto Newsgroups: gmane.emacs.bugs Subject: bug#2817: [PATCH] Emacs CVS: comint-password-prompt-regexp - support ssh-keygen Date: Sun, 29 Mar 2009 19:20:31 +0300 Message-ID: <874oxcnvw0.fsf@jondo.cante.net> Reply-To: Jari Aalto , 2817@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1238345056 29093 80.91.229.12 (29 Mar 2009 16:44:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 29 Mar 2009 16:44:16 +0000 (UTC) To: Emacs bug BTS Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 29 18:45:34 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Lny8Q-0002Gm-Gz for geb-bug-gnu-emacs@m.gmane.org; Sun, 29 Mar 2009 18:45:22 +0200 Original-Received: from localhost ([127.0.0.1]:56999 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lny73-0007nV-5X for geb-bug-gnu-emacs@m.gmane.org; Sun, 29 Mar 2009 12:43:57 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lny6z-0007n4-BM for bug-gnu-emacs@gnu.org; Sun, 29 Mar 2009 12:43:53 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lny6u-0007mk-PX for bug-gnu-emacs@gnu.org; Sun, 29 Mar 2009 12:43:53 -0400 Original-Received: from [199.232.76.173] (port=44208 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lny6u-0007mh-KC for bug-gnu-emacs@gnu.org; Sun, 29 Mar 2009 12:43:48 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:53598) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lny6u-0001Mc-2o for bug-gnu-emacs@gnu.org; Sun, 29 Mar 2009 12:43:48 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n2TGhkIV001211; Sun, 29 Mar 2009 09:43:46 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n2TGU48M030229; Sun, 29 Mar 2009 09:30:04 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Jari Aalto Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Sun, 29 Mar 2009 16:30:03 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 2817 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.123834363928898 (code B ref -1); Sun, 29 Mar 2009 16:30:03 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 29 Mar 2009 16:20:39 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from emh03.mail.saunalahti.fi (emh03.mail.saunalahti.fi [62.142.5.109]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n2TGKZBX028892 for ; Sun, 29 Mar 2009 09:20:36 -0700 Original-Received: from saunalahti-vams (vs3-10.mail.saunalahti.fi [62.142.5.94]) by emh03-2.mail.saunalahti.fi (Postfix) with SMTP id 0A1B6EBDCC for ; Sun, 29 Mar 2009 19:20:34 +0300 (EEST) Original-Received: from emh03.mail.saunalahti.fi ([62.142.5.109]) by vs3-10.mail.saunalahti.fi ([62.142.5.94]) with SMTP (gateway) id A0709A0A636; Sun, 29 Mar 2009 19:20:34 +0300 Original-Received: from picasso.cante.net (a91-155-187-216.elisa-laajakaista.fi [91.155.187.216]) by emh03.mail.saunalahti.fi (Postfix) with ESMTP id E6A9F158A65 for ; Sun, 29 Mar 2009 19:20:32 +0300 (EEST) Original-Received: from [192.168.1.7] (helo=jondo.cante.net) by picasso.cante.net with esmtp (Exim 4.69) (envelope-from ) id 1LnxkL-0001Yz-63 for submit@emacsbugs.donarmstrong.com; Sun, 29 Mar 2009 19:20:29 +0300 Original-Received: from jaalto by jondo.cante.net with local (Exim 4.69) (envelope-from ) id 1LnxkN-00058i-NZ for submit@emacsbugs.donarmstrong.com; Sun, 29 Mar 2009 19:20:31 +0300 X-SA-Exim-Connect-IP: 192.168.1.7 X-SA-Exim-Mail-From: jari.aalto@cante.net X-SA-Exim-Scanned: No (on picasso.cante.net); SAEximRunCond expanded to false X-Antivirus: VAMS X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Sun, 29 Mar 2009 12:43:52 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:26733 Archived-At: --=-=-= Added support for ssh-keygen(1) prompt and changed to new format because the old one was hard to decipher and keep track on. The enw one is easier to maintaintain. The tester 'dolist' can be used to verify new prompts as the variable is changed. Jari 2009-03-29 Jari Aalto * comint.el (comint-password-prompt-regexp): Rewrite using regexp-opt. Add ssh-keygen check. Add dolist block to test new regexp. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-lisp-comint.el-comint.el-comint-password-prompt-re.patch >From 804b37d9bdcffc4980af4f075ee804ea6a8471d2 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Sun, 29 Mar 2009 19:13:06 +0300 Subject: [PATCH] lisp/comint.el: comint.el (comint-password-prompt-regexp): Rewrite using regexp-opt --- lisp/comint.el | 71 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 58 insertions(+), 13 deletions(-) diff --git a/lisp/comint.el b/lisp/comint.el index 5bff986..155dfde 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -328,25 +328,70 @@ This variable is buffer-local." :type 'boolean :group 'comint) -;; AIX puts the name of the person being su'd to in front of the prompt. -;; kinit prints a prompt like `Password for devnull@GNU.ORG: '. -;; ksu prints a prompt like `Kerberos password for devnull/root@GNU.ORG: '. -;; ssh-add prints a prompt like `Enter passphrase: '. -;; plink prints a prompt like `Passphrase for key "root@GNU.ORG": '. -;; Ubuntu's sudo prompts like `[sudo] password for user:' -;; Some implementations of passwd use "Password (again)" as the 2nd prompt. -;; Something called "perforce" uses "Enter password:". (defcustom comint-password-prompt-regexp - "\\(\\(Enter \\|[Oo]ld \\|[Nn]ew \\|'s \\|login \\|\ -Kerberos \\|CVS \\|UNIX \\| SMB \\|LDAP \\|\\[sudo] \\|^\\)\ -\[Pp]assword\\( (again)\\)?\\|\ -pass phrase\\|\\(Enter \\|Repeat \\|Bad \\)?[Pp]assphrase\\)\ -\\(?:, try again\\)?\\(?: for [^:]+\\)?:\\s *\\'" + (concat + "^\\(" + (regexp-opt + '(;; AIX puts the name of the person being su'd to in front of the prompt. + "'s" + "Bad" + "CVS" + "Enter same" + "Enter" + "Kerberos" + "LDAP" + "Login" + "New" + "Old" + "Repeat" + "SMB" + "UNIX" + "[sudo]" + "bad" + "login" + "new" + "old" + "repeat")) + " +\\)?" + (regexp-opt + '("password" + "Password" + "passphrase" + "pass phrase" + "Passphrase" + "Pass phrase")) + "\\(" + "\\(?:, try \\)?\\( *again\\)?\\(?: for [^:]+\\)?:\\|" + " (empty for no passphrase):\\|" + " (again)\\|" + " for key" + "\\)" + ) "Regexp matching prompts for passwords in the inferior process. This is used by `comint-watch-for-password-prompt'." :type 'regexp :group 'comint) +(when nil + + ;; Tester. Run C-x C-e at the end to test new prompts or after + ;; changes to comint-password-prompt-regexp + + (dolist (str '("Password for devnull@GNU.ORG: " ; knit + "Kerberos password for devnull/root@GNU.ORG: " ; ksu + "Enter passphrase: " ; ssh-add + "Enter passphrase (empty for no passphrase): " ; ssh-keygen + "Enter same passphrase again: " ; ssh-keygen + "Passphrase for key root@GNU.ORG: " ; plink + "[sudo] password for user:" ; Ubuntu sudo + ;; some implementation of passwd(1) as the 2nd prompt + "Password (again)" + "Enter password:")) ; perforce + (unless (string-match comint-password-prompt-regexp str) + (error "Did not match: %s" str))) + + ) + ;; Here are the per-interpreter hooks. (defvar comint-get-old-input (function comint-get-old-input-default) "Function that returns old text in Comint mode. -- 1.6.1.3 --=-=-=--