no quotation of dns data for powerdns

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2016-05-21 09:03:21 +02:00
parent 7ea1de2a92
commit 339d84736e
2 changed files with 20 additions and 7 deletions

View File

@@ -292,7 +292,7 @@ function addRequiredEntry($record = '@', $type = 'A', &$required)
function encloseTXTContent($txt_content, $isMultiLine = false)
{
// check that TXT content is enclosed in " "
if ($isMultiLine == false) {
if ($isMultiLine == false && Settings::Get('system.dns_server') != 'pdns') {
if (substr($txt_content, 0, 1) != '"') {
$txt_content = '"' . $txt_content;
}
@@ -300,6 +300,15 @@ function encloseTXTContent($txt_content, $isMultiLine = false)
$txt_content .= '"';
}
}
if (Settings::Get('system.dns_server') == 'pdns') {
// no quotation for PowerDNS
if (substr($txt_content, 0, 1) == '"') {
$txt_content = substr($txt_content, 1);
}
if (substr($txt_content, - 1) == '"') {
$txt_content = substr($txt_content, 0, -1);
}
}
return $txt_content;
}

View File

@@ -14,7 +14,6 @@
* @package Functions
*
*/
function generateDkimEntries($domain)
{
$zone_dkim = array();
@@ -55,12 +54,17 @@ function generateDkimEntries($domain)
// end-part
$dkim_txt .= 't=s';
if (Settings::Get('system.dns_server') == 'pdns') {
// PowerDNS does not need/want splitted content
$txt_record_split = $dkim_txt;
} else {
// split if necessary
$txt_record_split = '';
$lbr = 50;
for ($pos = 0; $pos <= strlen($dkim_txt) - 1; $pos += $lbr) {
$txt_record_split .= (($pos == 0) ? '("' : "\t\t\t\t\t \"") . substr($dkim_txt, $pos, $lbr) . (($pos >= strlen($dkim_txt) - $lbr) ? '")' : '"') . "\n";
}
}
// dkim-entry
$zone_dkim[] = $txt_record_split;