[Dbconfig-common-devel] dbconfig-common/dpkg common,1.17,1.18 config,1.15,1.16

seanius@haydn.debian.org seanius@haydn.debian.org


Update of /cvsroot/dbconfig-common/dbconfig-common/dpkg
In directory haydn:/org/alioth.debian.org/chroot/home/users/seanius/tmp/cvs-serv31184/dpkg

Modified Files:
	common config 
Log Message:
blank passwords now == randomly generated ones.  thanks to tobias grimm
for the idea on that.  also a few lintian fixes


Index: common
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/common,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- common	25 Apr 2005 02:43:26 -0000	1.17
+++ common	26 Apr 2005 04:30:54 -0000	1.18
@@ -30,7 +30,7 @@
 	### some internal variables
 	###
 	# templates common to all database types
-	dbc_standard_templates="database-type dbconfig-install dbconfig-upgrade dbconfig-remove password-confirm purge upgrade-backup passwords-do-not-match install-error upgrade-error remove-error"
+	dbc_standard_templates="database-type dbconfig-install dbconfig-upgrade dbconfig-remove password-confirm app-password-confirm purge upgrade-backup passwords-do-not-match install-error upgrade-error remove-error"
 
 	# templates common to mysql database types
 	dbc_mysql_templates="mysql/method remote/host remote/newhost mysql/app-pass mysql/admin-user mysql/admin-pass remote/port db/dbname db/app-user"
@@ -117,10 +117,6 @@
 #	set to "true" to keep admin passwords cached in debconf
 dbc_remember_admin_pass="$dbc_remember_admin_pass"
 
-# dbc_remember_app_pass: should we cache application passwords?
-#	set to "true" to keep application passwords cached in debconf
-dbc_remember_app_pass="$dbc_remember_app_pass"
-
 EOF
 }
 
@@ -363,8 +359,8 @@
 	echo dbconfig-common: flushing database application password >&2
 	db_reset $dbc_package/$dbc_dbtype/app-pass || true
 	db_fset $dbc_package/$dbc_dbtype/app-pass seen false || true
-	db_reset $dbc_package/password-confirm || true
-	db_fset $dbc_package/password-confirm seen false || true
+	db_reset $dbc_package/app-password-confirm || true
+	db_fset $dbc_package/app-password-confirm seen false || true
 }
 
 ##
@@ -423,37 +419,37 @@
 ##	usage: dbc_get_app_pass package dbtype
 ##
 dbc_get_app_pass(){
-	local have_app_pass pass1 pass2 dbc_package dbc_dbtype
-	[ $# = 2 ] || return 1
-	if [ "$1" ]; then dbc_package=$1; fi
-	if [ "$2" ]; then dbc_dbtype=$2; fi
+	local have_app_pass pass1 pass2
 
 	db_fget $dbc_package/$dbc_dbtype/app-pass seen 
 	if [ "$RET" = "true" ]; then
 		have_app_pass="yes"
+		db_get $dbc_package/$dbc_dbtype/app-pass
+		dbc_dbpass="$RET"
 	fi
 
 	# make sure the passwords are the same, safely
 	while [ ! "$have_app_pass" ]; do
 		# forget the password-confirm question first, as it's shared
-		db_reset $dbc_package/password-confirm
-		db_fset $dbc_package/password-confirm seen false
+		db_reset $dbc_package/app-password-confirm
+		db_fset $dbc_package/app-password-confirm seen false
 
 		# get the appistrative password
 		db_input high $dbc_package/$dbc_dbtype/app-pass || true
 
 		# get the password again
-		db_input high $dbc_package/password-confirm || true
+		db_input high $dbc_package/app-password-confirm || true
 
 		# get the info
 		db_go || true
 		db_get $dbc_package/$dbc_dbtype/app-pass
 		pass1="$RET"
-		db_get $dbc_package/password-confirm
+		db_get $dbc_package/app-password-confirm
 		pass2="$RET"
 
 		# test to see if the passwords match
 		if [ "$pass1" = "$pass2" ]; then
+			dbc_dbpass="$pass1"
 			have_app_pass="yes"
 		else
 			# tell them the passwords didn't match, loop again
@@ -464,8 +460,11 @@
 		fi
 	done
 
-	db_get $dbc_package/$dbc_dbtype/app-pass
-	echo $RET;
+	if [ ! "$dbc_dbpass" ]; then
+		dbc_dbpass=`pwgen -cn -N1 -s 12`
+		db_set $dbc_package/$dbc_dbtype/app-pass "$dbc_dbpass"
+		db_set $dbc_package/app-password-confirm "$dbc_dbpass"
+	fi
 }
 
 ##

Index: config
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/config,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- config	25 Apr 2005 02:43:26 -0000	1.15
+++ config	26 Apr 2005 04:30:54 -0000	1.16
@@ -116,6 +116,8 @@
 		if [ "$dbc_dbpass" ]; then 
 			db_set $dbc_package/$dbc_dbtype/app-pass "$dbc_dbpass"
 			db_fset $dbc_package/$dbc_dbtype/app-pass seen true
+			db_set $dbc_package/app-password-confirm "$dbc_dbpass"
+			db_fset $dbc_package/app-password-confirm seen true
 		fi      
 		if [ "$dbc_dbname" ]; then 
 			db_set $dbc_package/db/dbname "$dbc_dbname"
@@ -247,7 +249,7 @@
 		db_input low $dbc_package/db/app-user || true
 
 		if [ "$need_userpw" != "false" ]; then
-			dbc_dbpass=`dbc_get_app_pass $dbc_package $dbc_dbtype`
+			dbc_get_app_pass
 		fi
 
 		# get the name of the database to use