Skip to content
Snippets Groups Projects
  1. Feb 23, 2012
    • Tom Lane's avatar
      Remove arbitrary limitation on length of common name in SSL certificates. · 077711c2
      Tom Lane authored
      Both libpq and the backend would truncate a common name extracted from a
      certificate at 32 bytes.  Replace that fixed-size buffer with dynamically
      allocated string so that there is no hard limit.  While at it, remove the
      code for extracting peer_dn, which we weren't using for anything; and
      don't bother to store peer_cn longer than we need it in libpq.
      
      This limit was not so terribly unreasonable when the code was written,
      because we weren't using the result for anything critical, just logging it.
      But now that there are options for checking the common name against the
      server host name (in libpq) or using it as the user's name (in the server),
      this could result in undesirable failures.  In the worst case it even seems
      possible to spoof a server name or user name, if the correct name is
      exactly 32 bytes and the attacker can persuade a trusted CA to issue a
      certificate in which that string is a prefix of the certificate's common
      name.  (To exploit this for a server name, he'd also have to send the
      connection astray via phony DNS data or some such.)  The case that this is
      a realistic security threat is a bit thin, but nonetheless we'll treat it
      as one.
      
      Back-patch to 8.4.  Older releases contain the faulty code, but it's not
      a security problem because the common name wasn't used for anything
      interesting.
      
      Reported and patched by Heikki Linnakangas
      
      Security: CVE-2012-0867
      077711c2
  2. Feb 22, 2012
    • Peter Eisentraut's avatar
      Add parameters for controlling locations of server-side SSL files · a445cb92
      Peter Eisentraut authored
      This allows changing the location of the files that were previously
      hard-coded to server.crt, server.key, root.crt, root.crl.
      
      server.crt and server.key continue to be the default settings and are
      thus required to be present by default if SSL is enabled.  But the
      settings for the server-side CA and CRL are now empty by default, and
      if they are set, the files are required to be present.  This replaces
      the previous behavior of ignoring the functionality if the files were
      not found.
      a445cb92
  3. Jan 02, 2012
  4. Dec 16, 2011
  5. Sep 09, 2011
    • Tom Lane's avatar
      Move Timestamp/Interval typedefs and basic macros into datatype/timestamp.h. · a7801b62
      Tom Lane authored
      As per my recent proposal, this refactors things so that these typedefs and
      macros are available in a header that can be included in frontend-ish code.
      I also changed various headers that were undesirably including
      utils/timestamp.h to include datatype/timestamp.h instead.  Unsurprisingly,
      this showed that half the system was getting utils/timestamp.h by way of
      xlog.h.
      
      No actual code changes here, just header refactoring.
      a7801b62
  6. Sep 01, 2011
  7. Jun 28, 2011
    • Alvaro Herrera's avatar
      Modernise pg_hba.conf token processing · e5e2fc84
      Alvaro Herrera authored
      The previous coding was ugly, as it marked special tokens as such in the
      wrong stage, relying on workarounds to figure out if they had been
      quoted in the original or not.  This made it impossible to have specific
      keywords be recognized as such only in certain positions in HBA lines,
      for example.  Fix by restructuring the parser code so that it remembers
      whether tokens were quoted or not.  This eliminates widespread knowledge
      of possible known keywords for all fields.
      
      Also improve memory management in this area, to use memory contexts that
      are reset as a whole instead of using retail pfrees; this removes a
      whole lotta crufty (and probably slow) code.
      
      Instead of calling strlen() three times in next_field_expand on the
      returned token to find out whether there was a comma (and strip it),
      pass back the info directly from the callee, which is simpler.
      
      In passing, update historical artifacts in hba.c API.
      
      Authors: Brendan Jurd, Alvaro Herrera
      Reviewed by Pavel Stehule
      e5e2fc84
  8. Apr 10, 2011
  9. Mar 30, 2011
    • Heikki Linnakangas's avatar
      Automatically terminate replication connections that are idle for more · 754baa21
      Heikki Linnakangas authored
      than replication_timeout (a new GUC) milliseconds. The TCP timeout is often
      too long, you want the master to notice a dead connection much sooner.
      People complained about that in 9.0 too, but with synchronous replication
      it's even more important to notice dead connections promptly.
      
      Fujii Masao and Heikki Linnakangas
      754baa21
  10. Mar 19, 2011
    • Magnus Hagander's avatar
      Rename ident authentication over local connections to peer · 6f9192df
      Magnus Hagander authored
      This removes an overloading of two authentication options where
      one is very secure (peer) and one is often insecure (ident). Peer
      is also the name used in libpq from 9.1 to specify the same type
      of authentication.
      
      Also make initdb select peer for local connections when ident is
      chosen, and ident for TCP connections when peer is chosen.
      
      ident keyword in pg_hba.conf is still accepted and maps to peer
      authentication.
      6f9192df
  11. Jan 01, 2011
  12. Oct 27, 2010
  13. Oct 18, 2010
  14. Oct 15, 2010
  15. Sep 20, 2010
  16. Apr 19, 2010
  17. Feb 26, 2010
  18. Jan 27, 2010
  19. Jan 20, 2010
  20. Jan 16, 2010
  21. Jan 15, 2010
    • Heikki Linnakangas's avatar
      Introduce Streaming Replication. · 40f908bd
      Heikki Linnakangas authored
      This includes two new kinds of postmaster processes, walsenders and
      walreceiver. Walreceiver is responsible for connecting to the primary server
      and streaming WAL to disk, while walsender runs in the primary server and
      streams WAL from disk to the client.
      
      Documentation still needs work, but the basics are there. We will probably
      pull the replication section to a new chapter later on, as well as the
      sections describing file-based replication. But let's do that as a separate
      patch, so that it's easier to see what has been added/changed. This patch
      also adds a new section to the chapter about FE/BE protocol, documenting the
      protocol used by walsender/walreceivxer.
      
      Bump catalog version because of two new functions,
      pg_last_xlog_receive_location() and pg_last_xlog_replay_location(), for
      monitoring the progress of replication.
      
      Fujii Masao, with additional hacking by me
      40f908bd
  22. Jan 10, 2010
    • Magnus Hagander's avatar
      Create typedef pgsocket for storing socket descriptors. · 87091cb1
      Magnus Hagander authored
      This silences some warnings on Win64. Not using the proper SOCKET datatype
      was actually wrong on Win32 as well, but didn't cause any warnings there.
      
      Also create define PGINVALID_SOCKET to indicate an invalid/non-existing
      socket, instead of using a hardcoded -1 value.
      87091cb1
  23. Jan 02, 2010
  24. Dec 17, 2009
    • Peter Eisentraut's avatar
      Don't unblock SIGQUIT in the SIGQUIT handler · d6de4309
      Peter Eisentraut authored
      This was possibly linked to a deadlock-like situation in glibc syslog code
      invoked by the ereport call in quickdie().  In any case, a signal handler
      should not unblock its own signal unless there is a specific reason to.
      d6de4309
  25. Dec 16, 2009
  26. Dec 12, 2009
    • Magnus Hagander's avatar
      Allow LDAP authentication to operate in search+bind mode, meaning it · 0182d6f6
      Magnus Hagander authored
      does a search for the user in the directory first, and then binds with
      the DN found for this user.
      
      This allows for LDAP logins in scenarios where the DN of the user cannot
      be determined simply by prefix and suffix, such as the case where different
      users are located in different containers.
      
      The old way of authentication can be significantly faster, so it's kept
      as an option.
      
      Robert Fleming and Magnus Hagander
      0182d6f6
  27. Dec 11, 2009
  28. Oct 01, 2009
  29. Sep 01, 2009
  30. Aug 29, 2009
    • Tom Lane's avatar
      Remove the use of the pg_auth flat file for client authentication. · e710b65c
      Tom Lane authored
      (That flat file is now completely useless, but removal will come later.)
      
      To do this, postpone client authentication into the startup transaction
      that's run by InitPostgres.  We still collect the startup packet and do
      SSL initialization (if needed) at the same time we did before.  The
      AuthenticationTimeout is applied separately to startup packet collection
      and the actual authentication cycle.  (This is a bit annoying, since it
      means a couple extra syscalls; but the signal handling requirements inside
      and outside a transaction are sufficiently different that it seems best
      to treat the timeouts as completely independent.)
      
      A small security disadvantage is that if the given database name is invalid,
      this will be reported to the client before any authentication happens.
      We could work around that by connecting to database "postgres" instead,
      but consensus seems to be that it's not worth introducing such surprising
      behavior.
      
      Processing of all command-line switches and GUC options received from the
      client is now postponed until after authentication.  This means that
      PostAuthDelay is much less useful than it used to be --- if you need to
      investigate problems during InitPostgres you'll have to set PreAuthDelay
      instead.  However, allowing an unauthenticated user to set any GUC options
      whatever seems a bit too risky, so we'll live with that.
      e710b65c
  31. Jun 11, 2009
  32. Apr 20, 2009
  33. Mar 02, 2009
    • Tom Lane's avatar
      When we are in error recursion trouble, arrange to suppress translation and · fd9e2acc
      Tom Lane authored
      encoding conversion of any elog/ereport message being sent to the frontend.
      This generalizes a patch that I put in last October, which suppressed
      translation of only specific messages known to be associated with recursive
      can't-translate-the-message behavior.  As shown in bug #4680, we need a more
      general answer in order to have some hope of coping with broken encoding
      conversion setups.  This approach seems a good deal less klugy anyway.
      
      Patch in all supported branches.
      fd9e2acc
  34. Jan 07, 2009
  35. Jan 01, 2009
Loading