update-xxv: [PATCH] Ask for password only once

Message ID 4BB4AA28.8020500@waechter.wiz.at
State New
Headers

Commit Message

Matthias Wächter April 1, 2010, 2:14 p.m. UTC
  On 01.04.2010 16:09, Matthias Wächter wrote:
> I found the three available options for specifying a password in the course of running update-xxv a
> little bit cumbersome, so I want to share the following patch with you.
>
> In addition to the default (no password), -a for being asked for it with _each_ database access
> (wtf) and specifying it on the command line in clear text using -p, I add a new option -A that asks
> for a password only once and supplies it to mysql as if it was given with -p.
>
> This by itself will not raise overall system security as the password is still given to each mysql
> call on the command line (and thus can be seen in the process table), however, it’s better to not
> have it in .bash_history.

Sorry, incomplete patch. Here is the right one (doesn’t give -a twice on the help screen).

– Matthias
  

Comments

Andreas Brachold April 1, 2010, 3:16 p.m. UTC | #1
Hello,

Am Donnerstag, den 01.04.2010, 16:14 +0200 schrieb Matthias Wächter:
> I found the three available options for specifying a password in the 
> course of running update-xxv a little bit cumbersome, so I want to 
> share the following patch with you.

Thanks, for your patch. I apply this to our repository (revision 1471)

Andreas
  

Patch

--- update-xxv.orig	2010-01-17 21:37:56.000000000 +0100
+++ update-xxv	2010-04-01 16:11:54.000000000 +0200
@@ -10,7 +10,8 @@ 
 #          -d <database>  : XXV database name (default: xxv)
 #          -u <user>      : Username (default: root)
 #          -p <password>  : Password (default: no password)
-#          -a             : Ask for password
+#          -a             : Ask for password (once every run of mysql)
+#          -A             : Ask for password (just once)
 #          -f             : Force upgrade, do not check version
 #          -v             : Display actual Version
 #          -h             : Help
@@ -44,7 +45,8 @@ 
     echo '-u <user>      : Username (default: root)'
     echo '-p <password>  : Password (default: no password)'
     echo '-s <sql-file>  : Upgrade sql script (default: upgrade-xxv-db.sql)'
-    echo '-a             : Ask for password'
+    echo '-a             : Ask for password (once every run of mysql)'
+    echo '-A             : Ask for password (just once)'
     echo '-f             : Force upgrade, do not check version'
     echo '-v             : Display actual version'
     echo '-h             : Help'
@@ -251,6 +253,9 @@ 
     	-a)
             askPassword='true'
     	;;
+	-A)
+	    read -s -p 'Enter Password (hidden): ' password
+	;;
         -f)
             isForceUpdate='true'
         ;;