Skip to content

Commit f3e314a

Browse files
author
A. Täffner
committed
bind plugin set to access master db; installer setting rights initially
1 parent 3ecc352 commit f3e314a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

install/lib/installer_base.lib.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,14 +667,21 @@ public function grant_master_database_rights($verbose = false) {
667667
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
668668
}
669669

670-
$query = "GRANT SELECT, UPDATE(`dnssec_initialized`, `dnssec_info`, `dnssec_last_signed`) ON ?? TO ?@?";
670+
$query = "GRANT SELECT, UPDATE(`dnssec_initialized`, `dnssec_info`, `dnssec_last_signed`, `status`, `status_txt`) ON ?? TO ?@?";
671671
if ($verbose){
672672
echo $query ."\n";
673673
}
674674
if(!$this->dbmaster->query($query, $value['db'] . '.dns_soa', $value['user'], $host)) {
675675
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
676676
}
677677

678+
$query = "GRANT SELECT, UPDATE ON ?? TO ?@?";
679+
if ($verbose){
680+
echo $query ."\n";
681+
}
682+
if(!$this->dbmaster->query($query, $value['db'] . '.dns_rr', $value['user'], $host)) {
683+
$this->warning('Unable to set rights of user in master database: '.$value['db']."\n Query: ".$query."\n Error: ".$this->dbmaster->errorMessage);
684+
}
678685
}
679686

680687
}

server/plugins-available/bind_plugin.inc.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ function soa_update($event_name, $data) {
279279
if($return_status === 0) {
280280
$app->log("Writing BIND domain file: ".$filename, LOGLEVEL_DEBUG);
281281
$app->db->query('UPDATE dns_soa SET status=\'OK\', status_txt=\'\' WHERE id='.$data['new']['id']);
282+
$app->dbmaster->query('UPDATE dns_soa SET status=\'OK\', status_txt=\'\' WHERE id='.$data['new']['id']);
282283
} else {
283284
$loglevel = @($dns_config['disable_bind_log'] === 'y')?'LOGLEVEL_DEBUG':'LOGLEVEL_WARN';
284285
$app->log("Writing BIND domain file failed: ".$filename." ".implode(' ', $out), $loglevel);
@@ -295,6 +296,8 @@ function soa_update($event_name, $data) {
295296
rename($filename, $filename.'.err');
296297
}
297298
$app->db->query('UPDATE dns_soa SET status=\'ERROR\', status_txt=\''.str_replace(array('"', '\''), '', $statustext).'\' WHERE id='.$data['new']['id']);
299+
$app->dbmaster->query('UPDATE dns_soa SET status=\'ERROR\', status_txt=\''.str_replace(array('"', '\''), '', $statustext).'\' WHERE id='.$data['new']['id']);
300+
rename($filename.'.pending', $filename.'.err');
298301
}
299302
unset($tpl);
300303
unset($records);

0 commit comments

Comments
 (0)