From: André Malo Date: Sat, 22 Feb 2003 17:06:20 +0000 (+0000) Subject: insert LoadModule/AddModule directives only outside of sections. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=788c803815cb400efa0d1cb4ecf63606b991c6e1;p=thirdparty%2Fapache%2Fhttpd.git insert LoadModule/AddModule directives only outside of sections. PR: 8712, 9012 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@98759 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/CHANGES b/src/CHANGES index 6f11ce6d2f4..06e8f013280 100644 --- a/src/CHANGES +++ b/src/CHANGES @@ -1,5 +1,8 @@ Changes with Apache 1.3.28 + *) Fix apxs to insert LoadModule/AddModule directives only outside of + sections. PR 8712, 9012. [André Malo] + *) Fix suexec compile error under SUNOS4, where strerror() doesn't exist. PR 5913, 9977. [Jonathan W Miner ] diff --git a/src/support/apxs.pl b/src/support/apxs.pl index cd5ef61fa19..eaed48b40dd 100644 --- a/src/support/apxs.pl +++ b/src/support/apxs.pl @@ -543,9 +543,69 @@ if ($opt_i or $opt_e) { foreach $lmd (@lmd) { my $what = $opt_A ? "preparing" : "activating"; if ($content !~ m|\n#?\s*$lmd|) { - $content =~ s|^(.*\n#?\s*LoadModule\s+[^\n]+\n)|$1$c$lmd\n|sg; + # check for open , so that the new LoadModule + # directive always appears *outside* of an . + + my $before = ($content =~ m|^(.*\n)#?\s*LoadModule\s+[^\n]+\n|s)[0]; + + # the '()=' trick forces list context and the scalar + # assignment counts the number of list members (aka number + # of matches) then + my $cntopen = () = ($before =~ m|^\s*<[^/].*$|mg); + my $cntclose = () = ($before =~ m|^\s* etc. see above for explanations. + + my $before = ($content =~ m|^(.*\n)#?\s*AddModule\s+[^\n]+\n|s)[0]; + my $cntopen = () = ($before =~ m|^\s*<[^/].*$|mg); + my $cntclose = () = ($before =~ m|^\s*