Re: Improve OAuth discovery logging

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: Improve OAuth discovery logging
Date: 2026-02-26 05:51:16
Message-ID: 15434512-B3FB-4AB3-B6B3-5D85ED0B4BBE@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This looks like nice patch addressing real issue in log analyzing.
Basic idea seems correct to me WRT OAuth, but I'm not a real expert in auth.

> On 25 Feb 2026, at 18:14, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> wrote:
>
> It can't, because the if is based on ctx->state. If I move it to
> before the if, I have to save the previous value, which just makes the
> code longer.

Well, you can do something in a line with

bool was_discovery = (ctx->state == OAUTH_STATE_ERROR_DISCOVERY);
ctx->state = OAUTH_STATE_FINISHED;
if (was_discovery)
{
}

But it's a matter of taste. Your code is correct anyway.

We can tweak comments a bit in sasl.h:

/*---------
* exchange()
*
* Produces a server challenge to be sent to the client. The callback
* must return one of the PG_SASL_EXCHANGE_* values, depending on
* whether the exchange continues, has finished successfully, or has
* failed. <---- , or was abandoned by the client.

* a successful outcome). The callback should set this to
* NULL if the exchange is over and no output should be sent,
* which should correspond to either PG_SASL_EXCHANGE_FAILURE
* or a PG_SASL_EXCHANGE_SUCCESS with no outcome data. <----- or ABANDONED

* failure message.) Ignored if the exchange is completed
* with PG_SASL_EXCHANGE_SUCCESS. <------ or ABANDONED

That's all what I could grep.

And thanks for your review in my thread!

Best regards, Andrey Borodin.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message yangyz 2026-02-26 05:53:28 Addition and subtraction operations for the interval and integer types
Previous Message Chao Li 2026-02-26 05:34:02 Re: Show comments in \dRp+, \dRs+, and \dX+ psql meta-commands