since-v1.diff.txt

text/plain

Filename: since-v1.diff.txt
Type: text/plain
Part: 0
Message: Re: [PATCH] Fix unbounded authentication exchanges during PQconnectPoll()
1:  04942e8e64 ! 1:  d7ff5c8f64 PQconnectPoll: fix unbounded authentication exchanges
    @@ Commit message
         long, and a v3 error should be bounded by its original message length.
     
         For the existing error_return cases, I added some additional error
    -    messages for symmetry with the new ones.
    +    messages for symmetry with the new ones, and cleaned up some message
    +    rot.
     
      ## src/interfaces/libpq/fe-connect.c ##
     @@ src/interfaces/libpq/fe-connect.c: keep_going:						/* We will come back to here until there is
    + 				 */
    + 				if ((beresp == 'R' || beresp == 'v') && (msgLength < 8 || msgLength > 2000))
    + 				{
    +-					libpq_append_conn_error(conn, "expected authentication request from server, but received %c",
    +-									   beresp);
    ++					libpq_append_conn_error(conn, "received invalid authentication request");
      					goto error_return;
      				}
      
    @@ src/interfaces/libpq/fe-connect.c: keep_going:						/* We will come back to here
     +						avail = conn->inEnd - conn->inCursor;
     +						if (avail > MAX_ERRLEN)
     +						{
    -+							libpq_append_conn_error(conn, "server sent overlong v2 error message");
    ++							libpq_append_conn_error(conn, "received invalid error message");
     +							goto error_return;
     +						}
     +
    @@ src/interfaces/libpq/fe-connect.c: keep_going:						/* We will come back to here
      					{
     -						/* We'll come back when there is more data */
     -						return PGRES_POLLING_READING;
    -+						libpq_append_conn_error(conn, "server sent truncated error message");
    ++						libpq_append_conn_error(conn, "received invalid error message");
     +						goto error_return;
      					}
      					/* OK, we read the message; mark data consumed */
    @@ src/interfaces/libpq/fe-connect.c: keep_going:						/* We will come back to here
      				{
      					if (pqGetNegotiateProtocolVersion3(conn))
      					{
    -+						libpq_append_conn_error(conn, "server sent truncated protocol negotiation message");
    ++						libpq_append_conn_error(conn, "received invalid protocol negotiation message");
      						goto error_return;
      					}
      					/* OK, we read the message; mark data consumed */
    @@ src/interfaces/libpq/fe-connect.c: keep_going:						/* We will come back to here
      				/* Get the type of request. */
      				if (pqGetInt((int *) &areq, 4, conn))
      				{
    -+					libpq_append_conn_error(conn, "server sent truncated authentication request");
    ++					libpq_append_conn_error(conn, "received invalid authentication request");
      					goto error_return;
      				}
      				msgLength -= 4;