Skip to content

[2.4.x] mod_authn_dbd, mod_authn_socache: Preserve extra query columns on a cache hit - #1111

Merged
arturobernalg merged 2 commits into
apache:2.4.xfrom
arturobernalg:backport/982-24x-v2
Nov 28, 2026
Merged

arturobernalg merged 2 commits into
apache:2.4.xfrom
arturobernalg:backport/982-24x-v2

Conversation

@arturobernalg

@arturobernalg arturobernalg commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Backport of #982 (trunk fe886b2) and its follow-up #1110 (trunk e0feee1), PR 65172: https://bz.apache.org/bugzilla/show_bug.cgi?id=65172

  • MMN bumped to 20120211.144.
  • The test uses the preserved_test_conf() helper from trunk's aaa env.py, copied over here; not_backported() gets backported_in="2.4.72".

Without the changes test_018 fails on 2.4.x (the role lost on a cached login, and with only #982 a crash on a NULL column); with them it passes, and test/modules/aaa passes (87).

…ache hit (apache#982)

mod_authn_dbd, mod_authn_socache: Preserve extra query columns on a cache hit

AuthDBDUserPWQuery and AuthDBDUserRealmQuery may select columns beyond
the password, which mod_authn_dbd exports as AUTHENTICATE_<NAME>. With
mod_authn_socache in front of it ("socache dbd"), only the first,
uncached login got them: a cache hit is answered from the cached hash
alone.

Add the optional function ap_authn_cache_store_env(), which takes the
variables a lookup set along with the value to cache. mod_authn_socache
keeps them in the same cache entry, so that they expire with it, and
sets them again on a hit. mod_authn_dbd passes its extra columns
through it, and does not cache a lookup with extra columns in a cache
without it. An entry too long to be read back whole is not cached.

PR 65172.

(cherry picked from commit fe886b2)
An extra column of AuthDBDUserPWQuery or AuthDBDUserRealmQuery which
is SQL NULL was put in the environment as a NULL table value. Since
fe886b2 (apache#982) mod_authn_socache caches these values with the
login, and with AuthnCacheProvideFor dbd the child crashed on a login
for such a user, Basic or Digest.

The variable is now set and empty, also without the cache. Before,
env= tests saw it as not set, while CGI scripts already got an empty
value.

PR 65172.

(cherry picked from commit e0feee1)
@arturobernalg
arturobernalg merged commit 9e512be into apache:2.4.x Nov 28, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants