File: bug-231186-make-mysql-exec.sh-work-for-nonadmins-too.patch

package info (click to toggle)
wwwconfig-common 0.3.0
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 488 kB
  • sloc: sh: 952; makefile: 5
file content (111 lines) | stat: -rw-r--r-- 5,186 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
Package: wwwconfig-common
Version: 0.0.34-0.1~jeroen3
Severity: wishlist
Tags: patch

Please have mysql-*-exec.sh scripts be usuable for a series of sql
statements by a nonadmin too. This is extremely useful for my package,
as the user password for the database is stored and rembered, but the
root password for MySQL isn't. So, on upgrade etc. there is then no need
to ask for the MySQL root password (again).

I hope you can apply this soon, as my package depends on it, otherwise I
need to work around it by supplying my own script. This will not break
anything.

This is a patch to do so (it makes the pre-exec check more easily satisfyable):

diff -ur wwwconfig-common-0.0.33.orig/mysql-exec.sh wwwconfig-common-0.0.33/mysql-exec.sh
--- wwwconfig-common-0.0.33.orig/mysql-exec.sh	2003-10-27 11:04:51.000000000 +0100
+++ wwwconfig-common-0.0.33/mysql-exec.sh	2004-02-05 01:43:08.000000000 +0100
@@ -14,10 +14,13 @@
 #		Corrected the documentation about what this file does.
 #	20031027 Benoit Joly <benoit@debian.org>
 #		Patch small bug.
+#   20040205 Jeroen van Wolffelaar <jeroen@wolffelaar.nl>
+#		Check merely for valid account, rather than for access to the
+#		mysql-database, so also regular mysqlusers can be used
 # Needs:	$dbname    - the database that user should have access to (optional)
 #		$dbserver  - the server to connect to.
-#		$dbadmin   - the administrator name.
-#		$dbadmpass - the administrator password.
+#		$dbadmin   - the databaseuser name.
+#		$dbadmpass - the databaseuser password.
 #		which
 #		mysql
 #		$sqlfile   - the file containing the SQL statements to run.
@@ -37,7 +40,7 @@
 elif [ ! -x $(which mysql) ] ; then
     error="No mysql client to execute, install the mysql client package and
     run 'dpkg-reconfigure -plow packagename'."
-elif ! eval $mysqlcmd -f mysql -e "\"show tables;\"" >/dev/null 2>&1 ; then
+elif ! eval $mysqlcmd </dev/null >/dev/null 2>&1 ; then
     error="Error when trying to connect to the mysql database.
     This error can occur if you have no database to connect to, or
     if the password was incorrect.
diff -ur wwwconfig-common-0.0.33.orig/mysql-if-exec.sh wwwconfig-common-0.0.33/mysql-if-exec.sh
--- wwwconfig-common-0.0.33.orig/mysql-if-exec.sh	2003-12-19 11:51:55.000000000 +0100
+++ wwwconfig-common-0.0.33/mysql-if-exec.sh	2004-02-05 01:42:48.000000000 +0100
@@ -12,11 +12,14 @@
 #		Added new status code.
 #	20031219 Thomas Viehmann <tv@beamnet.de>
 #		Patch to use eval in order to not break.
+#   20040205 Jeroen van Wolffelaar <jeroen@wolffelaar.nl>
+#		Check merely for valid account, rather than for access to the
+#		mysql-database, so also regular mysqlusers can be used
 # Needs:	$dbname    - the database that user should have access to
 #				(optional)
 #		$dbserver  - the server to connect to.
-#		$dbadmin   - the administrator name.
-#		$dbadmpass - the administrator password.
+#		$dbadmin   - the databaseuser name.
+#		$dbadmpass - the databaseuser password.
 #		$statement - the statement to test if it can get data.
 #		which
 #		mysql
@@ -44,7 +47,7 @@
 elif [ ! -x $(which mysql) ] ; then
     error="No mysql client to execute, install the mysql client package and
     run 'dpkg-reconfigure -plow packagename'."
-elif ! eval $mysqlcmd -f mysql -e "\"show tables;\"" >/dev/null 2>&1 ; then
+elif ! eval $mysqlcmd </dev/null >/dev/null 2>&1 ; then
     error="Error when trying to connect to the mysql database.
     This error can occur if you have no database to connect to, or
     if the password was incorrect.
diff -ur wwwconfig-common-0.0.33.orig/mysql-ifnot-exec.sh wwwconfig-common-0.0.33/mysql-ifnot-exec.sh
--- wwwconfig-common-0.0.33.orig/mysql-ifnot-exec.sh	2003-12-19 11:51:48.000000000 +0100
+++ wwwconfig-common-0.0.33/mysql-ifnot-exec.sh	2004-02-05 01:43:06.000000000 +0100
@@ -12,10 +12,13 @@
 #		Added new status code.
 #	20031219 Thomas Viehmann <tv@beamnet.de>
 #		Patch to use eval in order to not break.
+#   20040205 Jeroen van Wolffelaar <jeroen@wolffelaar.nl>
+#		Check merely for valid account, rather than for access to the
+#		mysql-database, so also regular mysqlusers can be used
 # Needs:	$dbname    - the database that user should have access to (optional)
 #		$dbserver  - the server to connect to.
-#		$dbadmin   - the administrator name.
-#		$dbadmpass - the administrator password.
+#		$dbadmin   - the databaseuser name.
+#		$dbadmpass - the databaseuser password.
 #		$statement - the statement to test if it can get data.
 #		which
 #		mysql
@@ -43,7 +46,7 @@
 elif [ ! -x $(which mysql) ] ; then
     error="No mysql client to execute, install the mysql client package and
     run 'dpkg-reconfigure -plow packagename'."
-elif ! eval $mysqlcmd -f mysql -e "\"show tables;\"" >/dev/null 2>&1 ; then
+elif ! eval $mysqlcmd </dev/null >/dev/null 2>&1 ; then
     error="Error when trying to connect to the mysql database.
     This error can occur if you have no database to connect to, or
     if the password was incorrect.
-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux frodo 2.6.0 #1 Sun Feb 1 17:50:42 CET 2004 i686
Locale: LANG=nl_NL@euro, LC_CTYPE=nl_NL@euro

-- no debconf information