1. 18 5月, 2015 13 次提交
    • N
      pgcrypto: Report errant decryption as "Wrong key or corrupt data". · 85270ac7
      Noah Misch 提交于
      This has been the predominant outcome.  When the output of decrypting
      with a wrong key coincidentally resembled an OpenPGP packet header,
      pgcrypto could instead report "Corrupt data", "Not text data" or
      "Unsupported compression algorithm".  The distinct "Corrupt data"
      message added no value.  The latter two error messages misled when the
      decrypted payload also exhibited fundamental integrity problems.  Worse,
      error message variance in other systems has enabled cryptologic attacks;
      see RFC 4880 section "14. Security Considerations".  Whether these
      pgcrypto behaviors are likewise exploitable is unknown.
      
      In passing, document that pgcrypto does not resist side-channel attacks.
      Back-patch to 9.0 (all supported versions).
      
      Security: CVE-2015-3167
      85270ac7
    • N
      Check return values of sensitive system library calls. · fd97bd41
      Noah Misch 提交于
      PostgreSQL already checked the vast majority of these, missing this
      handful that nearly cannot fail.  If putenv() failed with ENOMEM in
      pg_GSS_recvauth(), authentication would proceed with the wrong keytab
      file.  If strftime() returned zero in cache_locale_time(), using the
      unspecified buffer contents could lead to information exposure or a
      crash.  Back-patch to 9.0 (all supported versions).
      
      Other unchecked calls to these functions, especially those in frontend
      code, pose negligible security concern.  This patch does not address
      them.  Nonetheless, it is always better to check return values whose
      specification provides for indicating an error.
      
      In passing, fix an off-by-one error in strftime_win32()'s invocation of
      WideCharToMultiByte().  Upon retrieving a value of exactly MAX_L10N_DATA
      bytes, strftime_win32() would overrun the caller's buffer by one byte.
      MAX_L10N_DATA is chosen to exceed the length of every possible value, so
      the vulnerable scenario probably does not arise.
      
      Security: CVE-2015-3166
      fd97bd41
    • N
      Add error-throwing wrappers for the printf family of functions. · 16304a01
      Noah Misch 提交于
      All known standard library implementations of these functions can fail
      with ENOMEM.  A caller neglecting to check for failure would experience
      missing output, information exposure, or a crash.  Check return values
      within wrappers and code, currently just snprintf.c, that bypasses the
      wrappers.  The wrappers do not return after an error, so their callers
      need not check.  Back-patch to 9.0 (all supported versions).
      
      Popular free software standard library implementations do take pains to
      bypass malloc() in simple cases, but they risk ENOMEM for floating point
      numbers, positional arguments, large field widths, and large precisions.
      No specification demands such caution, so this commit regards every call
      to a printf family function as a potential threat.
      
      Injecting the wrappers implicitly is a compromise between patch scope
      and design goals.  I would prefer to edit each call site to name a
      wrapper explicitly.  libpq and the ECPG libraries would, ideally, convey
      errors to the caller rather than abort().  All that would be painfully
      invasive for a back-patched security fix, hence this compromise.
      
      Security: CVE-2015-3166
      16304a01
    • N
      Permit use of vsprintf() in PostgreSQL code. · cac18a76
      Noah Misch 提交于
      The next commit needs it.  Back-patch to 9.0 (all supported versions).
      cac18a76
    • N
      Prevent a double free by not reentering be_tls_close(). · b0ce3850
      Noah Misch 提交于
      Reentering this function with the right timing caused a double free,
      typically crashing the backend.  By synchronizing a disconnection with
      the authentication timeout, an unauthenticated attacker could achieve
      this somewhat consistently.  Call be_tls_close() solely from within
      proc_exit_prepare().  Back-patch to 9.0 (all supported versions).
      
      Benkocs Norbert Attila
      
      Security: CVE-2015-3165
      b0ce3850
    • H
      Fix typo in comment. · 8cc7a4c5
      Heikki Linnakangas 提交于
      Jim Nasby
      8cc7a4c5
    • H
      Put back stats-collector restarting code, removed accidentally. · 4df13289
      Heikki Linnakangas 提交于
      Removed that code snippet accidentally in the archive_mode='always' patch.
      
      Also, use varname-tags for archive_command in the docs.
      
      Fujii Masao
      4df13289
    • F
      Don't classify REINDEX command as DDL in the pg_audit doc. · d773b557
      Fujii Masao 提交于
      The commit a936743b changed the class of REINDEX but forgot to update the doc.
      d773b557
    • P
      Add new files to nls.mk · 382b479a
      Peter Eisentraut 提交于
      382b479a
    • T
      Fix failure to copy IndexScan.indexorderbyops in copyfuncs.c. · 42466191
      Tom Lane 提交于
      This oversight results in a crash at executor startup if the plan has
      been copied.  outfuncs.c was missed as well.
      
      While we could probably have taught both those files to cope with the
      originally chosen representation of an Oid array, it would have been
      painful, not least because there'd be no easy way to verify the array
      length.  An Oid List is far easier to work with.  And AFAICS, there is
      no particular notational benefit to using an array rather than a list
      in the existing parts of the patch either.  So just change it to a list.
      
      Error in commit 35fcb1b3, which is new,
      so no need for back-patch.
      42466191
    • T
      Use += not = to set makefile variables after including base makefiles. · b14cf229
      Tom Lane 提交于
      The previous coding in hstore_plpython and ltree_plpython wiped out any
      values set by the base makefiles.  This at least had the effect of running
      the tests in "regression" not "contrib_regression" as expected.  These
      being pretty new modules, there might be other bad effects we'd not
      noticed yet.
      b14cf229
    • T
      Release notes for 9.4.2, 9.3.7, 9.2.11, 9.1.16, 9.0.20. · a0891d2d
      Tom Lane 提交于
      a0891d2d
    • M
      Fix wording error caused by recent typo fixes · de6109b8
      Magnus Hagander 提交于
      It wasn't just a typo, but bad wording. This should make it
      more clear. Pointed out by Tom Lane.
      de6109b8
  2. 17 5月, 2015 8 次提交
  3. 16 5月, 2015 19 次提交
    • T
      More portability fixing for bipartite_match.c. · 26058bf0
      Tom Lane 提交于
      <float.h> is required for isinf() on some platforms.  Per buildfarm.
      26058bf0
    • B
      pg_upgrade: force timeline 1 in the new cluster · 4c5e0600
      Bruce Momjian 提交于
      Previously, this prevented promoted standby servers from being upgraded
      because of a missing WAL history file.  (Timeline 1 doesn't need a
      history file, and we don't copy WAL files anyway.)
      
      Report by Christian Echerer(?), Alexey Klyukin
      
      Backpatch through 9.0
      4c5e0600
    • B
      pg_upgrade: only allow template0 to be non-connectable · fb694d95
      Bruce Momjian 提交于
      This patch causes pg_upgrade to error out during its check phase if:
      
      (1) template0 is marked connectable
      or
      (2) any other database is marked non-connectable
      
      This is done because, in the first case, pg_upgrade would fail because
      the pg_dumpall --globals restore would fail, and in the second case, the
      database would not be restored, leading to data loss.
      
      Report by Matt Landry (1), Stephen Frost (2)
      
      Backpatch through 9.0
      fb694d95
    • T
      Avoid direct use of INFINITY. · 12cc299c
      Tom Lane 提交于
      It's not very portable.  Per buildfarm.
      12cc299c
    • S
      Add docs for tablesample system_time() · f941d033
      Simon Riggs 提交于
      f941d033
    • A
      Support GROUPING SETS, CUBE and ROLLUP. · f3d31185
      Andres Freund 提交于
      This SQL standard functionality allows to aggregate data by different
      GROUP BY clauses at once. Each grouping set returns rows with columns
      grouped by in other sets set to NULL.
      
      This could previously be achieved by doing each grouping as a separate
      query, conjoined by UNION ALLs. Besides being considerably more concise,
      grouping sets will in many cases be faster, requiring only one scan over
      the underlying data.
      
      The current implementation of grouping sets only supports using sorting
      for input. Individual sets that share a sort order are computed in one
      pass. If there are sets that don't share a sort order, additional sort &
      aggregation steps are performed. These additional passes are sourced by
      the previous sort step; thus avoiding repeated scans of the source data.
      
      The code is structured in a way that adding support for purely using
      hash aggregation or a mix of hashing and sorting is possible. Sorting
      was chosen to be supported first, as it is the most generic method of
      implementation.
      
      Instead of, as in an earlier versions of the patch, representing the
      chain of sort and aggregation steps as full blown planner and executor
      nodes, all but the first sort are performed inside the aggregation node
      itself. This avoids the need to do some unusual gymnastics to handle
      having to return aggregated and non-aggregated tuples from underlying
      nodes, as well as having to shut down underlying nodes early to limit
      memory usage.  The optimizer still builds Sort/Agg node to describe each
      phase, but they're not part of the plan tree, but instead additional
      data for the aggregation node. They're a convenient and preexisting way
      to describe aggregation and sorting.  The first (and possibly only) sort
      step is still performed as a separate execution step. That retains
      similarity with existing group by plans, makes rescans fairly simple,
      avoids very deep plans (leading to slow explains) and easily allows to
      avoid the sorting step if the underlying data is sorted by other means.
      
      A somewhat ugly side of this patch is having to deal with a grammar
      ambiguity between the new CUBE keyword and the cube extension/functions
      named cube (and rollup). To avoid breaking existing deployments of the
      cube extension it has not been renamed, neither has cube been made a
      reserved keyword. Instead precedence hacking is used to make GROUP BY
      cube(..) refer to the CUBE grouping sets feature, and not the function
      cube(). To actually group by a function cube(), unlikely as that might
      be, the function name has to be quoted.
      
      Needs a catversion bump because stored rules may change.
      
      Author: Andrew Gierth and Atri Sharma, with contributions from Andres Freund
      Reviewed-By: Andres Freund, Noah Misch, Tom Lane, Svenne Krap, Tomas
          Vondra, Erik Rijkers, Marti Raudsepp, Pavel Stehule
      Discussion: CAOeZVidmVRe2jU6aMk_5qkxnB7dfmPROzM7Ur8JPW5j8Y5X-Lw@mail.gmail.com
      f3d31185
    • S
      Add docs for tablesample system_rows() · 6e4415c6
      Simon Riggs 提交于
      6e4415c6
    • T
      Update time zone data files to tzdata release 2015d. · 9d366c1f
      Tom Lane 提交于
      DST law changes in Egypt, Mongolia, Palestine.
      Historical corrections for Canada and Chile.
      Revised zone abbreviation for America/Adak (HST/HDT not HAST/HADT).
      9d366c1f
    • A
      Add BRIN infrastructure for "inclusion" opclasses · b0b7be61
      Alvaro Herrera 提交于
      This lets BRIN be used with R-Tree-like indexing strategies.
      
      Also provided are operator classes for range types, box and inet/cidr.
      The infrastructure provided here should be sufficient to create operator
      classes for similar datatypes; for instance, opclasses for PostGIS
      geometries should be doable, though we didn't try to implement one.
      
      (A box/point opclass was also submitted, but we ripped it out before
      commit because the handling of floating point comparisons in existing
      code is inconsistent and would generate corrupt indexes.)
      
      Author: Emre Hasegeli.  Cosmetic changes by me
      Review: Andreas Karlsson
      b0b7be61
    • T
      Improve test for CONVERT() with GB18030 <-> UTF8. · 199f5973
      Tom Lane 提交于
      Add a bit of coverage of high code points.
      
      Arjen Nienhuis
      199f5973
    • A
      Move strategy numbers to include/access/stratnum.h · 26df7066
      Alvaro Herrera 提交于
      For upcoming BRIN opclasses, it's convenient to have strategy numbers
      defined in a single place.  Since there's nothing appropriate, create
      it.  The StrategyNumber typedef now lives there, as well as existing
      strategy numbers for B-trees (from skey.h) and R-tree-and-friends (from
      gist.h).  skey.h is forced to include stratnum.h because of the
      StrategyNumber typedef, but gist.h is not; extensions that currently
      rely on gist.h for rtree strategy numbers might need to add a new
      
      A few .c files can stop including skey.h and/or gist.h, which is a nice
      side benefit.
      
      Per discussion:
      https://www.postgresql.org/message-id/20150514232132.GZ2523@alvh.no-ip.org
      
      Authored by Emre Hasegeli and Álvaro.
      
      (It's not clear to me why bootscanner.l has any #include lines at all.)
      26df7066
    • S
      SQLStandard feature T613 Sampling now Supported · 1e98fa0b
      Simon Riggs 提交于
      1e98fa0b
    • T
      Fix uninitialized variable. · 66493dd7
      Tom Lane 提交于
      Per compiler warnings.
      66493dd7
    • S
      Tablesample method API docs · 910baf0a
      Simon Riggs 提交于
      Petr Jelinek
      910baf0a
    • S
      Add to contrib/Makefile · df259759
      Simon Riggs 提交于
      df259759
    • S
      contrib/tsm_system_time · 56e121a5
      Simon Riggs 提交于
      56e121a5
    • S
      contrib/tsm_system_rows · 4d40494b
      Simon Riggs 提交于
      4d40494b
    • S
      TABLESAMPLE system_time(limit) · 149f6f15
      Simon Riggs 提交于
      Contrib module implementing a tablesample method
      that allows you to limit the sample by a hard time
      limit.
      
      Petr Jelinek
      
      Reviewed by Michael Paquier, Amit Kapila and
      Simon Riggs
      149f6f15
    • S
      TABLESAMPLE system_rows(limit) · 9689290f
      Simon Riggs 提交于
      Contrib module implementing a tablesample method
      that allows you to limit the sample by a hard row
      limit.
      
      Petr Jelinek
      
      Reviewed by Michael Paquier, Amit Kapila and
      Simon Riggs
      9689290f