Re: [PATCH] Fixed malformed error message on malformed SCRAM message.

From: Noah Misch <noah(at)leadboat(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: [PATCH] Fixed malformed error message on malformed SCRAM message.
Date: 2017-06-02 05:57:42
Message-ID: 20170602055742.GA1502070@rfd.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Tue, May 30, 2017 at 04:39:55PM -0700, Michael Paquier wrote:
> On Mon, May 29, 2017 at 2:40 PM, Alvaro Herrera
> <alvherre(at)2ndquadrant(dot)com> wrote:
> > Michael Paquier wrote:
> >> On Mon, May 29, 2017 at 2:06 PM, Alvaro Herrera
> >> <alvherre(at)2ndquadrant(dot)com> wrote:
> >> > These messages look all wrong to me.
> >>
> >> So your complain would be to do the following for each error message
> >> that uses parenthesis to include details? Like that I suppose:
> >> --- a/src/backend/libpq/auth-scram.c
> >> +++ b/src/backend/libpq/auth-scram.c
> >> @@ -283,11 +283,13 @@ pg_be_scram_exchange(void *opaq, char *input,
> >> int inputlen,
> >> if (inputlen == 0)
> >> ereport(ERROR,
> >> (errcode(ERRCODE_PROTOCOL_VIOLATION),
> >> - (errmsg("malformed SCRAM message (empty message)"))));
> >> + errmsg("malformed SCRAM message"),
> >> + errdetail("Empty message.")));
> >
> > Yeah, but along the lines of errdetail("The message is empty.")
>
> Okay. What do you think about the attached patch then? Does it address
> your concerns about the format of those error messages?
> --
> Michael

> diff --git a/src/backend/libpq/auth-scram.c b/src/backend/libpq/auth-scram.c
> index 99feb0ce94..366a11feb8 100644
> --- a/src/backend/libpq/auth-scram.c
> +++ b/src/backend/libpq/auth-scram.c
> @@ -283,11 +283,13 @@ pg_be_scram_exchange(void *opaq, char *input, int inputlen,
> if (inputlen == 0)
> ereport(ERROR,
> (errcode(ERRCODE_PROTOCOL_VIOLATION),
> - (errmsg("malformed SCRAM message (empty message)"))));
> + errmsg("malformed SCRAM message"),
> + errdetail("The message is empty.")));
> if (inputlen != strlen(input))
> ereport(ERROR,
> (errcode(ERRCODE_PROTOCOL_VIOLATION),
> - (errmsg("malformed SCRAM message (length mismatch)"))));
> + errmsg("malformed SCRAM message"),
> + errdetail("Input length does not match.")));

auth.c uses COMMERROR for this sort of thing; why does auth-scram.c use ERROR?

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Noah Misch 2017-06-02 05:58:59 Re: [PATCH] Fixed malformed error message on malformed SCRAM message.
Previous Message Amit Langote 2017-06-02 02:18:30 Re: BUG #14682: row level security not work with partitioned table

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2017-06-02 05:58:59 Re: [PATCH] Fixed malformed error message on malformed SCRAM message.
Previous Message Noah Misch 2017-06-02 05:41:19 Re: Get stuck when dropping a subscription during synchronizing table