Don't pass the -g flag to BIND version 9 when starting without an init script

This commit is contained in:
Jamie Cameron 2008-08-27 16:06:54 +00:00
parent 0c019e3cde
commit 84488e4329
3 changed files with 29 additions and 12 deletions

View File

@ -82,3 +82,5 @@ Access control lists are now automatically re-ordered to handle dependencies.
When Webmin is not automatically converting records to canonical format for editing, display the canonical name on the Edit Record page.
When adding a cluster slave server, allow zones to be created in the same view on the slave as on the master.
Added a button to the Edit Master Zone page for checking records with the named-checkzone command.
---- Changes since 1.430 ----
Don't pass the -g flag to BIND version 9 when starting without an init script.

View File

@ -17,10 +17,25 @@ $internic_ftp_host = "rs.internic.net";
$internic_ftp_ip = "198.41.0.6";
$internic_ftp_file = "/domain/named.root";
# Get the version number
if (open(VERSION, "$module_config_directory/version")) {
chop($bind_version = <VERSION>);
close(VERSION);
}
else {
$bind_version = &get_bind_version();
}
# get_bind_version()
# Returns the BIND verison number, or undef if unknown
sub get_bind_version
{
my $out = `$config{'named_path'} -v 2>&1`;
if ($out =~ /(bind|named)\s+([0-9\.]+)/i) {
return $2;
}
return undef;
}
# get_config()
# Returns an array of references to assocs, each containing the details of
@ -1702,13 +1717,16 @@ local $user;
local $cmd;
if ($config{'named_user'}) {
$user = "-u $config{'named_user'}";
if ($config{'named_group'}) {
$user .= " -g $config{'named_group'}";
}
else {
local @u = getpwnam($config{'named_user'});
local @g = getgrgid($u[3]);
$user .= " -g $g[0]";
if (&get_bind_version() < 9) {
# Only version 8 takes the -g flag
if ($config{'named_group'}) {
$user .= " -g $config{'named_group'}";
}
else {
local @u = getpwnam($config{'named_user'});
local @g = getgrgid($u[3]);
$user .= " -g $g[0]";
}
}
}
if ($config{'start_cmd'}) {

View File

@ -36,11 +36,8 @@ if ($out = &check_bind_8()) {
exit;
}
# Try to get the version number
$out = `$config{'named_path'} -v 2>&1`;
if ($out =~ /(bind|named)\s+([0-9\.]+)/i) {
$bind_version = $2;
}
# Try to get the version number, and save for later calls
$bind_version = &get_bind_version();
&open_tempfile(VERSION, ">$module_config_directory/version");
&print_tempfile(VERSION, "$bind_version\n");
&close_tempfile(VERSION);