pgsql: Modernise pg_hba.conf token processing

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Modernise pg_hba.conf token processing
Date: 2011-06-28 19:59:45
Message-ID: E1QbeRl-00052E-HB@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Modernise pg_hba.conf token processing

The previous coding was ugly, as it marked special tokens as such in the
wrong stage, relying on workarounds to figure out if they had been
quoted in the original or not. This made it impossible to have specific
keywords be recognized as such only in certain positions in HBA lines,
for example. Fix by restructuring the parser code so that it remembers
whether tokens were quoted or not. This eliminates widespread knowledge
of possible known keywords for all fields.

Also improve memory management in this area, to use memory contexts that
are reset as a whole instead of using retail pfrees; this removes a
whole lotta crufty (and probably slow) code.

Instead of calling strlen() three times in next_field_expand on the
returned token to find out whether there was a comma (and strip it),
pass back the info directly from the callee, which is simpler.

In passing, update historical artifacts in hba.c API.

Authors: Brendan Jurd, Alvaro Herrera
Reviewed by Pavel Stehule

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/e5e2fc842c418432756d8b5825ff107c6c5fc4c3

Modified Files
--------------
src/backend/libpq/auth.c | 12 +-
src/backend/libpq/hba.c | 1256 ++++++++++++++++++++++++----------------------
src/include/libpq/hba.h | 8 +-
3 files changed, 656 insertions(+), 620 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2011-06-28 21:18:37 pgsql: Remove rel.h from objectaddress.h; only relcache.h is necessary.
Previous Message Alvaro Herrera 2011-06-28 17:45:33 Re: [COMMITTERS] pgsql: Branch refs/heads/REL9_1_STABLE was removed