Repository navigation
mod_setenvif: look up the header again after a SetEnvIfExpr rule (#860) - #1050
Open
arturobernalg wants to merge 1 commit into
Open
arturobernalg wants to merge 1 commit into
arturobernalg wants to merge 1 commit into
Conversation
…che#860) match_headers() reuses val and val_len for consecutive rules on the same header, but a SetEnvIfExpr rule in between can point val at the string its regex was applied to. The next rule for the earlier header was then matched against that other value, with the earlier header's length. Reset last_name for expression rules so the value is looked up again. * modules/metadata/mod_setenvif.c (match_headers): Reset last_name for expression rules. * test/modules/metadata/test_005_setenvif.py: New test. (cherry picked from commit 97e4791)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #860 (trunk 97e4791) to 2.4.x. Original author: @arshsmith1.
match_headers() reuses the looked-up value for consecutive SetEnvIf rules on the same header. A SetEnvIfExpr rule in between can repoint that value at the string its regex was applied to, so the next rule for the earlier header was matched against the wrong value (with the earlier header's length). The fix makes expression rules force a fresh header lookup.
The cherry-pick applies cleanly to 2.4.x; no changes to the code, test or changes entry.
Tested on a 2.4.x build with
test/runtests.sh modules/metadata: the new test_005_setenvif fails with only mod_setenvif.c reverted (SEI_LITERAL and SEI_REGEX get set from X-B) and passes with the fix. The rest of the metadata suite stays green (22 passed, 66 skipped, 5 xfailed).[x] This PR does not report or address a security vulnerability
(see
SECURITY.mdandhttps://www.apache.org/security/#reporting-a-vulnerability).
[x] Code follows the httpd style guide.
[x] New log messages (level debug or higher) use an empty
APLOGNO()tag;numbers are assigned by a committer at merge time (see
docs/log-message-tags/README). (No new log messages.)[x] If the change is user-visible, a
changes-entries/*.txtfile is included,following the template in
README.CHANGES(not needed otherwise).[x] Test cases based on pyhttpd are included where appropriate, in the
test/modules/xxxdirectory matching themodules/xxxmodule source,or
test/modules/corefor core server changes. On Unix, verify thesepass locally with e.g.
make check-pytest PYTEST_DIRS=test/modules/xxx.