Your message dated Sun, 3 May 2015 14:38:32 +0100
with message-id <[email protected]>
and subject line Fixed in 4.2.10
has caused the Debian Bug report #312353,
regarding "request-tracker4: rt-setup-database can't use MySQL database name 
with hyphen in it"
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
312353: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=312353
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: request-tracker3
Version: 3.0.12-7

When I invoke '/usr/sbin/rt-setup-database' to initialize or drop a MySQL 
database for RT and the name of this database is a string with hyphens (for 
instance "my-rt-database"), the script dies.

8<-------------------------
% sudo /usr/sbin/rt-setup-database --action init --dba rtuser 
--prompt-for-dba-password
In order to create a new database and grant RT access to that database,
this script needs to connect to your mysql instance on localhost as rtuser.
Please specify that user's database password below. If the user has no 
database
password, just press return.

Password: Now creating a database for RT.
Creating mysql database my-rt-database.
DBD::mysql::db do failed: You have an error in your SQL syntax.  Check the 
manual that corresponds to your MySQL server version for the right syntax to 
use near '-rt-database' at line 1 at /usr/sbin/rt-setup-database line 258, 
<STDIN> line 1.
You have an error in your SQL syntax.  Check the manual that corresponds to 
your MySQL server version for the right syntax to use near '-rt-database' at 
line 1 at /usr/sbin/rt-setup-database line 258, <STDIN> line 1.
8<-------------------------

The same behaviour for the drop action :

8<-------------------------
/usr/sbin/rt-setup-database --action drop --dba rtuser 
--prompt-for-dba-password
In order to create a new database and grant RT access to that database,
this script needs to connect to your mysql instance on localhost as rtuser.
Please specify that user's database password below. If the user has no 
database
password, just press return.

Password: 
About to drop mysql database my-rt-database on localhost.
WARNING: This will erase all data in my-rt-database.

Proceed [y/N]:y
Dropping mysql database my-rt-database.
DBD::mysql::db do failed: You have an error in your SQL syntax.  Check the 
manual that corresponds to your MySQL server version for the right syntax to 
use near '-rt-database' at line 1 at /usr/sbin/rt-setup-database line 233, 
<STDIN> line 2.
You have an error in your SQL syntax.  Check the manual that corresponds to 
your MySQL server version for the right syntax to use near '-rt-database' at 
line 1 at /usr/sbin/rt-setup-database line 233, <STDIN> line 2.
8<-------------------------

The name of the database to use is given in 
"/etc/request-tracker3/RT_SiteConfig.pm". It is then referred in  
"/usr/sbin/rt-setup-database" as "$RT::DatabaseName".

8<-------------------------
Set($DatabaseName , "my-rt-database");
8<-------------------------

After taking a look at "/usr/sbin/rt-setup-database", I found that the name of 
the database is not protected according to the protection rules of MySQL with 
"`".

I'm using Debian GNU/Linux 3.1 with :
request-tracker3  3.0.12-7
mysql-server      4.0.24-10
mysql-client      4.0.24-10
libmysqlclient12  4.0.24-10
libdbd-mysql-perl 2.9006-1

I suggest that the database name, "/usr/sbin/rt-setup-database", be protected.

Here is a patch made from the changes I wrote :
8<-------------------------
232,240d231
<     if ( $RT::DatabaseType eq 'Pg' or  $RT::DatabaseType eq 'Informix' ) {
<         $dbh->do("Drop DATABASE $RT::DatabaseName") or warn $DBI::errstr;
<     }
<     elsif ($RT::DatabaseType eq 'mysql' ) {
<         $dbh->do("Drop DATABASE `$RT::DatabaseName`") or warn $DBI::errstr;
<     }
<     else {
<         die "Unknown database type : $RT::DatabaseType" ;
<     }
241a233
>     $dbh->do("Drop DATABASE $RT::DatabaseName") or warn $DBI::errstr;
265,267d256
<     elsif ($RT::DatabaseType eq 'mysql' ) {
<         $dbh->do("CREATE DATABASE `$RT::DatabaseName`") or die $DBI::errstr;
<     }
269c258
<         die "Unknown database type : $RT::DatabaseType" ;
---
>         $dbh->do("CREATE DATABASE $RT::DatabaseName") or die $DBI::errstr;
8<-------------------------


--- End Message ---
--- Begin Message ---
Version: 4.2.10-1

4.2.10 included a fix for this bug, so arbitary MySQL database names are
now supported:

https://github.com/bestpractical/rt/commit/4cf6c91

--- End Message ---

Reply via email to