From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Michael Mauger Newsgroups: gmane.emacs.help Subject: Re: sql-mode password display Date: Thu, 3 Mar 2005 20:51:20 +0000 (UTC) Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1109884162 25266 80.91.229.2 (3 Mar 2005 21:09:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 3 Mar 2005 21:09:22 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 03 22:09:22 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D6xZE-0001GA-Nb for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Mar 2005 22:09:09 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D6xsG-0005yv-HK for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Mar 2005 16:28:48 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D6xlo-0004AK-Ra for help-gnu-emacs@gnu.org; Thu, 03 Mar 2005 16:22:10 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D6xld-000429-Hx for help-gnu-emacs@gnu.org; Thu, 03 Mar 2005 16:22:02 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D6xlZ-0003wB-6Y for help-gnu-emacs@gnu.org; Thu, 03 Mar 2005 16:21:53 -0500 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1D6xPn-00021R-LY for help-gnu-emacs@gnu.org; Thu, 03 Mar 2005 15:59:24 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1D6xIl-0006yz-3D for help-gnu-emacs@gnu.org; Thu, 03 Mar 2005 21:52:07 +0100 Original-Received: from 204.167.53.86 ([204.167.53.86]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 03 Mar 2005 21:52:07 +0100 Original-Received: from mmaug by 204.167.53.86 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 03 Mar 2005 21:52:07 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 101 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: main.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 204.167.53.86 (Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; bkbrel07)) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org X-MailScanner-To: geh-help-gnu-emacs@m.gmane.org Xref: main.gmane.org gmane.emacs.help:24497 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:24497 rb writes: > > When I use sql mode: > I'm the current maintainer of sql-mode. I'll assume that you are using the latest version of sql.el (available at http://savannah.gnu.org/cgi- bin/viewcvs/emacs/emacs/lisp/progmodes/sql.el). Prior versions were similar so most of this will apply. > M-x sql-msql, then follow prompts, > > I get the interactive sql buffer which works very well for me. The only > problem is that when I list the processes, the mysql process shows my > password, and I would like to know if there is something I can do to > conceal it? > > rb antonio 102% ps -ef | grep sql > rb 29562 29372 0 08:44:27 pts/4 0:00 grep sql > rb 29717 15897 0 08:43:34 pts/8 0:00 > /usr/freeware/bin/mysql --user=rb --password=my_password > --host=sanmarco test > > I was trying to find wheter there was a customizable variable to > conceal/display password and with M-x customize-apropos, I discovered > that the password was displayed in the customization buffer as well: > The problem here is that mysql accepts the password as a command line parameter and the `ps' shows all command line parameters. The alternative is to use the `--password' (or `-p') option without a value and allow `mysql' to prompt you for it. The current version omits the `--password' option entirely if `sql-password' is an empty string. Take a look at the function `sql-connect-mysql' (or `sql-mysql' in older versions). There is a chunk of code like this: (if (not (string= "" sql-password)) (setq params (append (list (concat "--password=" sql-password)) params))) Try changing it to: (if (not (string= "" sql-password)) (setq params (append (list (concat "--password=" sql-password)) params)) (setq params (append '("--password") params))) and remove your sql-password customization. You will now be required to enter your password each time you start sql-mysql. I don't use mysql at all so I'm not sure if this is globally appropriate. Is it possible to connect to mysql without a password at all? Do we need to distinguish between prompt me for a password and there is no password? > Sql Password: Hide my_password > State: this option has been changed outside the customize buffer. > Default password. More > Parent groups: Sql > Having the password visible in custom is not something that can be controlled (that I know of...). With the above change, obviously this becomes moot. > If I start an ineractive mysql session at the command line in an xwsh > shell, I get the following (password not displayed): > > rb antonio 101% ps -ef | grep sql > rb 29598 29535 0 08:31:14 pts/6 0:00 mysql -h > sanmarco -u rb -p test > > Also, working in shell-mode within emacs, to process a batch file, my > password is displayed in the *shell* buffer, and is retained in the > command history list. > > >From Emacs shell buffer: > > rb antonio 98% mysql -vv -h sanmarco -u rb -p < dbs.sql > dbs.out0222 > mysql -vv -h sanmarco -u rb -p < dbs.sql > dbs.out0222 > Enter password: my_password > > Within the shell, any other commands requiring a password (ssh, rlogin, > su, etc), the password is properly not displayed. > If you modify sql.el as described above, sql-interactive-mode should capture the password prompt and ask for your password in the minibuffer. > This is GNU Emacs 21.3.1. Thank you, sorry if there's an obvious or > known solution... > > rb I hope this helps. Let me know how it turns out. If you have any other suggestions concerning mysql support please send them along. -- Michael Mauger (Please CC: mmaug yahoo com because I don't follow this list carefully...)