From 1a9b96a2e52902a626d0bb9d02b71680d76cc692 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Tue, 7 Jun 2016 22:48:57 -0400 Subject: [PATCH] Bug 16690: SHOW GRANTS fails to detect proper permissions If the DB is on a remote machine, the web server and the db server are different, but the SHOW GRANTS code in installer/install.pl is trying to use the SAME machine. And even if the permissions were allowed accessing from both the web and db servers, MySQL won't return the SHOW GRANTS without access to the mysql.user table. To install *.* permissions became easiest to get working. This makes it so that you can specify the web and db server separately, so the SHOW GRANT will match the machine the user is connected from and return properly. --- debian/templates/koha-conf-site.xml.in | 3 +++ installer/install.pl | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in index 25ac182..371711d 100644 --- a/debian/templates/koha-conf-site.xml.in +++ b/debian/templates/koha-conf-site.xml.in @@ -250,7 +250,10 @@ __END_SRU_PUBLICSERVER__ mysql __DB_NAME__ + __DB_HOST__ + __DB_HOST__ 3306 __DB_USER__ __DB_PASS__ diff --git a/installer/install.pl b/installer/install.pl index cc67557..338cdff 100755 --- a/installer/install.pl +++ b/installer/install.pl @@ -44,10 +44,11 @@ $info{'dbms'} = ( C4::Context->config("db_scheme") ? C4::Context->config("db_scheme") : "mysql" ); -$info{'hostname'} = C4::Context->config("hostname"); -$info{'port'} = C4::Context->config("port"); -$info{'user'} = C4::Context->config("user"); -$info{'password'} = C4::Context->config("pass"); +$info{'hostname'} = C4::Context->config("hostname"); +$info{'webserver'} = C4::Context->config("webserver"); +$info{'port'} = C4::Context->config("port"); +$info{'user'} = C4::Context->config("user"); +$info{'password'} = C4::Context->config("pass"); my $dbh = DBI->connect( "DBI:$info{dbms}:dbname=$info{dbname};host=$info{hostname}" . ( $info{port} ? ";port=$info{port}" : "" ), @@ -113,7 +114,7 @@ elsif ( $step && $step == 2 ) { #Check if user have all necessary grants on this database. my $rq = $dbh->prepare( - "SHOW GRANTS FOR \'$info{user}\'\@'$info{hostname}'"); + "SHOW GRANTS FOR \'$info{user}\'\@'$info{webserver}'"); $rq->execute; my $grantaccess; while ( my ($line) = $rq->fetchrow ) { -- 2.1.4