Commit Graph

19912 Commits

Author SHA1 Message Date
Michael Meskes
ca6667fef0 Added some more coverity report patches send in by Martijn van Oosterhout <kleptog@svana.org>. 2006-06-21 11:38:35 +00:00
Michael Meskes
289a3b73e2 Added fixes from the coverity report send in by Joachim Wieland <joe@mcknight.de>
Added missing error handling in a few functions in ecpglib.
2006-06-21 10:31:45 +00:00
Tom Lane
49f1f24450 Back-port shell script syntax fix needed for some BSD machines.
Per buildfarm results from spoonbill.
2006-06-19 14:25:01 +00:00
Michael Meskes
14f52896b8 Do not use already free'ed errmsg, bug found by Joachim Wieland
<joachim.wieland@credativ.de>
2006-06-19 09:20:22 +00:00
Tom Lane
605cb39576 Increase timeout in statement_timeout test from 1 second to 2 seconds.
We have once or twice seen failures suggesting that control didn't get
to the exception block before the timeout elapsed, which is unlikely
but not impossible in a parallel regression test (with a dozen other
backends competing for cycles).  This change doesn't completely prevent
the problem of course, but it should reduce the probability enough that
we don't see it anymore.  Per buildfarm results.
2006-06-18 16:21:40 +00:00
Andrew Dunstan
34fe15672d backport workaround for OpenBSD compiler bug 2006-06-17 14:50:44 +00:00
Tom Lane
e2d201ecdb Fix Assert failure when a fastpath function call is attempted inside an
already-aborted transaction block.  GetSnapshotData throws an Assert if
not in a valid transaction; hence we mustn't attempt to set a snapshot
for the function until after checking for aborted transaction.  This is
harmless AFAICT if Asserts aren't enabled (GetSnapshotData will compute
a bogus snapshot, but it doesn't matter since HandleFunctionRequest will
throw an error shortly anywy).  Hence, not a major bug.

Along the way, add some ability to log fastpath calls when statement
logging is turned on.  This could probably stand to be improved further,
but not logging anything is clearly undesirable.

Backpatched as far as 8.0; bug doesn't exist before that.
2006-06-11 15:49:46 +00:00
Michael Meskes
3066e8ab03 Fixed two memory leaks in ecpglib. 2006-06-06 11:36:12 +00:00
Tom Lane
b734fc67a9 Fix copy-and-pasteo in Russian translation: message complaining about
HAVE_INT64_TIMESTAMP was mentioning PG_CONTROL_VERSION instead.
Victor Snezhko
2006-06-03 16:49:32 +00:00
Tom Lane
9b3d3e9baf Back-port recent ppport.h fix to 8.0 branch. 2006-06-01 03:47:34 +00:00
Tom Lane
1252a6a042 Remove pqsignalinquire(), which is unused and has portability issues. 2006-05-30 15:58:14 +00:00
Tom Lane
f966dccb2f Klugy fix for bug #2447: we can't expand a whole-row reference to NEW
in a rule WHERE expression while inserting it into the original query,
because the 8.0 ResolveNew API is wrongly designed.  This is fixed in 8.1
but I'm disinclined to risk back-porting the changes.  Instead, just stop
the coredump and instead issue the same 'cannot handle whole-row reference'
message that 7.4 and before generated in this situation.
2006-05-23 17:09:18 +00:00
Tom Lane
f39fc4769e Stamp release 8.0.8. 2006-05-21 21:53:31 +00:00
Tom Lane
e35c0aee33 Update release notes for upcoming releases. 2006-05-21 21:49:50 +00:00
Tom Lane
6450cee473 Fix missed \' to '' conversion. 2006-05-21 21:13:50 +00:00
Bruce Momjian
29dd673a94 Stamp releases 7.3.15, 7.4.13, and 8.0.8. 2006-05-21 20:28:35 +00:00
Tom Lane
94dec9114b 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:20:05 +00:00
Tom Lane
9bc62ddd5f Add a new GUC parameter backslash_quote, which determines whether the SQL
parser will allow "\'" to be used to represent a literal quote mark.  The
"\'" representation has been deprecated for some time in favor of the
SQL-standard representation "''" (two single quote marks), but it has been
used often enough that just disallowing it immediately won't do.  Hence
backslash_quote allows the settings "on", "off", and "safe_encoding",
the last meaning to allow "\'" only if client_encoding is a valid server
encoding.  That is now the default, and the reason is that in encodings
such as SJIS that allow 0x5c (ASCII backslash) to be the last byte of a
multibyte character, accepting "\'" allows SQL-injection attacks as per
CVE-2006-2314 (further details will be published after release).  The
"on" setting is available for backward compatibility, but it must not be
used with clients that are exposed to untrusted input.

Thanks to Akio Ishida and Yasuo Ohgaki for identifying this security issue.
2006-05-21 20:11:25 +00:00
Tom Lane
70794254a1 Change the backend to reject strings containing invalidly-encoded multibyte
characters in all cases.  Formerly we mostly just threw warnings for invalid
input, and failed to detect it at all if no encoding conversion was required.
The tighter check is needed to defend against SQL-injection attacks as per
CVE-2006-2313 (further details will be published after release).  Embedded
zero (null) bytes will be rejected as well.  The checks are applied during
input to the backend (receipt from client or COPY IN), so it no longer seems
necessary to check in textin() and related routines; any string arriving at
those functions will already have been validated.  Conversion failure
reporting (for characters with no equivalent in the destination encoding)
has been cleaned up and made consistent while at it.

Also, fix a few longstanding errors in little-used encoding conversion
routines: win1251_to_iso, win866_to_iso, euc_tw_to_big5, euc_tw_to_mic,
mic_to_euc_tw were all broken to varying extents.

Patches by Tatsuo Ishii and Tom Lane.  Thanks to Akio Ishida and Yasuo Ohgaki
for identifying the security issues.
2006-05-21 20:06:18 +00:00
Bruce Momjian
833e84621c Change \' to '', for SQL standards compliance. Backpatch to 7.3, 7.4,
and 8.0.  Later releases already patched.
2006-05-21 19:57:40 +00:00
Tom Lane
a2e7036909 Fix nasty bug in nodeIndexscan.c's detection of duplicate tuples during
a multiple (OR'ed) indexscan.  It was checking for duplicate
tuple->t_data->t_ctid, when what it should be checking is tuple->t_self.
The trouble situation occurs when a live tuple has t_ctid not pointing to
itself, which can happen if an attempted UPDATE was rolled back.  After a
VACUUM, an unrelated tuple could be installed where the failed update tuple
was, leading to one live tuple's t_ctid pointing to an unrelated tuple.
If one of these tuples is fetched by an earlier OR'ed indexscan and the other
by a later indexscan, nodeIndexscan.c would incorrectly ignore the second
tuple.  The bug exists in all 7.4.* and 8.0.* versions, but not in earlier
or later branches because this code was only used in those releases.  Per
trouble report from Rafael Martinez Guerrero.
2006-05-19 16:30:50 +00:00
Tom Lane
f939bdcafe Fix the sense of the test on DH_check()'s return value. This was preventing
custom-generated DH parameters from actually being used by the server.
Found by Michael Fuhr.
2006-05-12 22:44:50 +00:00
Tom Lane
e9c56ce5e9 Remove unnecessary .seg/.section directives, per Alan Stange. 2006-05-11 21:58:37 +00:00
Bruce Momjian
47d82d2856 Build server libpgport with all non-FRONTEND object files. This is to
fix a Win32 bug where pipe.c included a file that used FRONTEND, but it
wasn't on the server-build list.
2006-05-08 02:18:21 +00:00
Bruce Momjian
382825da9d Fix SELECT INTO and CREATE TABLE AS to create tables in the default
tablespace, not the base directory.

Kris Jurka
2006-04-26 23:01:13 +00:00
Michael Meskes
46942e84d9 Fixed memory leak bugs found by Martijn Oosterhout. 2006-04-24 09:45:57 +00:00
Tom Lane
8f7fce2fd6 Fix ancient memory leak in PQprintTuples(); our code no longer uses this
routine, but perhaps some applications do.  Found by Martijn van Oosterhout
using Coverity.
2006-04-19 16:15:41 +00:00
Tom Lane
f8511d4cc9 Fix similar_escape() so that SIMILAR TO works properly for patterns involving
alternatives ("|" symbol).  The original coding allowed the added ^ and $
constraints to be absorbed into the first and last alternatives, producing
a pattern that would match more than it should.  Per report from Eric Noriega.

I also changed the pattern to add an ARE director ("***:"), ensuring that
SIMILAR TO patterns do not change behavior if regex_flavor is changed.  This
is necessary to make the non-capturing parentheses work, and seems like a
good idea on general principles.

Back-patched as far as 7.4.  7.3 also has the bug, but a fix seems impractical
because that version's regex engine doesn't have non-capturing parens.
2006-04-13 18:01:45 +00:00
Teodor Sigaev
2ba15dbfc3 Detoast query in g_intbig_consistent and copy query in g_int_consistent.
Minor cleanups.
2006-04-03 10:45:28 +00:00
Tom Lane
1750f60ef3 TablespaceCreateDbspace should function normally even on platforms that do not
have symlinks (ie, Windows).  Although it'll never be called on to do anything
useful during normal operation on such a platform, it's still needed to
re-create dropped directories during WAL replay.
2006-03-29 15:16:00 +00:00
Tom Lane
b5c5c5d283 Repair longstanding error in btree xlog replay: XLogReadBuffer should be
passed extend = true whenever we are reading a page we intend to reinitialize
completely, even if we think the page "should exist".  This is because it
might indeed not exist, if the relation got truncated sometime after the
current xlog record was made and before the crash we're trying to recover
from.  These two thinkos appear to explain both of the old bug reports
discussed here:
http://archives.postgresql.org/pgsql-hackers/2005-05/msg01369.php
2006-03-28 21:17:44 +00:00
Michael Meskes
8931dbf52a Fixed bug 2330: Wrong error code in case of a duplicate key 2006-03-19 12:30:17 +00:00
Neil Conway
a6e40d9f42 The call to DNSServiceRegistrationCreate in postmaster.c does incorrect
byte-swapping on the port number which causes the call to fail on Intel
Macs.

This patch uses htons() instead of htonl() and fixes this bug.

Ashley Clark
2006-03-18 22:10:14 +00:00
Tom Lane
ea8eeb4ca7 Fix order of linking of libxslt and libxml2, per Dave Page. 2006-03-10 15:40:06 +00:00
Bruce Momjian
3923f08ca0 Check for "msys" so it doesn't use 'con' by checking for an evironment
variable.
2006-03-05 05:33:47 +00:00
Tatsuo Ishii
3134e61557 Minor teak. 2006-03-04 12:37:01 +00:00
Tatsuo Ishii
c5167b794a Tighten up SJIS byte sequence check. Now we reject invalid SJIS byte
sequence such as "0x95 0x27". Patches from Akio Ishida.
2006-03-04 11:54:02 +00:00
Bruce Momjian
ba89cae454 Use DEVTTY as 'con' on Win32 as a replacement for /dev/tty. 2006-03-04 04:31:05 +00:00
Bruce Momjian
b7a870ccc7 Avoid trying to open /dev/tty on Win32. Some Win32 systems have
/dev/tty, but it isn't a device file and doesn't work as expected.

This fixes a known bug where psql does not prompt for a password on some
Win32 systems.

Backpatch to 8.0.X too.

Robert Kinberg
2006-03-03 23:54:52 +00:00
Andrew Dunstan
77e7b8923c make initdb -U username work as advertised; back out bogus patch at rev 1.42
and supply real fix for problem it tried to address.
2006-02-24 00:54:27 +00:00
Neil Conway
8ac04d4d78 Fix three Python reference leaks in PLy_traceback(). This would result
in leaking memory when invoking a PL/Python procedure that raises an
exception. Unfortunately this still leaks memory, but at least the
largest leak has been plugged.

This patch also fixes a reference counting mistake in PLy_modify_tuple()
for 8.0, 8.1 and HEAD: we don't actually own a reference to `platt', so
we shouldn't Py_DECREF() it.
2006-02-20 20:10:43 +00:00
Neil Conway
74f615766c Patch from Marko Kreen:
pgcrypto crypt()/md5 and hmac() leak memory when compiled against
OpenSSL as openssl.c digest ->reset will do two DigestInit calls
against a context.  This happened to work with OpenSSL 0.9.6
but not with 0.9.7+.

Reason for the messy code was that I tried to avoid creating
wrapper structure to transport algorithm info and tried to use
OpenSSL context for it.  The fix is to create wrapper structure.

It also uses newer digest API to avoid memory allocations
on reset with newer OpenSSLs.

Thanks to Daniel Blaisdell for reporting it.
2006-02-18 20:48:56 +00:00
Tom Lane
f5ab0a2597 Move btbulkdelete's vacuum_delay_point() call to a place in the loop where
we are not holding a buffer content lock; where it was, InterruptHoldoffCount
is positive and so we'd not respond to cancel signals as intended.  Also
add missing vacuum_delay_point() call in btvacuumcleanup.  This should fix
complaint from Evgeny Gridasov about failure to respond to SIGINT/SIGTERM
in a timely fashion (bug #2257).
2006-02-14 17:20:17 +00:00
Tom Lane
dc9d11dc33 Fix qual_is_pushdown_safe to not try to push down quals involving a whole-row
Var referencing the subselect output.  While this case could possibly be made
to work, it seems not worth expending effort on.  Per report from Magnus
Naeslund(f).
2006-02-13 16:22:38 +00:00
Tom Lane
a5746b8b09 Stamp 8.0.7. 2006-02-12 22:38:05 +00:00
Tom Lane
2d584b5c1b Update release notes. 2006-02-12 22:35:52 +00:00
Tom Lane
df2c740c94 Fix bug in SET SESSION AUTHORIZATION that allows unprivileged users to crash
the server, if it has been compiled with Asserts enabled (CVE-2006-0553).
Thanks to Akio Ishida for reporting this problem.
2006-02-12 22:33:14 +00:00
Bruce Momjian
9bb401cd73 Update FAQ latest version 2006-02-12 18:50:45 +00:00
Bruce Momjian
5ae9c6138b Stamp releases for 2006-02-14 release 2006-02-12 18:41:53 +00:00
Bruce Momjian
dfa879bc98 Update release notes for 2006-02-14 release 2006-02-12 18:23:46 +00:00