Skip to content

Commit 8739ef8

Browse files
author
A. Täffner
committed
bind plugin set to access master db; installer setting rights initially
1 parent 2f47487 commit 8739ef8

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

install/lib/installer_base.lib.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,22 @@ public function grant_master_database_rights($verbose = false) {
658658
if(!$this->dbmaster->query($query, $value['db'] . '.mail_backup', $value['user'], $host)) {
659659
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
660660
}
661+
662+
$query = "GRANT SELECT, UPDATE ON ?? TO ?@?";
663+
if ($verbose){
664+
echo $query ."\n";
665+
}
666+
if(!$this->dbmaster->query($query, $value['db'] . '.dns_soa', $value['user'], $host)) {
667+
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
668+
}
669+
670+
$query = "GRANT SELECT, UPDATE ON ?? TO ?@?";
671+
if ($verbose){
672+
echo $query ."\n";
673+
}
674+
if(!$this->dbmaster->query($query, $value['db'] . '.dns_rr', $value['user'], $host)) {
675+
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
676+
}
661677
}
662678

663679
}

server/plugins-available/bind_plugin.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,15 +273,15 @@ function soa_update($event_name, $data) {
273273
foreach ($out as $line) $statustext .= $line."\n";
274274
if($return_status === 0) {
275275
$app->log("Writing BIND domain file: ".$filename, LOGLEVEL_DEBUG);
276-
$app->db->query('UPDATE dns_soa SET status=\'OK\', status_txt=\'\' WHERE id='.$data['new']['id']);
276+
$app->dbmaster->query('UPDATE dns_soa SET status=\'OK\', status_txt=\'\' WHERE id='.$data['new']['id']);
277277
rename($filename.'.pending', $filename);
278278
} else {
279279
if($dns_config['disable_bind_log'] === 'y') {
280280
$app->log("Writing BIND domain file failed: ".$filename." ".implode(' ', $out), LOGLEVEL_DEBUG);
281281
} else {
282282
$app->log("Writing BIND domain file failed: ".$filename." ".implode(' ', $out), LOGLEVEL_WARN);
283283
}
284-
$app->db->query('UPDATE dns_soa SET status=\'ERROR\', status_txt=\''.str_replace(array('"', '\''), '', $statustext).'\' WHERE id='.$data['new']['id']);
284+
$app->dbmaster->query('UPDATE dns_soa SET status=\'ERROR\', status_txt=\''.str_replace(array('"', '\''), '', $statustext).'\' WHERE id='.$data['new']['id']);
285285
rename($filename.'.pending', $filename.'.err');
286286
}
287287
unset($tpl);

0 commit comments

Comments
 (0)