Subject: Refactor SASL exchange in preparation for OAuth Bearer

From: Daniel Gustafsson <[email-masked]>
Date: Fri, 23 Feb 2024 11:30:19 +0100

The attached two patches are smaller refactorings to the SASL exchange and init
codepaths which are required for the OAuthbearer work [0].  Regardless of the
future of that patchset, these refactorings are nice cleanups and can be
considered in isolation.  Another goal is of course to reduce scope of the
OAuth patchset to make it easier to review.

The first patch change state return from the exchange call to use a tri-state
return value instead of the current output parameters.  This makes it possible
to introduce async flows, but it also makes the code a lot more readable due to
using descriptve names IMHO.

The second patch sets password_needed during SASL init on the SCRAM exchanges.
This was implicit in the code but since not all future exchanges may require
password, do it explicitly per mechanism instead.

--
Daniel Gustafsson

[0] [email-masked]