Project

General

Profile

« Previous | Next » 

Revision 9a83872f

Added by NOYB NOYB over 9 years ago

Move unbound local zone types array to function in unbound.inc.

Protect against breaking the system; check for valid unbound local zone type rather than just the setting existence.

View differences:

src/etc/inc/unbound.inc
599 599
function unbound_add_host_entries($cfgsubdir = "") {
600 600
	global $config, $g;
601 601

  
602
	if (empty($config['unbound']['system_domain_local_zone_type'])) {
603
		$system_domain_local_zone_type = "transparent";
604
	} else {
602
	// Make sure the config setting is a valid unbound local zone type.  If not use "transparent".
603
	if (array_key_exists($config['unbound']['system_domain_local_zone_type'], unbound_local_zone_types())) {
605 604
		$system_domain_local_zone_type = $config['unbound']['system_domain_local_zone_type'];
605
	} else {
606
		$system_domain_local_zone_type = "transparent";
606 607
	}
607 608

  
608 609
	$unbound_entries = "local-zone: \"{$config['system']['domain']}\" $system_domain_local_zone_type\n";
......
793 794
	unbound_control("reload");
794 795
}
795 796

  
797
// Array of valid unbound local zone types
798
function unbound_local_zone_types() {
799
	return array(
800
		"deny" => gettext("Deny"),
801
		"refuse" => gettext("Refuse"),
802
		"static" => gettext("Static"),
803
		"transparent" => gettext("Transparent"),
804
		"typetransparent" => gettext("Type Transparent"),
805
		"redirect" => gettext("Redirect"),
806
		"inform" => gettext("Inform"),
807
		"inform_deny" => gettext("Inform Deny"),
808
		"nodefault" => gettext("No Default")
809
	);
810
}
811

  
796 812
?>

Also available in: Unified diff