pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Noah Misch <noah@leadboat.com>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Daniele Varrazzo <daniele.varrazzo@gmail.com>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: [PATCH] Fixed malformed error message on malformed SCRAM message.
Date: Fri, 2 Jun 2017 09:24:02 +0300
Message-ID: <a6b9fb83-284b-2e3e-66f1-75a78f8efce0@iki.fi> (raw)
In-Reply-To: <20170602055742.GA1502070@rfd.leadboat.com>
References: <CAB7nPqQrU1QyagF0i0MVw5_Cxy+YF+kJj5m8X5+qnNawn_UJuQ@mail.gmail.com>
	<20170529214021.kaw5qjzsbofaa6re@alvherre.pgsql>
	<CAB7nPqTBeEg1TFrZ+8uUWRnKVueDja+_LyTO2esPHRPQQQH8uQ@mail.gmail.com>
	<20170602055742.GA1502070@rfd.leadboat.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 06/02/2017 08:57 AM, Noah Misch wrote:
> On Tue, May 30, 2017 at 04:39:55PM -0700, Michael Paquier wrote:
>> 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?

Yeah, COMMERROR would be more consistent. But I wonder why auth.c uses 
COMMERROR rather than ERROR for these. It would seem more user-friendly. 
Or developer-friendly; the most likely time you see these messages is 
when you're developing a driver that speaks the protocol.

And pqformat.c uses ERROR for protocol violation errors. So we're not 
very consistent. I think it would be best to convert all or most of the 
ERRCODE_PROTOCOL_VIOLATION messages to ERROR. COMMERROR is appropriate 
when you you think that the client has already disconnected, or is so 
thoroughly confused that sending an error would just make things worse. 
Or if you the message contains information that you don't want to reveal 
to a non-authenticated client. I don't think that applies to any of the 
COMMERRORs in auth.c.

- Heikki



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (18+ messages)  latest in thread

Message-ID: <a6b9fb83-284b-2e3e-66f1-75a78f8efce0@iki.fi>
Permalink:  ../a6b9fb83-284b-2e3e-66f1-75a78f8efce0@iki.fi/
Also on:    postgresql.org/message-id/a6b9fb83-284b-2e3e-66f1-75a78f8efce0@iki.fi

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: hlinnaka@iki.fi, noah@leadboat.com, michael.paquier@gmail.com, alvherre@2ndquadrant.com, daniele.varrazzo@gmail.com
  Subject: Re: [PATCH] Fixed malformed error message on malformed SCRAM message.
  In-Reply-To: <a6b9fb83-284b-2e3e-66f1-75a78f8efce0@iki.fi>
  References: <CAB7nPqQrU1QyagF0i0MVw5_Cxy+YF+kJj5m8X5+qnNawn_UJuQ@mail.gmail.com> <20170529214021.kaw5qjzsbofaa6re@alvherre.pgsql> <CAB7nPqTBeEg1TFrZ+8uUWRnKVueDja+_LyTO2esPHRPQQQH8uQ@mail.gmail.com> <20170602055742.GA1502070@rfd.leadboat.com> <a6b9fb83-284b-2e3e-66f1-75a78f8efce0@iki.fi>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox