]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1363736 - Ensure http configs (.htaccess) are forward-compatible with newer versi...
authorDylan William Hardison <dylan@hardison.net>
Thu, 11 May 2017 22:19:45 +0000 (18:19 -0400)
committerGitHub <noreply@github.com>
Thu, 11 May 2017 22:19:45 +0000 (18:19 -0400)
Bugzilla/ModPerl.pm

index 22be8e678e5b055452c82c2ec1263ad32fe52b34..42048a5c5b736ceeecb1bb3286eb0ac3f9506c16 100644 (file)
@@ -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;
 }