Re: Log LDAP "diagnostic messages"?

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Log LDAP "diagnostic messages"?
Date: 2017-07-26 10:40:01
Message-ID: CAFjFpRdtYRCpsqXUY2przXQ3x8Lzy2=dA12ER3GTVgcfUQgCrw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 26, 2017 at 6:51 AM, Thomas Munro
<thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> Hi hackers,
>
> Some LDAP error codes are a bit vague. For example:
>
> LDAP_CONNECT_ERROR Indicates a connection problem.
> LDAP_PROTOCOL_ERROR A protocol violation was detected.
>
> To learn more, you have to call
> ldap_get_option(LDAP_OPT_DIAGNOSTIC_MESSAGE). Should we do that? For
> example, instead of:
>
> LOG: could not start LDAP TLS session: Protocol error
>
> ... you could see:
>
> LOG: could not start LDAP TLS session: Protocol error
> DETAIL: LDAP diagnostic message: unsupported extended operation
>
> Well, that may not be the most illuminating example, but that's a
> message sent back by the LDAP server that we're currently throwing
> away, and can be used to distinguish between unsupported TLS versions,
> missing StartTLS extension and various other cases. Perhaps that
> particular message would also be available via your LDAP server's
> logs, if you can access them, but in some cases we're throwing away
> client-side messages that are not available anywhere else like "TLS:
> unable to get CN from peer certificate", "TLS: hostname does not match
> CN in peer certificate" and more.
>

+1.

> Something like the attached.

The patch prints errdetail() as "No LDAP diagnostic message
available." when LDAP doesn't provide diagnostics. May be some error
messages do not have any diagnostic information. In that case above
error detail may be confusing. May be we should just omit error
details when diagnostic message is not available.

--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?= 2017-07-26 11:15:50 Re: proposal: psql: check env variable PSQL_PAGER
Previous Message tushar 2017-07-26 10:09:51 pg_upgrade failed with error - ERROR: column "a" in child table must be marked NOT NULL