From: Dylan William Hardison Date: Thu, 11 May 2017 22:19:45 +0000 (-0400) Subject: Bug 1363736 - Ensure http configs (.htaccess) are forward-compatible with newer versi... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20c1dbebae25818af68e68b77b8e33b76720c3c4;p=thirdparty%2Fbugzilla.git Bug 1363736 - Ensure http configs (.htaccess) are forward-compatible with newer versions of apache (#77) --- diff --git a/Bugzilla/ModPerl.pm b/Bugzilla/ModPerl.pm index 22be8e678..42048a5c5 100644 --- a/Bugzilla/ModPerl.pm +++ b/Bugzilla/ModPerl.pm @@ -50,6 +50,15 @@ sub apache_config { cgi_path => $cgi_path, ); $template->process(\*DATA, \%vars, \$conf); + my $apache_version = Apache2::ServerUtil::get_server_version(); + if ($apache_version =~ m!Apache/(\d+)\.(\d+)\.(\d+)!) { + my ($major, $minor, $patch) = ($1, $2, $3); + if ($major > 2 || $major == 2 && $minor >= 4) { + $conf =~ s{^\s+deny\s+from\s+all.*$}{Require all denied}gmi; + $conf =~ s{^\s+allow\s+from\s+all.*$}{Require all granted}gmi; + $conf =~ s{^\s+allow\s+from\s+(\S+).*$}{Require host $1}gmi; + } + } return $conf; }