In cached bind mode the refresh rebuilt the provider instance but kept
the previous session binder's direct binder, and that binder reads the
bind flow, the unbind flow, MFA support and the base DN from the
instance it was built with. A change to any of them on the provider
never reached a running outpost: it carried on executing the old bind
flow until the process was restarted, while the refresh log said the
new flow had been loaded. The cached results survived the refresh too,
so a bind refused under the old settings stayed refused, and one
accepted stayed accepted, for the life of its entry.
The direct binder is now always built from the new instance. The
session cache is carried over only when the settings that decide a
bind's outcome are unchanged; when one of them changes, the old cache
is stopped and a fresh one started, so every pair of credentials runs
the new flow once more and is cached again under it. The five-minute
refresh keeps the cache in the ordinary case; the cost lands only when
an administrator changed something, which is what the change was for.
Also fixes the comment on the caching line, which said the opposite of
what the code does: a result is cached whenever the bind itself
completed, refusals included; only a transport error is left uncached.
Tests: a refresh with unchanged settings keeps the cached sessions; a
changed bind flow, unbind flow, MFA setting or base DN discards them,
refusals included; and the direct binder answers for the new instance's
base DN after a refresh. The last two fail on the previous code.
Co-authored-by: Jens L. <[email protected]>