Re: Password identifiers, protocol aging and SCRAM protocol

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: David Steele <david(at)pgmasters(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Julian Markwort <julian(dot)markwort(at)uni-muenster(dot)de>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, Valery Popov <v(dot)popov(at)postgrespro(dot)ru>
Subject: Re: Password identifiers, protocol aging and SCRAM protocol
Date: 2016-09-28 09:53:52
Message-ID: 79774ac1-df34-6b20-1659-c020c3842ce1@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09/26/2016 09:02 AM, Michael Paquier wrote:
>> * [PATCH 2/8] Move encoding routines to src/common/
>> >
>> > I wonder if it is confusing to have two of encode.h/encode.c. Perhaps
>> > they should be renamed to make them distinct?
> Yes it may be a good idea to rename that, like encode_utils.[c|h] for
> the new files.

Looking at these encoding functions, the SCRAM protocol actually uses
base64 for everything. The hex encoding is only used in the server, to
encode the StoredKey and ServerKey in pg_authid. So we don't need that
in the client. It would actually make sense to use base64 for the fields
in pg_authid, too. Takes less space, and seems more natural for SCRAM
anyway.

libpq actually has its own implementation of hex encoding and decoding
already, in fe-exec.c. So if we wanted to use hex-encoding for
something, we could use that, or if we moved the routines from
src/backend/utils/encode.c, then we should try to reuse them for the
purposes of fe-exec.c, too. And libpq already has an implementation of
the 'escape' encoding, too, in fe-exec.c. But as I said above, I don't
think we need to touch any of that.

In summary, I think we only need to move the base64 routines to
src/common. I'd prefer to be quite surgical in what we put in
src/common, and avoid moving stuff that's not strictly required by both
the server and the client.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2016-09-28 10:03:31 Re: Password identifiers, protocol aging and SCRAM protocol
Previous Message valeriof 2016-09-28 09:49:03 Transaction user id through logical decoding