pgsql: When reading pg_hba.conf and similar files, do not treat @file as

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: When reading pg_hba.conf and similar files, do not treat @file as
Date: 2010-03-06 00:46:27
Message-ID: 20100306004627.BBC2C7541D0@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
When reading pg_hba.conf and similar files, do not treat @file as an inclusion
unless (1) the @ isn't quoted and (2) the filename isn't empty. This guards
against unexpectedly treating usernames or other strings in "flat files"
as inclusion requests, as seen in a recent trouble report from Ed L.
The empty-filename case would be guaranteed to misbehave anyway, because our
subsequent path-munging behavior results in trying to read the directory
containing the current input file.

I think this might finally explain the report at
http://archives.postgresql.org/pgsql-bugs/2004-05/msg00132.php
of a crash after printing "authentication file token too long, skipping",
since I was able to duplicate that message (though not a crash) on a
platform where stdio doesn't refuse to read directories. We never got
far in investigating that problem, but now I'm suspicious that the trigger
condition was an @ in the flat password file.

Back-patch to all active branches since the problem can be demonstrated in all
branches except HEAD. The test case, creating a user named "@", doesn't cause
a problem in HEAD since we got rid of the flat password file. Nonetheless it
seems like a good idea to not consider quoted @ as a file inclusion spec,
so I changed HEAD too.

Tags:
----
REL7_4_STABLE

Modified Files:
--------------
pgsql/src/backend/libpq:
hba.c (r1.116.2.5 -> r1.116.2.6)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/libpq/hba.c?r1=1.116.2.5&r2=1.116.2.6)
pgsql/src/include/libpq:
hba.h (r1.33 -> r1.33.4.1)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/libpq/hba.h?r1=1.33&r2=1.33.4.1)

Browse pgsql-committers by date

  From Date Subject
Next Message Magnus Hagander 2010-03-06 15:28:09 pgsql: Add --psqlrc=FILENAME parameter to psql, to process an explicitly
Previous Message Tom Lane 2010-03-06 00:46:19 pgsql: When reading pg_hba.conf and similar files, do not treat @file as