Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build_bind.inc.php #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions build_bind.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,27 @@ function build_bind_conf($options="") {
// what is the role for this server.
switch (strtolower($sdomain['role'])) {
case "forward":
//TODO: fixme.. this needs IPs like slaves do.. no file
$text .= "zone \"{$domain['fqdn']}\" in {\n type forward;\n file \"/{$options['path']}/named-{$domain['fqdn']}\";}\n";
// get the IP addresses for the master domain servers for this domain (these will be the forwarders)
list($status, $rows, $records) = db_get_records($onadb, 'dns_server_domains', array('domain_id' => $domain['id'], 'role' => 'master'), '');

$text .= "zone \"{$domain['fqdn']}\" in {\n type forward;\n forwarders { "; // \n };\n};\n\n";
// Add each master as a forwarder
foreach ($records as $master ) {
// Lookup a bunch of crap.. this should be done better.
list($status, $rows, $rec) = ona_get_host_record(array('id' => $master['host_id']));
list($status, $rows, $rec) = ona_get_dns_record(array('id' => $rec['primary_dns_id']));
list($status, $rows, $rec) = ona_get_interface_record(array('id' => $rec['interface_id']));
$text .= $rec['ip_addr_text']."; ";
}
$text .= " };\n";
$text .= "};\n\n";
break;

case "master":
$text .= "zone \"{$domain['fqdn']}\" in {\n type master;\n file \"/{$options['path']}/named-{$domain['fqdn']}\";\n};\n\n";
break;

case "slave":

// get the IP addresses for the master domain servers for this domain
list($status, $rows, $records) = db_get_records($onadb, 'dns_server_domains', array('domain_id' => $domain['id'], 'role' => 'master'), '');

Expand Down