Skip to content

Commit d376b4e

Browse files
committed
AA records wrong with issuewild and TYPE257 (Bind < 9.9.6) (Fixes #5916)
1 parent 65ed26f commit d376b4e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

server/plugins-available/bind_plugin.inc.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ function soa_update($event_name, $data) {
286286

287287
$records = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = ? AND active = 'Y'", $zone['id']);
288288
if(is_array($records) && !empty($records)){
289+
$caa_add_rec = -1;
289290
for($i=0;$i<sizeof($records);$i++){
290291
if($records[$i]['ttl'] == 0) $records[$i]['ttl'] = '';
291292
if($records[$i]['name'] == '') $records[$i]['name'] = '@';
@@ -301,7 +302,21 @@ function soa_update($event_name, $data) {
301302
$records[$i]['data'] = implode(' ', $temp);
302303
$data_new = str_replace(array('"', ' '), '', $records[$i]['data']);
303304
$hex = unpack('H*', $data_new);
304-
$hex[1] = '0005'.strtoupper($hex[1]);
305+
if ($temp[1] == 'issuewild') {
306+
$hex[1] = '0009'.strtoupper($hex[1]);
307+
if ($caa_add_rec == -1) {
308+
// add issue ";" if only issuewild recordsa
309+
$caa_add_rec = array_push($records, $records[$i]);
310+
$records[$caa_add_rec-1]['data'] = "\# 8 000569737375653B";
311+
}
312+
} else {
313+
$hex[1] = '0005'.strtoupper($hex[1]);
314+
if ($caa_add_rec > 0) {
315+
// remove previously added issue ";"
316+
array_pop($records);
317+
}
318+
$caa_add_rec = -2;
319+
}
305320
$length = strlen($hex[1])/2;
306321
$data_new = "\# $length $hex[1]";
307322
$records[$i]['data'] = $data_new;

0 commit comments

Comments
 (0)