Skip to content

Commit

Permalink
Issue #22
Browse files Browse the repository at this point in the history
Added support for Ubuntu systems to save named options in
named.conf.options.
  • Loading branch information
WillyXJ authored and WillyXJ committed Oct 8, 2013
1 parent 46c456b commit bbc67a1
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions server/fm-modules/fmDNS/classes/class_buildconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ function buildServerConfig($post_data) {
}
$config .= "};\n\n";

/** Ubuntu requires named.conf.options */
if (strtolower($server_os) == 'ubuntu') {
$data->files[dirname($server_config_file) . '/named.conf.options'] = $config;
$config = $zones . "include \"" . dirname($server_config_file) . "/named.conf.options\";\n\n";;
}


/** Build logging config */
basicGetList('fm_' . $__FM_CONFIG['fmDNS']['prefix'] . 'config', 'cfg_name` DESC,`cfg_data`,`cfg_id', 'cfg_', 'AND cfg_type="logging" AND cfg_isparent="yes" AND cfg_status="active" AND server_serial_no in (0, ' . $server_serial_no . ')');
Expand Down Expand Up @@ -143,9 +149,9 @@ function buildServerConfig($post_data) {
if ($keys) {
$keys = "keys {\n$keys};\n";
}
$data->files[dirname($server_config_file) . '/named.keys.conf'] = $key_config;
$data->files[dirname($server_config_file) . '/named.conf.keys'] = $key_config;

$config .= $logging . $servers . "\ninclude \"" . dirname($server_config_file) . "/named.keys.conf\";\n\n";;
$config .= $logging . $servers . "\ninclude \"" . dirname($server_config_file) . "/named.conf.keys\";\n\n";;


/** Build ACLs */
Expand Down Expand Up @@ -266,15 +272,15 @@ function buildServerConfig($post_data) {
}
}
}
$data->files[$server_zones_dir . '/views.keys.conf'] = $key_config;
$data->files[$server_zones_dir . '/views.conf.keys'] = $key_config;

/** Generate zone file */
$tmp_files = $this->buildZoneDefinitions($server_zones_dir, $server_serial_no, $view_result[$i]->view_id, $view_result[$i]->view_name);

/** Include zones for view */
if (is_array($tmp_files)) {
$config .= "\n\tinclude \"" . $server_zones_dir . "/views.keys.conf\";\n";
$config .= "\tinclude \"" . $server_zones_dir . '/zones.' . $view_result[$i]->view_name . ".conf\";\n";
$config .= "\n\tinclude \"" . $server_zones_dir . "/views.conf.keys\";\n";
$config .= "\tinclude \"" . $server_zones_dir . '/zones.conf.' . $view_result[$i]->view_name . "\";\n";
$files = array_merge($files, $tmp_files);
}

Expand All @@ -288,7 +294,7 @@ function buildServerConfig($post_data) {

/** Include all zones in one file */
if (is_array($files)) {
$config .= "\ninclude \"" . $server_zones_dir . "/zones.all.conf\";\n";
$config .= "\ninclude \"" . $server_zones_dir . "/zones.conf.all\";\n";
}
}

Expand Down Expand Up @@ -453,9 +459,9 @@ function buildZoneDefinitions($server_zones_dir, $server_serial_no, $view_id = 0
}

if ($view_name) {
$files[$server_zones_dir . '/zones.' . $view_name . '.conf'] = $zones;
$files[$server_zones_dir . '/zones.conf.' . $view_name] = $zones;
} else {
$files[$server_zones_dir . '/zones.all.conf'] = $zones;
$files[$server_zones_dir . '/zones.conf.all'] = $zones;
}
}
return $files;
Expand Down Expand Up @@ -901,8 +907,8 @@ function namedSyntaxChecks($files_array) {
}

/** Build array of zone files to check */
if (preg_match('/\/zones\.(.+?)\.conf/', $file)) {
$view = preg_replace('/(.+?)zones\.+/', '', $file);
if (preg_match('/\/zones\.conf\.(.+?)/', $file)) {
$view = preg_replace('/(.+?)zones\.conf\.+/', '', $file);

$tmp_contents = preg_replace('/^\/\/(.+?)+/', '', $contents);
$tmp_contents = explode("};\n", trim($tmp_contents));
Expand Down

0 comments on commit bbc67a1

Please sign in to comment.