From 0815271b4e2d2aa267521cbf248173a3f7fcbae0 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 | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in index 8e8204f1aa..8ca1ceca76 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 ac432148ed..0f7e6d470f 100755 --- a/installer/install.pl +++ b/installer/install.pl @@ -63,6 +63,7 @@ $info{'dbms'} = ( : "mysql" ); $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"); @@ -147,7 +148,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.11.0