From 09694fd4585aad4abc76c941e1465a8b60fc4bea Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sun, 24 Nov 2013 17:38:42 +0000 Subject: [PATCH] Warn if chroot dir looks wrong --- bind8/index.cgi | 21 +++++++++++++++++++++ bind8/lang/en | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/bind8/index.cgi b/bind8/index.cgi index 24644c417..095c9ce25 100755 --- a/bind8/index.cgi +++ b/bind8/index.cgi @@ -83,6 +83,27 @@ if ($need_create) { exit; } +# Check for possibly invalid chroot, which shows up as missing zone files +if (@zones && $access{'zones'} eq '*' && !$access{'ro'}) { + my @missing; + foreach my $z (@zones) { + if ($z->{'type'} eq 'master' && $z->{'file'} && + !-r $z->{'file'}) { + push(@missing, $z->{'file'}); + } + } + if (scalar(@missing) >= scalar(@zones)/2) { + if ($chroot && $chroot ne '/') { + print "",&text('index_ewrongchroot', + scalar(@missing), "$chroot"),"

\n"; + } + else { + print "",&text('index_emissingchroot', + scalar(@missing)),"

\n"; + } + } + } + if ($access{'defaults'}) { # display global options print &ui_subheading($text{'index_opts'}); diff --git a/bind8/lang/en b/bind8/lang/en index 7e1d0da97..19ec7e191 100644 --- a/bind8/lang/en +++ b/bind8/lang/en @@ -60,7 +60,8 @@ index_massupdate=Update Records in Selected index_masscreate=Add Record to Selected index_massrdelete=Delete Records in Selected index_bind=BIND - +index_ewrongchroot=Warning : The chroot directory $2 that Webmin thinks BIND is using may be incorrect. The zone files for $1 domains could not be found. +index_emissingchroot=Warning : Webmin thinks that BIND is not using a chroot directory, but that may be incorrect. The zone files for $1 domains could not be found. master_title=Edit Master Zone master_ecannot=You are not allowed to edit this zone master_egone=Zone $1 does not exist in any view