since-v42.diff.txt
text/plain
Filename: since-v42.diff.txt
Type: text/plain
Part: 0
1: 1f38ec8039b = 1: 5d474397364 Move PG_MAX_AUTH_TOKEN_LENGTH to libpq/auth.h
2: 9f87ffea1c7 = 2: 20452d21e0b require_auth: prepare for multiple SASL mechanisms
3: bda684d19cc ! 3: f0afefb80d6 libpq: handle asynchronous actions during SASL
@@ src/interfaces/libpq/fe-auth.c: pg_SASL_init(PGconn *conn, int payloadlen)
+ /*
+ * The mechanism should have set up the necessary callbacks; all we
+ * need to do is signal the caller.
++ *
++ * In non-assertion builds, this postcondition is enforced at time of
++ * use in PQconnectPoll().
+ */
++ Assert(conn->async_auth);
++ Assert(conn->cleanup_async_auth);
++
+ *async = true;
+ return STATUS_OK;
+ }
@@ src/interfaces/libpq/fe-connect.c: keep_going: /* We will come back to here
+ if (!conn->async_auth || !conn->cleanup_async_auth)
+ {
+ /* programmer error; should not happen */
-+ libpq_append_conn_error(conn, "async authentication has no handler");
++ libpq_append_conn_error(conn,
++ "internal error: async authentication has no handler");
+ goto error_return;
+ }
+
@@ src/interfaces/libpq/fe-connect.c: keep_going: /* We will come back to here
+ /* Done. Tear down the async implementation. */
+ conn->cleanup_async_auth(conn);
+ conn->cleanup_async_auth = NULL;
-+ Assert(conn->altsock == PGINVALID_SOCKET);
++
++ /*
++ * Cleanup must unset altsock, both as an indication that
++ * it's been released, and to stop pqSocketCheck from
++ * looking at the wrong socket after async auth is done.
++ */
++ if (conn->altsock != PGINVALID_SOCKET)
++ {
++ Assert(false);
++ libpq_append_conn_error(conn,
++ "internal error: async cleanup did not release polling socket");
++ goto error_return;
++ }
+
+ /*
+ * Reenter the authentication exchange with the server. We
@@ src/interfaces/libpq/fe-connect.c: keep_going: /* We will come back to here
+ * Caller needs to poll some more. conn->async_auth() should
+ * have assigned an altsock to poll on.
+ */
-+ Assert(conn->altsock != PGINVALID_SOCKET);
++ if (conn->altsock == PGINVALID_SOCKET)
++ {
++ Assert(false);
++ libpq_append_conn_error(conn,
++ "internal error: async authentication did not set a socket for polling");
++ goto error_return;
++ }
++
+ return status;
+ }
+
4: 3dc6dd3433c = 4: 711ca3f1efc Add OAUTHBEARER SASL mechanism
5: 97e0a2aae26 = 5: 66ef3b4b687 XXX fix libcurl link error
6: db0167009b9 = 6: 4df1bc59638 DO NOT MERGE: Add pytest suite for OAuth