|
Lines 145-154
elsif ( $step && $step == 2 ) {
Link Here
|
| 145 |
$template->param( 'checkdatabasecreated' => 1 ); |
145 |
$template->param( 'checkdatabasecreated' => 1 ); |
| 146 |
} |
146 |
} |
| 147 |
|
147 |
|
| 148 |
#Check if user have all necessary grants on this database. |
148 |
# Check if user have all necessary grants on this database. |
| 149 |
my $rq = |
149 |
# CURRENT_USER is ANSI SQL, and doesn't require mysql table |
| 150 |
$dbh->prepare( |
150 |
# privileges, making the % check pointless, since they |
| 151 |
"SHOW GRANTS FOR \'$info{user}\'\@'$info{hostname}'"); |
151 |
# couldn't even check GRANTS if they couldn't connect. |
|
|
152 |
my $rq = $dbh->prepare('SHOW GRANTS FOR CURRENT_USER'); |
| 152 |
$rq->execute; |
153 |
$rq->execute; |
| 153 |
my $grantaccess; |
154 |
my $grantaccess; |
| 154 |
while ( my ($line) = $rq->fetchrow ) { |
155 |
while ( my ($line) = $rq->fetchrow ) { |
|
Lines 168-194
elsif ( $step && $step == 2 ) {
Link Here
|
| 168 |
); |
169 |
); |
| 169 |
} |
170 |
} |
| 170 |
} |
171 |
} |
| 171 |
unless ($grantaccess) { |
|
|
| 172 |
$rq = |
| 173 |
$dbh->prepare("SHOW GRANTS FOR \'$info{user}\'\@'\%'"); |
| 174 |
$rq->execute; |
| 175 |
while ( my ($line) = $rq->fetchrow ) { |
| 176 |
my $dbname = $info{dbname}; |
| 177 |
if ( $line =~ m/$dbname/ || index( $line, '*.*' ) > 0 ) |
| 178 |
{ |
| 179 |
$grantaccess = 1 |
| 180 |
if ( |
| 181 |
index( $line, 'ALL PRIVILEGES' ) > 0 |
| 182 |
|| ( ( index( $line, 'SELECT' ) > 0 ) |
| 183 |
&& ( index( $line, 'INSERT' ) > 0 ) |
| 184 |
&& ( index( $line, 'UPDATE' ) > 0 ) |
| 185 |
&& ( index( $line, 'DELETE' ) > 0 ) |
| 186 |
&& ( index( $line, 'CREATE' ) > 0 ) |
| 187 |
&& ( index( $line, 'DROP' ) > 0 ) ) |
| 188 |
); |
| 189 |
} |
| 190 |
} |
| 191 |
} |
| 192 |
$template->param( "checkgrantaccess" => $grantaccess ); |
172 |
$template->param( "checkgrantaccess" => $grantaccess ); |
| 193 |
} # End mysql connect check... |
173 |
} # End mysql connect check... |
| 194 |
|
174 |
|
| 195 |
- |
|
|