postgresql/src
Tom Lane 7f615cab57 Modify libpq's string-escaping routines to be aware of encoding considerations
and standard_conforming_strings.  The encoding changes are needed for proper
escaping in multibyte encodings, as per the SQL-injection vulnerabilities
noted in CVE-2006-2313 and CVE-2006-2314.  Concurrent fixes are being applied
to the server to ensure that it rejects queries that may have been corrupted
by attempted SQL injection, but this merely guarantees that unpatched clients
will fail rather than allow injection.  An actual fix requires changing the
client-side code.  While at it we have also fixed these routines to understand
about standard_conforming_strings, so that the upcoming changeover to SQL-spec
string syntax can be somewhat transparent to client code.

Since the existing API of PQescapeString and PQescapeBytea provides no way to
inform them which settings are in use, these functions are now deprecated in
favor of new functions PQescapeStringConn and PQescapeByteaConn.  The new
functions take the PGconn to which the string will be sent as an additional
parameter, and look inside the connection structure to determine what to do.
So as to provide some functionality for clients using the old functions,
libpq stores the latest encoding and standard_conforming_strings values
received from the backend in static variables, and the old functions consult
these variables.  This will work reliably in clients using only one Postgres
connection at a time, or even multiple connections if they all use the same
encoding and string syntax settings; which should cover many practical
scenarios.

Clients that use homebrew escaping methods, such as PHP's addslashes()
function or even hardwired regexp substitution, will require extra effort
to fix :-(.  It is strongly recommended that such code be replaced by use of
PQescapeStringConn/PQescapeByteaConn if at all feasible.
2006-05-21 20:19:44 +00:00
..
backend Add a new GUC parameter backslash_quote, which determines whether the SQL 2006-05-21 20:11:02 +00:00
bin Fix pg_restore -n option to do what the man page says it does. The 2006-04-12 22:19:01 +00:00
include Add a new GUC parameter backslash_quote, which determines whether the SQL 2006-05-21 20:11:02 +00:00
interfaces Modify libpq's string-escaping routines to be aware of encoding considerations 2006-05-21 20:19:44 +00:00
makefiles Remove $(DESTDIR) from the pgxs BE_DLLLIBS= -L path for AIX and Darwin. 2006-01-19 21:19:15 +00:00
pl Fix plpgsql to pass only one copy of any given plpgsql variable into a SQL 2006-03-23 04:22:45 +00:00
port Stamp 8.1.4, except configure/configure.in. 2006-05-19 03:57:17 +00:00
template SUNOS4_CC -> SUNOS_CC. 2005-07-30 03:07:42 +00:00
test Adjust interval-addition test so that it won't fail on DST transition days. 2006-04-02 19:40:02 +00:00
timezone Re-run pgindent, fixing a problem where comment lines after a blank 2005-11-22 18:23:31 +00:00
tools Stamp 8.1.4, except configure/configure.in. 2006-05-19 03:57:17 +00:00
tutorial Use SQL standard '' rather than \' for tutorial/sample code. 2006-05-11 19:21:31 +00:00
utils PostgreSQL extension makefile framework ("pgxs"), by Fabien Coelho, with 2004-07-30 12:26:40 +00:00
bcc32.mak Add -N make flag to bcc builds from /src dir. 2005-05-13 18:12:35 +00:00
DEVELOPERS just testing a script... 1999-07-30 03:45:57 +00:00
Makefile Adjust src/tutorial Makefile so that it can use pgxs. This allows the 2005-01-13 18:23:22 +00:00
Makefile.global.in Fix problems with PGXS builds against an installation tree that was 2005-09-27 17:39:35 +00:00
Makefile.shlib Fix out-of-order inclusion of -L switches from LDFLAGS on AIX and HPUX. 2005-12-03 20:16:39 +00:00
nls-global.mk More locale fixes for pg_ctl. 2004-06-01 03:32:42 +00:00
win32.mak Attached is a makefile I hacked up to build pg_config under MSVC - the 2005-06-14 17:50:38 +00:00