From df438c59ed6e62dc27a51ed5c89009cb2a8cb6dc Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Mon, 31 Jul 2023 11:01:27 -0700 Subject: [PATCH] Prevent incompatible option setting https://github.com/webmin/webmin/issues/1971 --- apache/core.pl | 18 +++++++++++++++--- apache/lang/en | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/apache/core.pl b/apache/core.pl index cd14aede8..7c8b4fed8 100755 --- a/apache/core.pl +++ b/apache/core.pl @@ -779,11 +779,23 @@ local(@po, $po, @rv); if ($in{'Options_def'}) { return ( [ ] ); } @po = ("ExecCGI", "FollowSymLinks", "Includes", "IncludesNOEXEC", "Indexes", "MultiViews", "SymLinksIfOwnerMatch"); +my $abscount = 0; +my $pluscount = 0; foreach $po (@po) { - if ($in{$po} == 1) { push(@rv, $po); } - elsif ($in{$po} == 2) { push(@rv, "+$po"); } - elsif ($in{$po} == 3) { push(@rv, "-$po"); } + if ($in{$po} == 1) { + push(@rv, $po); + $abscount++; + } + elsif ($in{$po} == 2) { + push(@rv, "+$po"); + $pluscount++; + } + elsif ($in{$po} == 3) { + push(@rv, "-$po"); + $pluscount++; + } } +$abscount && $pluscount && &error($text{'core_eoptionsboth'}); return @rv ? ( [ join(' ', @rv) ] ) : ( [ "None" ] ); } diff --git a/apache/lang/en b/apache/lang/en index 1c8f068cb..a867cb89e 100644 --- a/apache/lang/en +++ b/apache/lang/en @@ -501,6 +501,7 @@ core_actmod=Active modules core_option=Option core_setdir=Set for directory core_merge=Merge with parent +core_eoptionsboth=Options must be either all set for a directory or merged with the parent directory, but not both core_users=Only these users core_groups=Only these groups core_allusers=All valid users