Commit Graph

14585 Commits

Author SHA1 Message Date
Joe Conway c3f8e037c0 Check to ensure the number of primary key fields supplied does not
exceed the total number of non-dropped source table fields for
dblink_build_sql_*(). Addresses bug report from Rushabh Lathia.

Backpatch all the way to the 7.3 branch.
2010-02-03 23:02:39 +00:00
Tom Lane 9d4269f087 Stamp release 7.3.21.
Security: CVE-2007-4769, CVE-2007-4772, CVE-2007-6067, CVE-2007-6600, CVE-2007-6601
2008-01-03 21:42:44 +00:00
Tom Lane d66dcb144a Update release notes for security releases.
Security: CVE-2007-4769, CVE-2007-4772, CVE-2007-6067, CVE-2007-6600, CVE-2007-6601
2008-01-03 21:36:29 +00:00
Tom Lane 6689ac7db9 The original patch to disallow non-passworded connections to non-superusers
failed to cover all the ways in which a connection can be initiated in dblink.
Plug the remaining holes.  Also, disallow transient connections in functions
for which that feature makes no sense (because they are only sensible as
part of a sequence of operations on the same connection).  Joe Conway

Security: CVE-2007-6601
2008-01-03 21:29:07 +00:00
Tom Lane 218cf59b60 Make standard maintenance operations (including VACUUM, ANALYZE, REINDEX,
and CLUSTER) execute as the table owner rather than the calling user, using
the same privilege-switching mechanism already used for SECURITY DEFINER
functions.  The purpose of this change is to ensure that user-defined
functions used in index definitions cannot acquire the privileges of a
superuser account that is performing routine maintenance.  While a function
used in an index is supposed to be IMMUTABLE and thus not able to do anything
very interesting, there are several easy ways around that restriction; and
even if we could plug them all, there would remain a risk of reading sensitive
information and broadcasting it through a covert channel such as CPU usage.

To prevent bypassing this security measure, execution of SET SESSION
AUTHORIZATION and SET ROLE is now forbidden within a SECURITY DEFINER context.

Thanks to Itagaki Takahiro for reporting this vulnerability.

Security: CVE-2007-6600
2008-01-03 21:25:58 +00:00
Bruce Momjian 7146fab2a8 Provide a more helpful error message when there is an autoconf version
mismatch;  backpatch.
2007-12-31 17:27:48 +00:00
Peter Eisentraut 70777be20c Require a specific Autoconf version, instead of a lower bound only. 2007-11-26 12:04:54 +00:00
Tatsuo Ishii a6b6e71fa6 Fix "Page Layout" table. The second row should be ItemIdData, not
ItemPointerData.
2007-11-23 00:42:56 +00:00
Joe Conway 75ffb44e7f Have crosstab variants treat NULL rowid as a category in its own right,
per suggestion from Tom Lane. This fixes crash-bug reported by Stefan
Schwarzer.
2007-11-10 05:02:41 +00:00
Tom Lane b7f1fe6c46 Ensure that the result of evaluating a function during constant-expression
simplification gets detoasted before it is incorporated into a Const node.
Otherwise, if an immutable function were to return a TOAST pointer (an
unlikely case, but it can be made to happen), we would end up with a plan
that depends on the continued existence of the out-of-line toast datum.
2007-10-11 21:28:39 +00:00
Tom Lane 245dd2bca7 Fix bogus calculation of potential output string length in translate(). 2007-09-22 05:36:20 +00:00
Tom Lane 1aea75f047 Update release notes for last-minute fix. 2007-09-16 03:04:09 +00:00
Tom Lane 2f2baf9299 Fix aboriginal mistake in lazy VACUUM's code for truncating away
no-longer-needed pages at the end of a table.  We thought we could throw away
pages containing HEAPTUPLE_DEAD tuples; but this is not so, because such
tuples very likely have index entries pointing at them, and we wouldn't have
removed the index entries.  The problem only emerges in a somewhat unlikely
race condition: the dead tuples have to have been inserted by a transaction
that later aborted, and this has to have happened between VACUUM's initial
scan of the page and then rechecking it for empty in count_nondeletable_pages.
But that timespan will include an index-cleaning pass, so it's not all that
hard to hit.  This seems to explain a couple of previously unsolved bug
reports.
2007-09-16 02:38:31 +00:00
Marc G. Fournier a93840e343 tag configure for 7.3.20 2007-09-15 00:26:05 +00:00
Tom Lane 8ea2d503b6 Fix markup that doesn't work in back branches. 2007-09-14 15:57:27 +00:00
Tom Lane dc3fa6afb0 Minor editorialization on release notes. 2007-09-14 15:51:59 +00:00
Peter Eisentraut cc6dcf4c08 Translation updates 2007-09-13 20:49:39 +00:00
Bruce Momjian 5373878775 Stamp releases 8.2.5, 8.1.10, 8.0.14, 7.4.18, 7.3.20.
Update FAQs for 8.2.5.
2007-09-11 17:36:33 +00:00
Bruce Momjian 4147492693 Stamp 2007-09-11 17:19:07 +00:00
Tom Lane 85738a50ea Fix aboriginal bug in _tarAddFile(): when complaining that the amount of data
read from the temp file didn't match the file length reported by ftello(),
the wrong variable's value was printed, and so the message made no sense.
Clean up a couple other coding infelicities while at it.
2007-08-29 16:32:11 +00:00
Tom Lane 10a81b3f2f Fix combo_decrypt() to throw an error for zero-length input when using a
padded encryption scheme.  Formerly it would try to access res[(unsigned) -1],
which resulted in core dumps on 64-bit machines, and was certainly trouble
waiting to happen on 32-bit machines (though in at least the known case
it was harmless because that byte would be overwritten after return).
Per report from Ken Colson; fix by Marko Kreen.
2007-08-23 16:16:27 +00:00
Tom Lane ffaaaf9918 Fix potential access-off-the-end-of-memory in varbit_out(): it fetched the
byte after the last full byte of the bit array, regardless of whether that
byte was part of the valid data or not.  Found by buildfarm testing.
Thanks to Stefan Kaltenbrunner for nailing down the cause.
2007-08-21 02:40:40 +00:00
Tom Lane 99fa5f458c Fix pg_restore to guard against unexpected EOF while reading an archive file.
Per report and partial patch from Chad Wagner.
2007-08-06 01:38:57 +00:00
Tom Lane 681690f4e3 Fix elog.c to avoid infinite recursion (leading to backend crash) when
log_min_error_statement is active and there is some problem in logging the
current query string; for example, that it's too long to include in the log
message without running out of memory.  This problem has existed since the
log_min_error_statement feature was introduced.  No doubt the reason it
wasn't detected long ago is that 8.2 is the first release that defaults
log_min_error_statement to less than PANIC level.
Per report from Bill Moran.
2007-07-21 22:12:38 +00:00
Tom Lane c556447c70 Make replace(), split_part(), and string_to_array() behave somewhat sanely
when handed an invalidly-encoded pattern.  The previous coding could get
into an infinite loop if pg_mb2wchar_with_len() returned a zero-length
string after we'd tested for nonempty pattern; which is exactly what it
will do if the string consists only of an incomplete multibyte character.
This led to either an out-of-memory error or a backend crash depending
on platform.  Per report from Wiktor Wodecki.
2007-07-19 20:34:54 +00:00
Tom Lane f1dda4c54e Fix outfuncs.c to dump A_Const nodes representing NULLs correctly. This has
been broken since forever, but was not noticed because people seldom look
at raw parse trees.  AFAIK, no impact on users except that debug_print_parse
might fail; but patch it all the way back anyway.  Per report from Jeff Ross.
2007-07-17 01:22:25 +00:00
Joe Conway a776eaea3c Restrict non-superusers to password authenticated connections
to prevent possible escalation of privilege. Provide new SECURITY
DEFINER functions with old behavior, but initially REVOKE ALL
from public for these functions. Per list discussion and design
proposed by Tom Lane.
2007-07-09 01:44:11 +00:00
Tom Lane 7ca6422075 Fix failure to restart Postgres when Linux kernel returns EIDRM for shmctl().
This is a Linux kernel bug that apparently exists in every extant kernel
version: sometimes shmctl() will fail with EIDRM when EINVAL is correct.
We were assuming that EIDRM indicates a possible conflict with pre-existing
backends, and refusing to start the postmaster when this happens.  Fortunately,
there does not seem to be any case where Linux can legitimately return EIDRM
(it doesn't track shmem segments in a way that would allow that), so we can
get away with just assuming that EIDRM means EINVAL on this platform.

Per reports from Michael Fuhr and Jon Lapham --- it's a bit surprising
we have not seen more reports, actually.
2007-07-02 20:12:26 +00:00
Tom Lane 175c3b853a Fix a passel of ancient bugs in to_char(), including two distinct buffer
overruns (neither of which seem likely to be exploitable as security holes,
fortunately, since the provoker can't control the data written).  One of
these is due to choosing to stomp on the output of a called function, which
is bad news in any case; make it treat the called functions' results as
read-only.  Avoid some unnecessary palloc/pfree traffic too; it's not
really helpful to free small temporary objects, and again this is presuming
more than it ought to about the nature of the results of called functions.
Per report from Patrick Welche and additional code-reading by Imad.
2007-06-29 01:52:21 +00:00
Tom Lane 01e570e684 transformColumnDefinition failed to complain about
create table foo (bar int default null default 3);
due to not thinking about the special-case handling of DEFAULT NULL.
Problem noticed while investigating bug #3396.
2007-06-20 18:21:51 +00:00
Tom Lane cbe8af81b2 CREATE DOMAIN ... DEFAULT NULL failed because gram.y special-cases DEFAULT
NULL and DefineDomain didn't.  Bug goes all the way back to original coding
of domains.  Per bug #3396 from Sergey Burladyan.
2007-06-20 18:16:30 +00:00
Tom Lane 72cbfa4fcc Fix aboriginal bug in BufFileDumpBuffer that would cause it to write the
wrong data when dumping a bufferload that crosses a component-file boundary.
This probably has not been seen in the wild because (a) component files are
normally 1GB apiece and (b) non-block-aligned buffer usage is relatively
rare.  But it's fairly easy to reproduce a problem if one reduces RELSEG_SIZE
in a test build.  Kudos to Kurt Harriman for spotting the bug.
2007-06-01 23:43:39 +00:00
Tom Lane 2d91f676b0 Fix dynahash.c to suppress hash bucket splits while a hash_seq_search() scan
is in progress on the same hashtable.  This seems the least invasive way to
fix the recently-recognized problem that a split could cause the scan to
visit entries twice or (with much lower probability) miss them entirely.
The only field-reported problem caused by this is the "failed to re-find
shared lock object" PANIC in COMMIT PREPARED reported by Michel Dorochevsky,
which was caused by multiply visited entries.  However, it seems certain
that mdsync() is vulnerable to missing required fsync's due to missed
entries, and I am fearful that RelationCacheInitializePhase2() might be at
risk as well.  Because of that and the generalized hazard presented by this
bug, back-patch all the supported branches.

Along the way, fix pg_prepared_statement() and pg_cursor() to not assume
that the hashtables they are examining will stay static between calls.
This is risky regardless of the newly noted dynahash problem, because
hash_seq_search() has never promised to cope with deletion of table entries
other than the just-returned one.  There may be no bug here because the only
supported way to call these functions is via ExecMakeTableFunctionResult()
which will cycle them to completion before doing anything very interesting,
but it seems best to get rid of the assumption.  This affects 8.2 and HEAD
only, since those functions weren't there earlier.
2007-04-26 23:25:48 +00:00
Neil Conway a8ac5f7626 Fix newly-introduced documentation typo. 2007-04-23 16:53:15 +00:00
PostgreSQL Daemon 6b5ecb4010 Update configure.in for release
Security: hold for release
2007-04-20 16:19:11 +00:00
Tom Lane 653f0f0b53 Fix markup.
Security: CVE-2007-2138
2007-04-20 03:28:17 +00:00
Tom Lane a174b6fb6c Fix markup.
Security: CVE-2007-2138
2007-04-20 03:10:57 +00:00
Tom Lane a796aac46f Support explicit placement of the temporary-table schema within search_path.
This is needed to allow a security-definer function to set a truly secure
value of search_path.  Without it, a malicious user can use temporary objects
to execute code with the privileges of the security-definer function.  Even
pushing the temp schema to the back of the search path is not quite good
enough, because a function or operator at the back of the path might still
capture control from one nearer the front due to having a more exact datatype
match.  Hence, disable searching the temp schema altogether for functions and
operators.

Security: CVE-2007-2138
2007-04-20 02:38:59 +00:00
Bruce Momjian f085ee088e Release wording updates for releases 8.2.4, 8.1.9, 8.0.13, 7.4.17, 7.3.19. 2007-04-19 13:01:44 +00:00
Bruce Momjian def3f81fa1 Update FAQ to mention most recent release for releases
8.2.4, 8.1.9, 8.0.13, 7.4.17, 7.3.19.
2007-04-19 04:16:09 +00:00
Bruce Momjian eaeacaf374 Update FAQ to mention most recent release for releases
8.2.4, 8.1.9, 8.0.13, 7.4.17, 7.3.19.
2007-04-19 04:04:14 +00:00
Bruce Momjian af6b2e30a4 Stamp releases 8.2.4, 8.1.9, 8.0.13, 7.4.17, 7.3.19. 2007-04-19 03:06:28 +00:00
Bruce Momjian 28ecd60233 Release note updates for 8.2.4, 8.1.9, 8.0.13, 7.4.17, 7.3.19. 2007-04-19 02:46:29 +00:00
Tatsuo Ishii c442dc28d6 Fix pg_wchar_table's maxmblen field of EUC_CN, EUC_TW, MULE_INTERNAL
and GB18030. patches from ITAGAKI Takahiro.
2007-03-26 11:59:37 +00:00
Tom Lane 6ce2ca3332 Fix a longstanding bug in VACUUM FULL's handling of update chains. The code
did not expect that a DEAD tuple could follow a RECENTLY_DEAD tuple in an
update chain, but because the OldestXmin rule for determining deadness is a
simplification of reality, it is possible for this situation to occur
(implying that the RECENTLY_DEAD tuple is in fact dead to all observers,
but this patch does not attempt to exploit that).  The code would follow a
chain forward all the way, but then stop before a DEAD tuple when backing
up, meaning that not all of the chain got moved.  This could lead to copying
the chain multiple times (resulting in duplicate copies of the live tuple at
its end), or leaving dangling index entries behind (which, aside from
generating warnings from later vacuums, creates a risk of wrong query
results or bogus duplicate-key errors once the heap slot the index entry
points to is repopulated).

The fix is to recheck HeapTupleSatisfiesVacuum while following a chain
forward, and to stop if a DEAD tuple is reached.  Each contiguous group
of RECENTLY_DEAD tuples will therefore be copied as a separate chain.
The patch also adds a couple of extra sanity checks to verify correct
behavior.

Per report and test case from Pavan Deolasee.
2007-03-14 18:49:32 +00:00
Tom Lane 4edaffa1d1 Fix markQueryForLocking() to work correctly in the presence of nested views.
It has been wrong for this case since it was first written for 7.1 :-(
Per report from Pavel Hanák.
2007-03-01 18:51:03 +00:00
Tom Lane 2c47aaa0b6 Update 7.x variant horology files to match the new US DST rules. It seems
likely that anyone wanting to run the regression tests in the future will
have up-to-date system timezone files, so this is more likely to work than
the old contents.
2007-02-25 22:37:06 +00:00
Tom Lane 675a313b54 Fix an ancient logic error in plpgsql's exec_stmt_block: it thought it could
get away with not (re)initializing a local variable if the variable is marked
"isconst" and not "isnull".  Unfortunately it makes this decision after having
already freed the old value, meaning that something like

   for i in 1..10 loop
     declare c constant text := 'hi there';

leads to subsequent accesses to freed memory, and hence probably crashes.
(In particular, this is why Asif Ali Rehman's bug leads to crash and not
just an unexpectedly-NULL value for SQLERRM: SQLERRM is marked CONSTANT
and so triggers this error.)

The whole thing seems wrong on its face anyway: CONSTANT means that you can't
change the variable inside the block, not that the initializer expression is
guaranteed not to change value across successive block entries.  Hence,
remove the "optimization" instead of trying to fix it.
2007-02-08 18:38:31 +00:00
Tom Lane 6eb61d578f Rearrange use of plpgsql_add_initdatums() so that only the parsing of a
DECLARE section needs to know about it.  Formerly, everyplace besides DECLARE
that created variables needed to do "plpgsql_add_initdatums(NULL)" to prevent
those variables from being sucked up as part of a subsequent DECLARE block.
This is obviously error-prone, and in fact the SQLSTATE/SQLERRM patch had
failed to do it for those two variables, leading to the bug recently exhibited
by Asif Ali Rehman: a DECLARE within an exception handler tried to reinitialize
SQLERRM.

Although the SQLSTATE/SQLERRM patch isn't in any pre-8.1 branches, and so
I can't point to a demonstrable failure there, it seems wise to back-patch
this into the older branches anyway, just to keep the logic similar to HEAD.
2007-02-08 18:38:28 +00:00
Tom Lane af8a424324 Stamp release 7.3.18.
Security: CVE-2007-0555, CVE-2007-0556
2007-02-02 00:16:01 +00:00