Skip to content

Commit aedefdd

Browse files
author
Till Brehm
committed
Merge branch '6636-import-ignore-ns' into 'develop'
Add option to ignore NS records in zone import, #6636 Closes #6636 See merge request ispconfig/ispconfig3!1846
2 parents 3fd76ab + d0a9707 commit aedefdd

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

interface/web/dns/dns_import.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
$post_server_id = false;
8080
}
8181

82+
$ignore_ns_records = (isset($_POST['ignore_ns_records']))?$app->functions->intval($_POST['ignore_ns_records']):0;
8283

8384
// Load the templates
8485
$records = $app->db->queryAllRecords("SELECT * FROM dns_template WHERE visible = 'Y'");
@@ -332,7 +333,7 @@ function fqdn_name( $owner, $origin ) {
332333
$owner = $name;
333334
$r = 0;
334335
$dns_rr = array();
335-
$add_default_ns = TRUE;
336+
$ns_record_included = FALSE;
336337
$found_soa = FALSE;
337338
foreach($lines as $line){
338339

@@ -580,7 +581,12 @@ function fqdn_name( $owner, $origin ) {
580581
$dns_rr[$r]['type'] = strtoupper($resource_type);
581582

582583
if($dns_rr[$r]['type'] == 'NS' && fqdn_name( $dns_rr[$r]['name'], $soa['name'] ) == $soa['name']){
583-
$add_default_ns = FALSE;
584+
if ($ignore_ns_records) {
585+
unset($dns_rr[$r]);
586+
continue;
587+
} else {
588+
$ns_record_included = TRUE;
589+
}
584590
}
585591

586592
$dns_rr[$r]['ttl'] = $app->functions->intval($dns_rr[$r]['ttl']);
@@ -611,7 +617,7 @@ function fqdn_name( $owner, $origin ) {
611617
$i++;
612618
}
613619

614-
if ( $add_default_ns ) {
620+
if ( $ignore_ns_records || !$ns_record_included ) {
615621
foreach ($servers as $server){
616622
$dns_rr[$r]['name'] = $soa['name'];
617623
$dns_rr[$r]['type'] = 'NS';

interface/web/dns/lib/lang/en_dns_import.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ $wb['ignore_record_not_class_in'] = 'Ignoring DNS record, not class IN.';
2222
$wb['ignore_record_unknown_type'] = 'Ignoring DNS record, unknown type.';
2323
$wb['ignore_record_invalid_owner'] = 'Ignoring DNS record, not able to validate owner name.';
2424
$wb['zone_file_import_fail'] = 'The zone file did not import.';
25+
$wb['ignore_ns_records_txt'] = 'Ignore NS records';
2526
?>

interface/web/dns/templates/dns_import.htm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ <h1>
4646
<div class="col-sm-9 col-text">
4747
<tmpl_var name='domain_field_desc_txt' }</div>
4848
</div>
49+
<div class="form-group">
50+
<label class="col-sm-3 control-label">{tmpl_var name=ignore_ns_records_txt'}</label>
51+
<div class="col-sm-9">
52+
<input type="checkbox" id="ignore_ns_records" value="1" checked name="ignore_ns_records" />
53+
</div>
54+
</div>
55+
4956
<div class="form-group">
5057
<label for="file" class="col-sm-3 control-label">{tmpl_var name='zonefile_to_import_txt'}</label>
5158
<div class="col-sm-9 col-text"><input name="file" id="file" size="30" type="file" class="fileUpload" /></div>

0 commit comments

Comments
 (0)