postgresql/src
Tom Lane 515112f9d4 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:23 +00:00
..
backend Add a new GUC parameter backslash_quote, which determines whether the SQL 2006-05-21 20:10:42 +00:00
bin Code review for standard_conforming_strings patch. Fix it so it does not 2006-05-11 19:15:36 +00:00
include Add a new GUC parameter backslash_quote, which determines whether the SQL 2006-05-21 20:10:42 +00:00
interfaces Modify libpq's string-escaping routines to be aware of encoding considerations 2006-05-21 20:19:23 +00:00
makefiles Remove use of lorder and tsort while building static libraries. There's 2006-04-19 16:32:08 +00:00
pl Revert patch, causing plpython regression failues: 2006-04-27 14:18:07 +00:00
port Build server libpgport with all non-FRONTEND object files. This is to 2006-05-08 02:18:50 +00:00
template Remove extra 'else' in solaris compiler code. 2006-04-28 04:32:10 +00:00
test Change the backend to reject strings containing invalidly-encoded multibyte 2006-05-21 20:05:21 +00:00
timezone Suppress a couple of minor compiler warnings, per Magnus. 2006-04-09 19:21:34 +00:00
tools Mention packager bumps configure.in/configure. 2006-05-19 03:57:09 +00:00
tutorial Use SQL standard '' rather than \' for tutorial/sample code. 2006-05-11 19:21:14 +00:00
utils Add CVS tag lines to files that were lacking them. 2006-03-11 04:38:42 +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 Update Makefile for new thread_test location. 2006-02-04 01:04:20 +00:00
Makefile.global.in Remove use of lorder and tsort while building static libraries. There's 2006-04-19 16:32:08 +00:00
Makefile.shlib Arrange to strip libpq.so of symbols that aren't officially supposed to 2006-04-28 02:53:20 +00:00
nls-global.mk When merging PO files, take into consideration translations in other PO 2006-04-05 13:40:15 +00:00
win32.mak Fixes for Win32-client only compiles. 2006-03-03 23:11:48 +00:00