From d376b4e5cef449a8342481ca79fe9ba373bac71c Mon Sep 17 00:00:00 2001 From: Florian Schaal <info@schaal-24.de> Date: Sat, 14 Nov 2020 07:41:48 +0100 Subject: [PATCH] AA records wrong with issuewild and TYPE257 (Bind < 9.9.6) (Fixes #5916) --- server/plugins-available/bind_plugin.inc.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/server/plugins-available/bind_plugin.inc.php b/server/plugins-available/bind_plugin.inc.php index b152a8758d..a32a1931cd 100644 --- a/server/plugins-available/bind_plugin.inc.php +++ b/server/plugins-available/bind_plugin.inc.php @@ -286,6 +286,7 @@ class bind_plugin { $records = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = ? AND active = 'Y'", $zone['id']); if(is_array($records) && !empty($records)){ + $caa_add_rec = -1; for($i=0;$i<sizeof($records);$i++){ if($records[$i]['ttl'] == 0) $records[$i]['ttl'] = ''; if($records[$i]['name'] == '') $records[$i]['name'] = '@'; @@ -301,7 +302,21 @@ class bind_plugin { $records[$i]['data'] = implode(' ', $temp); $data_new = str_replace(array('"', ' '), '', $records[$i]['data']); $hex = unpack('H*', $data_new); - $hex[1] = '0005'.strtoupper($hex[1]); + if ($temp[1] == 'issuewild') { + $hex[1] = '0009'.strtoupper($hex[1]); + if ($caa_add_rec == -1) { + // add issue ";" if only issuewild recordsa + $caa_add_rec = array_push($records, $records[$i]); + $records[$caa_add_rec-1]['data'] = "\# 8 000569737375653B"; + } + } else { + $hex[1] = '0005'.strtoupper($hex[1]); + if ($caa_add_rec > 0) { + // remove previously added issue ";" + array_pop($records); + } + $caa_add_rec = -2; + } $length = strlen($hex[1])/2; $data_new = "\# $length $hex[1]"; $records[$i]['data'] = $data_new; -- GitLab