Refactor channel binding code to fetch cbind_data only when necessary
Peter Eisentraut <peter_e@gmx.net>
Refactor channel binding code to fetch cbind_data only when necessary As things stand now, channel binding data is fetched from OpenSSL and saved into the SCRAM exchange context for any SSL connection attempted for a SCRAM authentication, resulting in data fetched but not used if no channel binding is used or if a different channel binding type is used than what the data is here for. Refactor the code in such a way that binding data is fetched from the SSL stack only when a specific channel binding is used for both the frontend and the backend. In order to achieve that, save the libpq connection context directly in the SCRAM exchange state, and add a dependency to SSL in the low-level SCRAM routines. This makes the interface in charge of initializing the SCRAM context cleaner as all its data comes from either PGconn* (for frontend) or Port* (for the backend). Author: Michael Paquier <michael.paquier@gmail.com>
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/libpq/auth.c | modified | +1 −18 |
| src/backend/libpq/auth-scram.c | modified | +13 −20 |
| src/include/libpq/scram.h | modified | +3 −3 |
| src/interfaces/libpq/fe-auth.c | modified | +4 −23 |
| src/interfaces/libpq/fe-auth.h | modified | +3 −7 |
| src/interfaces/libpq/fe-auth-scram.c | modified | +78 −81 |