pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Christoph Moench-Tegeder <cmt@burggraben.net>
Cc: Michael Mühlbeyer <Michael.Muehlbeyer@trivadis.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: md5 issues Postgres14 on OL7
Date: Tue, 11 Jan 2022 10:02:18 +0900
Message-ID: <YdzXGhQsP8BloVIl@paquier.xyz> (raw)
In-Reply-To: <1521801.1641668416@sss.pgh.pa.us>
References: <4038656.1641318875@sss.pgh.pa.us>
	<YdUx+6Sm5T0II8Un@paquier.xyz>
	<4190764.1641362933@sss.pgh.pa.us>
	<YdVEGLO/Ft7FUWF6@paquier.xyz>
	<YdamS8Sdwmiu4gsN@paquier.xyz>
	<1084379.1641487204@sss.pgh.pa.us>
	<YdeiBTC2cXqDhbpN@paquier.xyz>
	<1387391.1641595209@sss.pgh.pa.us>
	<Ydkpgvl+r7Nso2m3@paquier.xyz>
	<1521801.1641668416@sss.pgh.pa.us>

On Sat, Jan 08, 2022 at 02:00:16PM -0500, Tom Lane wrote:
> This is looking pretty solid to me.  Just a couple of nitpicks:
> 
> * In most places you initialize variables holding error strings to NULL:
> 
> +	const char *logdetail = NULL;
> 
> but there are three or so spots that don't, eg PerformRadiusTransaction.
> They should be consistent.  (Even if there's no actual bug, I'd be
> unsurprised to see Coverity carp about the inconsistency.)

Hmm.  I have spotted five of them, with one in passwordcheck.

> * The comments for md5_crypt_verify and plain_crypt_verify claim that
> the error string is "optionally" stored, but I don't see anything
> optional about it.  To me, "optional" would imply coding like
> 
> 	if (logdetail)
> 	    *logdetail = errstr;
> 
> which we don't have here, and I don't think we need it.  But the
> comments need adjustment.  (They were wrong before too, but no
> time like the present to clean them up.)

Makes sense.

> * I'd be inclined to just drop the existing comments like
> 
> -	 * We do not bother setting logdetail for any pg_md5_encrypt failure
> -	 * below: the only possible error is out-of-memory, which is unlikely, and
> -	 * if it did happen adding a psprintf call would only make things worse.
> 
> rather than modify them.   Neither the premise nor the conclusion
> of these comments is accurate anymore.  (I think that the psprintf
> they are talking about is the one that will happen inside elog.c
> to construct an errdetail string.  Yeah, there's some risk there,
> but I think it's minimal because of the fact that we preallocate
> some space in ErrorContext.)

Okay, that's fine by me.

> Other than those things, I think v3 is good to go.

I have done an extra pass on all that, and the result seemed fine to
me, so applied.  I have changed the non-OpenSSL code path of pgcrypto
to deal with that in 14 (does not exist on HEAD).  Thanks a lot for
the successive reviews!

The patch was invasive enough, but we could do more here:
- Add the same facility for HMAC.  That's not worth on REL_14_STABLE
based on the existing set of callers, but I'd like to do something
about that on HEAD as that could be helpful in the future.
- The error areas related to checksum_helper.c and backup_manifest.c
could be improved more.  Now these refer only to scenarios unlikely
going to happen in the field, so I have left that out.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (16+ messages)

Message-ID: <YdzXGhQsP8BloVIl@paquier.xyz>
Permalink:  ../YdzXGhQsP8BloVIl@paquier.xyz/
Also on:    postgresql.org/message-id/YdzXGhQsP8BloVIl@paquier.xyz

 · 

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-general@postgresql.org
  Cc: michael@paquier.xyz, tgl@sss.pgh.pa.us, cmt@burggraben.net, Michael.Muehlbeyer@trivadis.com
  Subject: Re: md5 issues Postgres14 on OL7
  In-Reply-To: <YdzXGhQsP8BloVIl@paquier.xyz>
  References: <4038656.1641318875@sss.pgh.pa.us> <YdUx+6Sm5T0II8Un@paquier.xyz> <4190764.1641362933@sss.pgh.pa.us> <YdVEGLO/Ft7FUWF6@paquier.xyz> <YdamS8Sdwmiu4gsN@paquier.xyz> <1084379.1641487204@sss.pgh.pa.us> <YdeiBTC2cXqDhbpN@paquier.xyz> <1387391.1641595209@sss.pgh.pa.us> <Ydkpgvl+r7Nso2m3@paquier.xyz> <1521801.1641668416@sss.pgh.pa.us> <YdzXGhQsP8BloVIl@paquier.xyz>

* 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